pull/330/head
laoyuyu 7 years ago
parent e362621c38
commit 9ad009d33b
  1. 2
      Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java
  2. 5
      Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java
  3. 1
      Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java
  4. 2
      Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java
  5. 4
      app/src/main/AndroidManifest.xml

@ -56,7 +56,6 @@ final class ResumeAllCmd<T extends AbsTaskEntity> extends AbsNormalCmd<T> {
* @param type {@code 1}单任务下载任务{@code 2}任务组下载任务{@code 3} 单任务上传任务 * @param type {@code 1}单任务下载任务{@code 2}任务组下载任务{@code 3} 单任务上传任务
*/ */
private List<AbsTaskEntity> findTaskData(int type) { private List<AbsTaskEntity> findTaskData(int type) {
// TODO: 2018/4/20 需要测试
List<AbsTaskEntity> tempList = new ArrayList<>(); List<AbsTaskEntity> tempList = new ArrayList<>();
if (type == 1) { if (type == 1) {
List<DTEWrapper> wrappers = DbEntity.findRelationData(DTEWrapper.class, List<DTEWrapper> wrappers = DbEntity.findRelationData(DTEWrapper.class,
@ -144,6 +143,7 @@ final class ResumeAllCmd<T extends AbsTaskEntity> extends AbsNormalCmd<T> {
} else { } else {
te.getEntity().setState(IEntity.STATE_WAIT); te.getEntity().setState(IEntity.STATE_WAIT);
createTask(te); createTask(te);
sendWaitState();
} }
} }
} }

@ -491,7 +491,7 @@ public abstract class AbsFileer<ENTITY extends AbsNormalEntity, TASK_ENTITY exte
/** /**
* 重试线程任务只有线程创建成功才能重试 * 重试线程任务只有线程创建成功才能重试
*/ */
public void retryThradTask() { public void retryThreadTask() {
if (mTask == null || mTask.size() == 0) { if (mTask == null || mTask.size() == 0) {
ALog.w(TAG, "没有线程任务"); ALog.w(TAG, "没有线程任务");
return; return;
@ -501,6 +501,9 @@ public abstract class AbsFileer<ENTITY extends AbsNormalEntity, TASK_ENTITY exte
AbsThreadTask task = mTask.get(key); AbsThreadTask task = mTask.get(key);
if (task != null && !task.isThreadComplete()) { if (task != null && !task.isThreadComplete()) {
task.getConfig().START_LOCATION = task.getCurrentLocation(); task.getConfig().START_LOCATION = task.getCurrentLocation();
mConstance.isStop = false;
mConstance.isCancel = false;
mConstance.isRunning = true;
ALog.d(TAG, String.format("任务【%s】开始重试,线程__%s__【开始位置:%s,结束位置:%s】", mEntity.getFileName(), ALog.d(TAG, String.format("任务【%s】开始重试,线程__%s__【开始位置:%s,结束位置:%s】", mEntity.getFileName(),
key, task.getConfig().START_LOCATION, task.getConfig().END_LOCATION)); key, task.getConfig().START_LOCATION, task.getConfig().END_LOCATION));
mFixedThreadPool.execute(task); mFixedThreadPool.execute(task);

@ -131,6 +131,7 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
* @return {@code true} 中断{@code false} 不是中断 * @return {@code true} 中断{@code false} 不是中断
*/ */
protected boolean isBreak() { protected boolean isBreak() {
ALog.d(TAG, "任务中断");
return STATE.isCancel || STATE.isStop || taskBreak; return STATE.isCancel || STATE.isStop || taskBreak;
} }

@ -504,7 +504,7 @@ public abstract class AbsGroupUtil implements IUtil {
@Override public void run() { @Override public void run() {
Downloader dt = mDownloaderMap.get(subEntity.getUrl()); Downloader dt = mDownloaderMap.get(subEntity.getUrl());
if (dt != null) { if (dt != null) {
dt.retryThradTask(); dt.retryThreadTask();
} }
} }
}, 3000); }, 3000);

@ -15,10 +15,10 @@
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<!--android:name=".test.TestGroupActivity"--> <!--android:name=".test.TestGroupActivity"-->
<!--android:name=".MainActivity"--> <!--android:name=".MainActivity"-->
<!--android:name=".download.group.DownloadGroupActivity"-->
<!--android:name=".test.TestActivity"--> <!--android:name=".test.TestActivity"-->
<!--android:name=".test.AnyRunActivity"-->
<activity <activity
android:name=".test.AnyRunActivity" android:name=".download.group.DownloadGroupActivity"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>

Loading…
Cancel
Save