From d22d7a3e6be412a1d16f172f43b3f7a42a96139a Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Tue, 1 Aug 2017 15:33:41 +0800 Subject: [PATCH] fix bug https://github.com/AriaLyy/Aria/issues/86 --- .../arialyy/aria/core/common/AbsFileer.java | 2 +- .../aria/core/download/BaseDListener.java | 1 + .../aria/core/inf/AbsDownloadTarget.java | 35 ++++++++++++++----- .../simple/download/SingleTaskActivity.java | 1 + .../multi_download/DownloadAdapter.java | 11 +++--- 5 files changed, 36 insertions(+), 14 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 a9af7000..f263e22c 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 @@ -154,8 +154,8 @@ public abstract class AbsFileer> private void saveData(int state, long location) { mEntity.setComplete(state == IEntity.STATE_COMPLETE); if (state == IEntity.STATE_CANCEL) { + mEntity.setState(state); mEntity.deleteData(); } else if (state == IEntity.STATE_COMPLETE) { mEntity.setState(state); diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsDownloadTarget.java b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsDownloadTarget.java index c9414414..23c62afb 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsDownloadTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsDownloadTarget.java @@ -33,18 +33,27 @@ public abstract class AbsDownloadTarget { private static final String DOWNLOAD_URL = //"http://kotlinlang.org/docs/kotlin-docs.pdf"; //"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe"; + //"http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk"; "http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk"; //"http://down2.xiaoshuofuwuqi.com/d/file/filetxt/20170608/14/%BA%DA%CE%D7%CA%A6%E1%C8%C6%F0.txt"; //"http://tinghuaapp.oss-cn-shanghai.aliyuncs.com/20170612201739607815"; diff --git a/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java b/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java index 06a2e572..b88c57e8 100644 --- a/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java +++ b/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java @@ -93,7 +93,8 @@ public class DownloadAdapter extends AbsRVAdapter 0){ - holder.childList.updateChildProgress(((DownloadGroupEntity)entity).getSubTask()); - }else { - holder.childList.addData(((DownloadGroupEntity)entity).getSubTask()); + if (holder.childList.getSubData().size() > 0) { + holder.childList.updateChildProgress(((DownloadGroupEntity) entity).getSubTask()); + } else { + holder.childList.addData(((DownloadGroupEntity) entity).getSubTask()); } }