Compare commits
4 Commits
3.7.8-pre-
...
3.7.8-pre-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9c00c38c6 | ||
|
|
846235a826 | ||
|
|
06dd6b35e0 | ||
|
|
944d69a1af |
@@ -16,29 +16,10 @@
|
||||
package com.arialyy.aria.core.command;
|
||||
|
||||
import com.arialyy.aria.core.AriaManager;
|
||||
import com.arialyy.aria.core.common.AbsEntity;
|
||||
import com.arialyy.aria.core.download.DGTaskWrapper;
|
||||
import com.arialyy.aria.core.download.DTaskWrapper;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.download.DownloadGroupEntity;
|
||||
import com.arialyy.aria.core.inf.IEntity;
|
||||
import com.arialyy.aria.core.inf.IOptionConstant;
|
||||
import com.arialyy.aria.core.manager.TaskWrapperManager;
|
||||
import com.arialyy.aria.core.queue.DGroupTaskQueue;
|
||||
import com.arialyy.aria.core.queue.DTaskQueue;
|
||||
import com.arialyy.aria.core.queue.UTaskQueue;
|
||||
import com.arialyy.aria.core.task.AbsTask;
|
||||
import com.arialyy.aria.core.upload.UTaskWrapper;
|
||||
import com.arialyy.aria.core.upload.UploadEntity;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
||||
import com.arialyy.aria.orm.DbEntity;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import com.arialyy.aria.util.NetUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Created by AriaL on 2017/6/13.
|
||||
@@ -50,7 +31,6 @@ import java.util.concurrent.Executors;
|
||||
*/
|
||||
final class ResumeAllCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
||||
|
||||
|
||||
ResumeAllCmd(T entity, int taskType) {
|
||||
super(entity, taskType);
|
||||
}
|
||||
@@ -60,8 +40,7 @@ final class ResumeAllCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
||||
ALog.w(TAG, "恢复任务失败,网络未连接");
|
||||
return;
|
||||
}
|
||||
new Thread(new ResumeThread(isDownloadCmd, IEntity.STATE_COMPLETE)).start();
|
||||
new Thread(new ResumeThread(isDownloadCmd,
|
||||
String.format("state!=%s", IEntity.STATE_COMPLETE))).start();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ public class ResumeThread implements Runnable {
|
||||
private String TAG = CommonUtil.getClassName(getClass());
|
||||
private List<AbsTaskWrapper> mWaitList = new ArrayList<>();
|
||||
private boolean isDownloadCmd;
|
||||
private int excludeState;
|
||||
private String sqlCondition;
|
||||
|
||||
ResumeThread(boolean isDownload, int excludeState) {
|
||||
ResumeThread(boolean isDownload, String sqlCondition) {
|
||||
this.isDownloadCmd = isDownload;
|
||||
this.excludeState = excludeState;
|
||||
this.sqlCondition = sqlCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,8 +63,8 @@ public class ResumeThread implements Runnable {
|
||||
if (type == 1) {
|
||||
List<DownloadEntity> entities =
|
||||
DbEntity.findDatas(DownloadEntity.class,
|
||||
"isGroupChild=? AND state!=? ORDER BY stopTime DESC", "false",
|
||||
String.valueOf(excludeState));
|
||||
String.format("NOT(isGroupChild) AND NOT(isComplete) AND %s ORDER BY stopTime DESC",
|
||||
sqlCondition));
|
||||
if (entities != null && !entities.isEmpty()) {
|
||||
for (DownloadEntity entity : entities) {
|
||||
addResumeEntity(TaskWrapperManager.getInstance()
|
||||
@@ -73,8 +73,9 @@ public class ResumeThread implements Runnable {
|
||||
}
|
||||
} else if (type == 2) {
|
||||
List<DownloadGroupEntity> entities =
|
||||
DbEntity.findDatas(DownloadGroupEntity.class, "state!=? ORDER BY stopTime DESC",
|
||||
String.valueOf(excludeState));
|
||||
DbEntity.findDatas(DownloadGroupEntity.class,
|
||||
String.format("NOT(isComplete) AND %s ORDER BY stopTime DESC",
|
||||
sqlCondition));
|
||||
if (entities != null && !entities.isEmpty()) {
|
||||
for (DownloadGroupEntity entity : entities) {
|
||||
addResumeEntity(
|
||||
@@ -84,8 +85,9 @@ public class ResumeThread implements Runnable {
|
||||
}
|
||||
} else if (type == 3) {
|
||||
List<UploadEntity> entities =
|
||||
DbEntity.findDatas(UploadEntity.class, "state!=? ORDER BY stopTime DESC",
|
||||
String.valueOf(excludeState));
|
||||
DbEntity.findDatas(UploadEntity.class,
|
||||
String.format("NOT(isComplete) AND %s ORDER BY stopTime DESC",
|
||||
sqlCondition));
|
||||
if (entities != null && !entities.isEmpty()) {
|
||||
for (UploadEntity entity : entities) {
|
||||
addResumeEntity(TaskWrapperManager.getInstance()
|
||||
@@ -125,7 +127,7 @@ public class ResumeThread implements Runnable {
|
||||
queue = DGroupTaskQueue.getInstance();
|
||||
}
|
||||
|
||||
if (queue == null){
|
||||
if (queue == null) {
|
||||
ALog.e(TAG, "任务类型错误");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ final class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
||||
* 当缓冲队列为null时,查找数据库中所有等待中的任务
|
||||
*/
|
||||
private void findAllWaitTask() {
|
||||
new Thread(new ResumeThread(isDownloadCmd, IEntity.STATE_WAIT)).start();
|
||||
new Thread(
|
||||
new ResumeThread(isDownloadCmd, String.format("state=%s", IEntity.STATE_WAIT))).start();
|
||||
}
|
||||
}
|
||||
18
README.md
18
README.md
@@ -44,16 +44,16 @@ Aria有以下特点:
|
||||
|
||||
## 引入库
|
||||
[](https://github.com/AriaLyy/Aria/blob/master/LICENSE)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
[](https://github.com/AriaLyy/Aria)
|
||||
|
||||
```java
|
||||
implementation 'com.arialyy.aria:core:v_3.7.8-pre-1'
|
||||
annotationProcessor 'com.arialyy.aria:compiler:v_3.7.8-pre-1'
|
||||
implementation 'com.arialyy.aria:ftpComponent:v_3.7.8-pre-1' # 如果需要使用ftp,请增加该组件
|
||||
implementation 'com.arialyy.aria:m3u8Component:v_3.7.8-pre-1' # 如果需要使用m3u8下载功能,请增加该组件
|
||||
implementation 'com.arialyy.aria:core:3.7.8-pre-3'
|
||||
annotationProcessor 'com.arialyy.aria:compiler:3.7.8-pre-3'
|
||||
implementation 'com.arialyy.aria:ftpComponent:3.7.8-pre-3' # 如果需要使用ftp,请增加该组件
|
||||
implementation 'com.arialyy.aria:m3u8Component:3.7.8-pre-3' # 如果需要使用m3u8下载功能,请增加该组件
|
||||
```
|
||||
如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:core:<last-version>'`替换为
|
||||
```
|
||||
@@ -137,7 +137,7 @@ protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
|
||||
### 版本日志
|
||||
+ v_v_3.7.8-pre-1 (2019/11/20)
|
||||
+ v_3.7.8-pre-1 (2019/11/20)
|
||||
- fix bug https://github.com/AriaLyy/Aria/issues/526
|
||||
|
||||
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
|
||||
|
||||
@@ -277,7 +277,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
||||
Aria.download(this).load(mTaskId).stop();
|
||||
} else {
|
||||
Aria.download(this).load(mTaskId)
|
||||
//.updateUrl("http://sdkdown.muzhiwan.com/openfile/2019/07/11/com.netease.syfz.mzw_5d26f8d9cee27.apk")
|
||||
.updateUrl("http://sdkdown.muzhiwan.com/openfile/2019/07/11/com.netease.syfz.mzw_5d26f8d9cee27.apk")
|
||||
.resume();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -45,7 +45,7 @@ task clean(type: Delete) {
|
||||
|
||||
ext {
|
||||
versionCode = 378
|
||||
versionName = '3.7.8-pre-1'
|
||||
versionName = '3.7.8-pre-3'
|
||||
userOrg = 'arialyy'
|
||||
groupId = 'com.arialyy.aria'
|
||||
publishVersion = versionName
|
||||
|
||||
Reference in New Issue
Block a user