From a33df648ab55526b1dda7f4c75e4c95666f4e5a6 Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Fri, 7 Sep 2018 15:31:10 +0800 Subject: [PATCH] fix bug fix bug https://github.com/AriaLyy/Aria/issues/272 --- .../arialyy/aria/core/common/AbsFileer.java | 18 ++++---- .../aria/core/download/BaseDListener.java | 4 +- .../aria/core/download/DownloadGroupTask.java | 9 +--- .../aria/core/download/DownloadTask.java | 7 +--- .../download/downloader/AbsGroupUtil.java | 41 ++++++++----------- DEV_LOG.md | 7 +++- app/src/main/AndroidManifest.xml | 6 +-- .../arialyy/aria/core/upload/UploadTask.java | 8 +--- build.gradle | 2 +- 9 files changed, 39 insertions(+), 63 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java index b5c5aed8..f6b6b3b7 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java @@ -34,8 +34,8 @@ import java.util.HashSet; import java.util.List; import java.util.Properties; import java.util.Set; -import java.util.Timer; -import java.util.TimerTask; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; /** * Created by AriaL on 2017/7/1. @@ -67,7 +67,7 @@ public abstract class AbsFileer mTask = new SparseArray<>(); - private Timer mTimer; + private ScheduledThreadPoolExecutor mTimer; @Deprecated private File mConfigFile; /** * 进度刷新间隔 @@ -190,8 +190,8 @@ public abstract class AbsFileer outHandler; private int RUN_SAVE_INTERVAL = 5 * 1000; //5s保存一次下载中的进度 - private long mLastLen = 0; //上一次发送长度 + private long mLastLen; //上一次发送长度 private boolean isFirst = true; protected ENTITY mEntity; protected TASK_ENTITY mTaskEntity; private TASK mTask; - private boolean isConvertSpeed = false; + private boolean isConvertSpeed; private long mLastSaveTime; private long mUpdateInterval; diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTask.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTask.java index 0443e1d4..855ab3e9 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTask.java @@ -18,7 +18,6 @@ package com.arialyy.aria.core.download; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; -import android.util.Log; import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.download.downloader.DownloadGroupUtil; import com.arialyy.aria.core.download.downloader.FtpDirDownloadUtil; @@ -26,7 +25,6 @@ import com.arialyy.aria.core.download.downloader.IDownloadGroupListener; import com.arialyy.aria.core.inf.AbsGroupTask; import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.scheduler.ISchedulers; -import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.CheckUtil; /** @@ -74,12 +72,7 @@ public class DownloadGroupTask extends AbsGroupTask - + @@ -29,7 +29,7 @@ - + diff --git a/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java b/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java index 4ea9b707..84b62020 100644 --- a/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java +++ b/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java @@ -21,7 +21,6 @@ import com.arialyy.aria.core.inf.AbsNormalTask; import com.arialyy.aria.core.inf.IUploadListener; import com.arialyy.aria.core.scheduler.ISchedulers; import com.arialyy.aria.core.upload.uploader.SimpleUploadUtil; -import com.arialyy.aria.util.ALog; /** * Created by lyy on 2017/2/23. @@ -53,12 +52,7 @@ public class UploadTask extends AbsNormalTask { private UploadTaskEntity mTaskEntity; public void setOutHandler(ISchedulers outHandler) { - try { - mOutHandler = new Handler(outHandler); - } catch (Exception e) { - e.printStackTrace(); - mOutHandler = new Handler(Looper.getMainLooper(), outHandler); - } + mOutHandler = new Handler(Looper.getMainLooper(), outHandler); } public void setUploadTaskEntity(UploadTaskEntity taskEntity) { diff --git a/build.gradle b/build.gradle index ed1e5bf9..f2f07861 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ task clean(type: Delete) { ext { userOrg = 'arialyy' groupId = 'com.arialyy.aria' - publishVersion = '3.4.16' + publishVersion = '3.5_dev1' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架'