修复组合任务单个子任务失败后,重新恢复组合任务,组合任务状态变为完成的问题

pull/631/head
laoyuyu 5 years ago
parent 472006ef61
commit ad58dce395
  1. 3
      DEV_LOG.md
  2. 6
      PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHandler.java
  3. 2
      PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHelper.java
  4. 2
      app/src/main/assets/aria_config.xml
  5. 7
      app/src/main/java/com/arialyy/simple/core/download/group/DownloadGroupActivity.java
  6. 19
      app/src/main/java/com/arialyy/simple/core/download/group/GroupModule.java

@ -1,4 +1,7 @@
## 开发日志 ## 开发日志
+ v_3.8.7
- 修复组合任务单个子任务失败后,重新恢复组合任务,组合任务状态变为完成的问题
+ v_3.8.6 (2020/2/17) + v_3.8.6 (2020/2/17)
- fix bug https://github.com/AriaLyy/Aria/issues/608 - fix bug https://github.com/AriaLyy/Aria/issues/608
- fix bug https://github.com/AriaLyy/Aria/issues/579#issuecomment-586665035 - fix bug https://github.com/AriaLyy/Aria/issues/579#issuecomment-586665035

@ -30,6 +30,7 @@ import com.arialyy.aria.util.CommonUtil;
import com.arialyy.aria.util.DbDataHelper; import com.arialyy.aria.util.DbDataHelper;
import com.arialyy.aria.util.FileUtil; import com.arialyy.aria.util.FileUtil;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -84,6 +85,11 @@ public abstract class RecordHandler implements IRecordHandler {
mTaskRecord = DbDataHelper.getTaskRecord(getFilePath(), mEntity.getTaskType()); mTaskRecord = DbDataHelper.getTaskRecord(getFilePath(), mEntity.getTaskType());
if (mTaskRecord == null) { if (mTaskRecord == null) {
initRecord(true); initRecord(true);
}else if (mTaskRecord.threadRecords == null || mTaskRecord.threadRecords.size() == 0){
if (mTaskRecord.threadRecords == null){
mTaskRecord.threadRecords = new ArrayList<>();
}
initRecord(false);
} }
handlerTaskRecord(mTaskRecord); handlerTaskRecord(mTaskRecord);
} }

@ -174,7 +174,7 @@ public class RecordHelper {
tr.startLocation = 0; tr.startLocation = 0;
tr.isComplete = false; tr.isComplete = false;
tr.endLocation = mWrapper.getEntity().getFileSize(); tr.endLocation = mWrapper.getEntity().getFileSize();
} else if (file.length() == mWrapper.getEntity().getFileSize()) { } else if (file.length() != 0 && file.length() == mWrapper.getEntity().getFileSize()) {
ALog.d(TAG, "文件长度一致,线程完成"); ALog.d(TAG, "文件长度一致,线程完成");
tr.isComplete = true; tr.isComplete = true;
} else { } else {

@ -131,7 +131,7 @@
<!-- =============================以下为子任务的配置====================================--> <!-- =============================以下为子任务的配置====================================-->
<!--能同时下载的子任务最大任务数,默认3--> <!--能同时下载的子任务最大任务数,默认3-->
<subMaxTaskNum value="1"/> <subMaxTaskNum value="5"/>
<!--子任务下载失败时的重试次数,默认为5--> <!--子任务下载失败时的重试次数,默认为5-->
<subReTryNum value="5"/> <subReTryNum value="5"/>

@ -163,8 +163,11 @@ public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBin
} }
@DownloadGroup.onTaskFail() void taskFail(DownloadGroupTask task) { @DownloadGroup.onTaskFail() void taskFail(DownloadGroupTask task) {
ALog.d(TAG, "group task fail"); if (task != null){
getBinding().pl.setInfo(task.getEntity());
ALog.d(TAG, "group task fail");
getBinding().pl.setInfo(task.getEntity());
}
} }
@DownloadGroup.onTaskComplete() void taskComplete(DownloadGroupTask task) { @DownloadGroup.onTaskComplete() void taskComplete(DownloadGroupTask task) {

@ -34,8 +34,14 @@ public class GroupModule extends BaseModule {
List<String> urls = new ArrayList<>(); List<String> urls = new ArrayList<>();
//urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574141924275&di=a7ea1497a4a2528a45ce7103bf61adf4&imgtype=0&src=http%3A%2F%2Fg.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fc2cec3fdfc03924590b2a9b58d94a4c27d1e2500.jpg"); //urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574141924275&di=a7ea1497a4a2528a45ce7103bf61adf4&imgtype=0&src=http%3A%2F%2Fg.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fc2cec3fdfc03924590b2a9b58d94a4c27d1e2500.jpg");
//urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574141924272&di=7861479e7cb3cea98d585eaf108f056f&imgtype=0&src=http%3A%2F%2Fd.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F562c11dfa9ec8a13c0741f5afd03918fa0ecc01a.jpg"); //urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574141924272&di=7861479e7cb3cea98d585eaf108f056f&imgtype=0&src=http%3A%2F%2Fd.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F562c11dfa9ec8a13c0741f5afd03918fa0ecc01a.jpg");
String[] str = getContext().getResources().getStringArray(R.array.group_urls_1); //String[] str = getContext().getResources().getStringArray(R.array.group_urls_1);
Collections.addAll(urls, str); //Collections.addAll(urls, str);
urls.add("http://img2.imgtn.bdimg.com/it/u=3105600238,693167464&fm=26&gp=0.jpg");
urls.add("http://a4.att.hudong.com/22/59/19300001325156131228593878903.jpg");
urls.add("http://pic1.win4000.com/mobile/2019-12-16/5df71dc866a0c.jpg");
urls.add("http://pics4.baidu.com/feed/e824b899a9014c08545e5585620d360e7bf4f421.jpeg");
urls.add("http://img.blog.163.com/photo/iFUKcs6shB4PNlfxwH-yTw==/2542563464627686395.jpg");
return urls; return urls;
} }
@ -49,8 +55,13 @@ public class GroupModule extends BaseModule {
List<String> getSubName() { List<String> getSubName() {
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
String[] str = getContext().getResources().getStringArray(R.array.group_names); //String[] str = getContext().getResources().getStringArray(R.array.group_names);
Collections.addAll(names, str); //Collections.addAll(names, str);
names.add("1.png");
names.add("2.png");
names.add("3.png");
names.add("4.png");
names.add("5.png");
return names; return names;
} }

Loading…
Cancel
Save