pull/330/head
AriaLyy 7 years ago
parent 12521e0e55
commit 4b239bf6ba
  1. 18
      Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java
  2. 34
      Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java
  3. 20
      AriaCompiler/src/main/java/com/arialyy/compiler/AriaProcessor.java
  4. 2
      DEV_LOG.md
  5. 2
      build.gradle
  6. 4
      gradle.properties

@ -16,6 +16,7 @@
package com.arialyy.aria.core.command.normal; package com.arialyy.aria.core.command.normal;
import com.arialyy.aria.core.download.DownloadGroupTaskEntity;
import com.arialyy.aria.core.download.DownloadTaskEntity; import com.arialyy.aria.core.download.DownloadTaskEntity;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
import com.arialyy.aria.core.upload.UploadTaskEntity; import com.arialyy.aria.core.upload.UploadTaskEntity;
@ -43,10 +44,25 @@ public class CancelAllCmd<T extends AbsTaskEntity> extends AbsNormalCmd<T> {
@Override public void executeCmd() { @Override public void executeCmd() {
removeAll(); removeAll();
if (mTaskEntity instanceof DownloadTaskEntity) { if (mTaskEntity instanceof DownloadTaskEntity
|| mTaskEntity instanceof DownloadGroupTaskEntity) {
handleDownloadRemove(); handleDownloadRemove();
handleDownloadRemove();
handleDownloadGroupRemove();
} else if (mTaskEntity instanceof UploadTaskEntity) { } else if (mTaskEntity instanceof UploadTaskEntity) {
handleUploadRemove(); handleUploadRemove();
handleUploadRemove();
}
}
/**
* 处理下载任务组的删除操作
*/
private void handleDownloadGroupRemove() {
List<DownloadGroupTaskEntity> allEntity = DbEntity.findAllData(DownloadGroupTaskEntity.class);
if (allEntity == null || allEntity.size() == 0) return;
for (DownloadGroupTaskEntity entity : allEntity) {
CommonUtil.delDownloadGroupTaskConfig(removeFile, entity);
} }
} }

@ -216,6 +216,39 @@ public class CommonUtil {
return md5; return md5;
} }
/**
* 删除下载任务组的配置
*
* @param removeFile {@code true} 不仅删除任务数据库记录还会删除已经删除完成的文件
* {@code false}如果任务已经完成只删除任务数据库记录
*/
public static void delDownloadGroupTaskConfig(boolean removeFile,
DownloadGroupTaskEntity tEntity) {
DownloadGroupEntity entity = tEntity.getEntity();
List<DownloadTaskEntity> tasks =
DbEntity.findDatas(DownloadTaskEntity.class, "groupName=?", tEntity.key);
if (tasks != null && !tasks.isEmpty()) {
for (DownloadTaskEntity taskEntity : tasks) {
delDownloadTaskConfig(removeFile, taskEntity);
}
}
File dir = new File(tEntity.getEntity().getDirPath());
if (removeFile) {
if (dir.exists()) {
dir.delete();
}
} else {
if (!tEntity.getEntity().isComplete()) {
dir.delete();
}
}
if (entity != null) {
entity.deleteData();
}
tEntity.deleteData();
}
/** /**
* 删除上传任务的配置 * 删除上传任务的配置
* *
@ -246,6 +279,7 @@ public class CommonUtil {
*/ */
public static void delDownloadTaskConfig(boolean removeFile, DownloadTaskEntity tEntity) { public static void delDownloadTaskConfig(boolean removeFile, DownloadTaskEntity tEntity) {
DownloadEntity dEntity = tEntity.getEntity(); DownloadEntity dEntity = tEntity.getEntity();
if (dEntity == null) return;
File file = new File(dEntity.getDownloadPath()); File file = new File(dEntity.getDownloadPath());
if (removeFile) { if (removeFile) {
if (file.exists()) { if (file.exists()) {

@ -16,6 +16,7 @@
package com.arialyy.compiler; package com.arialyy.compiler;
import com.arialyy.annotations.Download; import com.arialyy.annotations.Download;
import com.arialyy.annotations.DownloadGroup;
import com.arialyy.annotations.Upload; import com.arialyy.annotations.Upload;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -54,16 +55,15 @@ import javax.lang.model.element.TypeElement;
annotataions.add(Download.onTaskStart.class.getCanonicalName()); annotataions.add(Download.onTaskStart.class.getCanonicalName());
annotataions.add(Download.onTaskStop.class.getCanonicalName()); annotataions.add(Download.onTaskStop.class.getCanonicalName());
//下载任务的注解 //下载任务的注解
annotataions.add(Download.onPre.class.getCanonicalName()); annotataions.add(DownloadGroup.onPre.class.getCanonicalName());
annotataions.add(Download.onNoSupportBreakPoint.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskCancel.class.getCanonicalName());
annotataions.add(Download.onTaskCancel.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskComplete.class.getCanonicalName());
annotataions.add(Download.onTaskComplete.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskFail.class.getCanonicalName());
annotataions.add(Download.onTaskFail.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskPre.class.getCanonicalName());
annotataions.add(Download.onTaskPre.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskResume.class.getCanonicalName());
annotataions.add(Download.onTaskResume.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskRunning.class.getCanonicalName());
annotataions.add(Download.onTaskRunning.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskStart.class.getCanonicalName());
annotataions.add(Download.onTaskStart.class.getCanonicalName()); annotataions.add(DownloadGroup.onTaskStop.class.getCanonicalName());
annotataions.add(Download.onTaskStop.class.getCanonicalName());
//上传任务的注解 //上传任务的注解
annotataions.add(Upload.onPre.class.getCanonicalName()); annotataions.add(Upload.onPre.class.getCanonicalName());
annotataions.add(Upload.onNoSupportBreakPoint.class.getCanonicalName()); annotataions.add(Upload.onNoSupportBreakPoint.class.getCanonicalName());

@ -1,4 +1,6 @@
## 开发日志 ## 开发日志
+ v_3.2.26 修复任务组有时注解不起作用的问题
+ v_3.2.25 修复删除任务组文件,记录无法删除的问题
+ v_3.2.17 修复一个版本兼容性问题,线程中使用Aria出错问题 + v_3.2.17 修复一个版本兼容性问题,线程中使用Aria出错问题
+ v_3.2.15 修复大型文件分段下载失败的问题,修复中文URL乱码问题 + v_3.2.15 修复大型文件分段下载失败的问题,修复中文URL乱码问题
+ v_3.2.14 修复恢复所有任务的api接口,不能恢复下载组任务的问题 + v_3.2.14 修复恢复所有任务的api接口,不能恢复下载组任务的问题

@ -37,7 +37,7 @@ task clean(type: Delete) {
ext { ext {
userOrg = 'arialyy' userOrg = 'arialyy'
groupId = 'com.arialyy.aria' groupId = 'com.arialyy.aria'
publishVersion = '3.2.25' publishVersion = '3.2.26'
repoName='maven' repoName='maven'
desc = 'android 下载框架' desc = 'android 下载框架'
website = 'https://github.com/AriaLyy/Aria' website = 'https://github.com/AriaLyy/Aria'

@ -13,3 +13,7 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true
#Wed Dec 07 20:19:22 CST 2016 #Wed Dec 07 20:19:22 CST 2016
# gradle proxy https://chaosleong.github.io/2017/02/10/Configuring-Gradle-Proxy/
#systemProp.socksProxyHost=127.0.0.1
#systemProp.socksProxyPort=58224
#systemprop.socksProxyVersion=5

Loading…
Cancel
Save