|
|
@ -47,11 +47,11 @@ public class ResumeThread implements Runnable { |
|
|
|
private String TAG = CommonUtil.getClassName(getClass()); |
|
|
|
private String TAG = CommonUtil.getClassName(getClass()); |
|
|
|
private List<AbsTaskWrapper> mWaitList = new ArrayList<>(); |
|
|
|
private List<AbsTaskWrapper> mWaitList = new ArrayList<>(); |
|
|
|
private boolean isDownloadCmd; |
|
|
|
private boolean isDownloadCmd; |
|
|
|
private int excludeState; |
|
|
|
private String sqlCondition; |
|
|
|
|
|
|
|
|
|
|
|
ResumeThread(boolean isDownload, int excludeState) { |
|
|
|
ResumeThread(boolean isDownload, String sqlCondition) { |
|
|
|
this.isDownloadCmd = isDownload; |
|
|
|
this.isDownloadCmd = isDownload; |
|
|
|
this.excludeState = excludeState; |
|
|
|
this.sqlCondition = sqlCondition; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -63,8 +63,8 @@ public class ResumeThread implements Runnable { |
|
|
|
if (type == 1) { |
|
|
|
if (type == 1) { |
|
|
|
List<DownloadEntity> entities = |
|
|
|
List<DownloadEntity> entities = |
|
|
|
DbEntity.findDatas(DownloadEntity.class, |
|
|
|
DbEntity.findDatas(DownloadEntity.class, |
|
|
|
"isGroupChild=? AND state!=? ORDER BY stopTime DESC", "false", |
|
|
|
String.format("NOT(isGroupChild) AND NOT(isComplete) AND %s ORDER BY stopTime DESC", |
|
|
|
String.valueOf(excludeState)); |
|
|
|
sqlCondition)); |
|
|
|
if (entities != null && !entities.isEmpty()) { |
|
|
|
if (entities != null && !entities.isEmpty()) { |
|
|
|
for (DownloadEntity entity : entities) { |
|
|
|
for (DownloadEntity entity : entities) { |
|
|
|
addResumeEntity(TaskWrapperManager.getInstance() |
|
|
|
addResumeEntity(TaskWrapperManager.getInstance() |
|
|
@ -73,8 +73,9 @@ public class ResumeThread implements Runnable { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (type == 2) { |
|
|
|
} else if (type == 2) { |
|
|
|
List<DownloadGroupEntity> entities = |
|
|
|
List<DownloadGroupEntity> entities = |
|
|
|
DbEntity.findDatas(DownloadGroupEntity.class, "state!=? ORDER BY stopTime DESC", |
|
|
|
DbEntity.findDatas(DownloadGroupEntity.class, |
|
|
|
String.valueOf(excludeState)); |
|
|
|
String.format("NOT(isComplete) AND %s ORDER BY stopTime DESC", |
|
|
|
|
|
|
|
sqlCondition)); |
|
|
|
if (entities != null && !entities.isEmpty()) { |
|
|
|
if (entities != null && !entities.isEmpty()) { |
|
|
|
for (DownloadGroupEntity entity : entities) { |
|
|
|
for (DownloadGroupEntity entity : entities) { |
|
|
|
addResumeEntity( |
|
|
|
addResumeEntity( |
|
|
@ -84,8 +85,9 @@ public class ResumeThread implements Runnable { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (type == 3) { |
|
|
|
} else if (type == 3) { |
|
|
|
List<UploadEntity> entities = |
|
|
|
List<UploadEntity> entities = |
|
|
|
DbEntity.findDatas(UploadEntity.class, "state!=? ORDER BY stopTime DESC", |
|
|
|
DbEntity.findDatas(UploadEntity.class, |
|
|
|
String.valueOf(excludeState)); |
|
|
|
String.format("NOT(isComplete) AND %s ORDER BY stopTime DESC", |
|
|
|
|
|
|
|
sqlCondition)); |
|
|
|
if (entities != null && !entities.isEmpty()) { |
|
|
|
if (entities != null && !entities.isEmpty()) { |
|
|
|
for (UploadEntity entity : entities) { |
|
|
|
for (UploadEntity entity : entities) { |
|
|
|
addResumeEntity(TaskWrapperManager.getInstance() |
|
|
|
addResumeEntity(TaskWrapperManager.getInstance() |
|
|
|