parent
							
								
									c604eda465
								
							
						
					
					
						commit
						7ccad5c994
					
				| @ -1,172 +1,173 @@ | ||||
| /* | ||||
|  * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0
 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package com.arialyy.aria.core.download; | ||||
| 
 | ||||
| import android.support.annotation.CheckResult; | ||||
| import android.text.TextUtils; | ||||
| import com.arialyy.aria.core.inf.AbsEntity; | ||||
| import com.arialyy.aria.core.manager.SubTaskManager; | ||||
| import com.arialyy.aria.core.queue.DownloadGroupTaskQueue; | ||||
| import com.arialyy.aria.orm.DbEntity; | ||||
| import com.arialyy.aria.util.ALog; | ||||
| import java.io.File; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * Created by lyy on 2017/7/26. | ||||
|  */ | ||||
| abstract class BaseGroupTarget<TARGET extends BaseGroupTarget> | ||||
|     extends AbsDownloadTarget<TARGET, DownloadGroupEntity, DGTaskWrapper> { | ||||
| 
 | ||||
|   /** | ||||
|    * 组任务名 | ||||
|    */ | ||||
|   String mGroupHash; | ||||
|   /** | ||||
|    * 文件夹临时路径 | ||||
|    */ | ||||
|   String mDirPathTemp; | ||||
|   /** | ||||
|    * 是否需要修改路径 | ||||
|    */ | ||||
|   boolean needModifyPath = false; | ||||
| 
 | ||||
|   private SubTaskManager mSubTaskManager; | ||||
| 
 | ||||
|   /** | ||||
|    * 获取子任务管理器 | ||||
|    * | ||||
|    * @return 子任务管理器 | ||||
|    */ | ||||
|   @CheckResult | ||||
|   public SubTaskManager getSubTaskManager() { | ||||
|     if (mSubTaskManager == null) { | ||||
|       mSubTaskManager = new SubTaskManager(mTargetName, mTaskWrapper); | ||||
|     } | ||||
|     return mSubTaskManager; | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 设置任务组别名 | ||||
|    */ | ||||
|   @CheckResult | ||||
|   public TARGET setGroupAlias(String alias) { | ||||
|     if (TextUtils.isEmpty(alias)) return (TARGET) this; | ||||
|     mEntity.setAlias(alias); | ||||
|     return (TARGET) this; | ||||
|   } | ||||
| 
 | ||||
|   @Override public boolean taskExists() { | ||||
|     return DbEntity.checkDataExist(DownloadGroupEntity.class, "groupHash=?", mGroupHash); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 设置任务组的文件夹路径,该api后续会删除 | ||||
|    * | ||||
|    * @param groupDirPath 任务组保存文件夹路径 | ||||
|    * @deprecated {@link #setDirPath(String)} 请使用这个api | ||||
|    */ | ||||
|   @Deprecated | ||||
|   @CheckResult | ||||
|   public TARGET setDownloadDirPath(String groupDirPath) { | ||||
|     return setDirPath(groupDirPath); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 设置任务组的文件夹路径,在Aria中,任务组的所有子任务都会下载到以任务组组名的文件夹中。 | ||||
|    * 如:groupDirPath = "/mnt/sdcard/download/group_test" | ||||
|    * <pre> | ||||
|    *   {@code | ||||
|    *      + mnt | ||||
|    *        + sdcard | ||||
|    *          + download | ||||
|    *            + group_test | ||||
|    *              - task1.apk | ||||
|    *              - task2.apk | ||||
|    *              - task3.apk | ||||
|    *              .... | ||||
|    * | ||||
|    *   } | ||||
|    * </pre> | ||||
|    * | ||||
|    * @param dirPath 任务组保存文件夹路径 | ||||
|    */ | ||||
|   @CheckResult | ||||
|   public TARGET setDirPath(String dirPath) { | ||||
|     mDirPathTemp = dirPath; | ||||
|     return (TARGET) this; | ||||
|   } | ||||
| 
 | ||||
|   @Override public boolean isRunning() { | ||||
|     DownloadGroupTask task = DownloadGroupTaskQueue.getInstance().getTask(mEntity.getKey()); | ||||
|     return task != null && task.isRunning(); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 改变任务组文件夹路径,修改文件夹路径会将子任务所有路径更换 | ||||
|    * | ||||
|    * @param newDirPath 新的文件夹路径 | ||||
|    */ | ||||
|   void reChangeDirPath(String newDirPath) { | ||||
|     List<DTaskWrapper> subTasks = mTaskWrapper.getSubTaskWrapper(); | ||||
|     if (subTasks != null && !subTasks.isEmpty()) { | ||||
|       List<DbEntity> des = new ArrayList<>(); | ||||
|       for (DTaskWrapper dte : subTasks) { | ||||
|         DownloadEntity de = dte.getEntity(); | ||||
|         String oldPath = de.getDownloadPath(); | ||||
|         String newPath = newDirPath + "/" + de.getFileName(); | ||||
|         File file = new File(oldPath); | ||||
|         if (file.exists()) { | ||||
|           file.renameTo(new File(newPath)); | ||||
|         } | ||||
|         de.setDownloadPath(newPath); | ||||
|         des.add(de); | ||||
|       } | ||||
|       AbsEntity.saveAll(des); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 检查并设置文件夹路径 | ||||
|    * | ||||
|    * @return {@code true} 合法 | ||||
|    */ | ||||
|   boolean checkDirPath() { | ||||
|     if (TextUtils.isEmpty(mDirPathTemp)) { | ||||
|       ALog.e(TAG, "文件夹路径不能为null"); | ||||
|       return false; | ||||
|     } else if (!mDirPathTemp.startsWith("/")) { | ||||
|       ALog.e(TAG, "文件夹路径【" + mDirPathTemp + "】错误"); | ||||
|       return false; | ||||
|     } | ||||
|     File file = new File(mDirPathTemp); | ||||
|     if (file.isFile()) { | ||||
|       ALog.e(TAG, "路径【" + mDirPathTemp + "】是文件,请设置文件夹路径"); | ||||
|       return false; | ||||
|     } | ||||
| 
 | ||||
|     if (TextUtils.isEmpty(mEntity.getDirPath()) || !mEntity.getDirPath().equals(mDirPathTemp)) { | ||||
|       if (!file.exists()) { | ||||
|         file.mkdirs(); | ||||
|       } | ||||
|       needModifyPath = true; | ||||
|       mEntity.setDirPath(mDirPathTemp); | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
|   } | ||||
| } | ||||
| /* | ||||
|  * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0
 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package com.arialyy.aria.core.download; | ||||
| 
 | ||||
| import android.support.annotation.CheckResult; | ||||
| import android.text.TextUtils; | ||||
| import com.arialyy.aria.core.inf.AbsEntity; | ||||
| import com.arialyy.aria.core.manager.SubTaskManager; | ||||
| import com.arialyy.aria.core.queue.DownloadGroupTaskQueue; | ||||
| import com.arialyy.aria.orm.DbEntity; | ||||
| import com.arialyy.aria.util.ALog; | ||||
| import java.io.File; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * Created by lyy on 2017/7/26. | ||||
|  */ | ||||
| abstract class BaseGroupTarget<TARGET extends BaseGroupTarget> | ||||
|     extends AbsDownloadTarget<TARGET, DownloadGroupEntity, DGTaskWrapper> { | ||||
| 
 | ||||
|   /** | ||||
|    * 组任务名 | ||||
|    */ | ||||
|   String mGroupHash; | ||||
|   /** | ||||
|    * 文件夹临时路径 | ||||
|    */ | ||||
|   String mDirPathTemp; | ||||
|   /** | ||||
|    * 是否需要修改路径 | ||||
|    */ | ||||
|   boolean needModifyPath = false; | ||||
| 
 | ||||
|   private SubTaskManager mSubTaskManager; | ||||
| 
 | ||||
|   /** | ||||
|    * 获取子任务管理器 | ||||
|    * | ||||
|    * @return 子任务管理器 | ||||
|    */ | ||||
|   @CheckResult | ||||
|   public SubTaskManager getSubTaskManager() { | ||||
|     if (mSubTaskManager == null) { | ||||
|       mSubTaskManager = new SubTaskManager(mTargetName, mTaskWrapper); | ||||
|     } | ||||
|     return mSubTaskManager; | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 设置任务组别名 | ||||
|    */ | ||||
|   @CheckResult | ||||
|   public TARGET setGroupAlias(String alias) { | ||||
|     if (TextUtils.isEmpty(alias)) return (TARGET) this; | ||||
|     mEntity.setAlias(alias); | ||||
|     return (TARGET) this; | ||||
|   } | ||||
| 
 | ||||
|   @Override public boolean taskExists() { | ||||
|     return DbEntity.checkDataExist(DownloadGroupEntity.class, "groupHash=?", mGroupHash); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 设置任务组的文件夹路径,该api后续会删除 | ||||
|    * | ||||
|    * @param groupDirPath 任务组保存文件夹路径 | ||||
|    * @deprecated {@link #setDirPath(String)} 请使用这个api | ||||
|    */ | ||||
|   @Deprecated | ||||
|   @CheckResult | ||||
|   public TARGET setDownloadDirPath(String groupDirPath) { | ||||
|     return setDirPath(groupDirPath); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 设置任务组的文件夹路径,在Aria中,任务组的所有子任务都会下载到以任务组组名的文件夹中。 | ||||
|    * 如:groupDirPath = "/mnt/sdcard/download/group_test" | ||||
|    * <pre> | ||||
|    *   {@code | ||||
|    *      + mnt | ||||
|    *        + sdcard | ||||
|    *          + download | ||||
|    *            + group_test | ||||
|    *              - task1.apk | ||||
|    *              - task2.apk | ||||
|    *              - task3.apk | ||||
|    *              .... | ||||
|    * | ||||
|    *   } | ||||
|    * </pre> | ||||
|    * | ||||
|    * @param dirPath 任务组保存文件夹路径 | ||||
|    */ | ||||
|   @CheckResult | ||||
|   public TARGET setDirPath(String dirPath) { | ||||
|     mDirPathTemp = dirPath; | ||||
|     return (TARGET) this; | ||||
|   } | ||||
| 
 | ||||
|   @Override public boolean isRunning() { | ||||
|     DownloadGroupTask task = DownloadGroupTaskQueue.getInstance().getTask(mEntity.getKey()); | ||||
|     return task != null && task.isRunning(); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 改变任务组文件夹路径,修改文件夹路径会将子任务所有路径更换 | ||||
|    * | ||||
|    * @param newDirPath 新的文件夹路径 | ||||
|    */ | ||||
|   void reChangeDirPath(String newDirPath) { | ||||
|     List<DTaskWrapper> subTasks = mTaskWrapper.getSubTaskWrapper(); | ||||
|     if (subTasks != null && !subTasks.isEmpty()) { | ||||
|       List<DbEntity> des = new ArrayList<>(); | ||||
|       for (DTaskWrapper dte : subTasks) { | ||||
|         DownloadEntity de = dte.getEntity(); | ||||
|         String oldPath = de.getDownloadPath(); | ||||
|         String newPath = newDirPath + "/" + de.getFileName(); | ||||
|         File file = new File(oldPath); | ||||
|         if (file.exists()) { | ||||
|           file.renameTo(new File(newPath)); | ||||
|         } | ||||
|         de.setDownloadPath(newPath); | ||||
|         des.add(de); | ||||
|       } | ||||
|       AbsEntity.saveAll(des); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * 检查并设置文件夹路径 | ||||
|    * | ||||
|    * @return {@code true} 合法 | ||||
|    */ | ||||
|   boolean checkDirPath() { | ||||
|     if (TextUtils.isEmpty(mDirPathTemp)) { | ||||
|       ALog.e(TAG, "文件夹路径不能为null"); | ||||
|       return false; | ||||
|     } else if (!mDirPathTemp.startsWith("/")) { | ||||
|       ALog.e(TAG, "文件夹路径【" + mDirPathTemp + "】错误"); | ||||
|       return false; | ||||
|     } | ||||
|     File file = new File(mDirPathTemp); | ||||
|     if (file.isFile()) { | ||||
|       ALog.e(TAG, "路径【" + mDirPathTemp + "】是文件,请设置文件夹路径"); | ||||
|       return false; | ||||
|     } | ||||
| 
 | ||||
|     if (TextUtils.isEmpty(mEntity.getDirPath()) || !mEntity.getDirPath().equals(mDirPathTemp)) { | ||||
|       if (!file.exists()) { | ||||
|         file.mkdirs(); | ||||
|       } | ||||
|       needModifyPath = true; | ||||
|       mEntity.setDirPath(mDirPathTemp); | ||||
|       ALog.i(TAG, String.format("文件夹路径改变,将更新文件夹路径为:%s", mDirPathTemp)); | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -1,212 +1,212 @@ | ||||
| ## 开发日志 | ||||
|   + v_3.6.2 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/368 | ||||
|     - 增加gradle 5.0支持 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/374 | ||||
|   + v_3.6.1 (2019/3/5) | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/367 | ||||
|   + v_3.6 (2019/2/27) | ||||
|     - 优化数据库写入\修改的速度 | ||||
|     - 精减任务实体的存储 | ||||
|     - 增加下载组合任务的配置 | ||||
|     - useBroadcast\notNetRetry这两个配置,统一在AppConfig中配置 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/361 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/365 | ||||
|   + v_3.5.4 (2019/1/8) | ||||
|     - 修复不支持断点的下载地址,重复下载出现的数据库主键冲突问题 | ||||
|   + v_3.5.3 (2018/12/23) | ||||
|     - 修复ftps不能加载默认证书的bug https://github.com/AriaLyy/Aria/issues/334 | ||||
|     - 优化注解性能,移除不必要的判断代码 | ||||
|     - 增加广播支持,详情见:http://aria.laoyuyu.me/aria_doc/api/use_broadcast.html | ||||
|     - 增加get参数支持 | ||||
|       ```java | ||||
|       Aria.download(SingleTaskActivity.this) | ||||
|               .load(DOWNLOAD_URL) // url 必须是主体url,也就是?前面的内容 | ||||
|               .setFilePath(path, true) | ||||
|               .asGet() | ||||
|               .setParams(params) // 设置参数 | ||||
|               .start(); | ||||
|       ``` | ||||
|       - fix bug https://github.com/AriaLyy/Aria/issues/335 | ||||
|       - 新增进度百分比保存 https://github.com/AriaLyy/Aria/issues/336 | ||||
|       - fix bug https://github.com/AriaLyy/Aria/issues/335 | ||||
|   + v_3.5.2 | ||||
|     - 添加Serializable接口支持 https://github.com/AriaLyy/Aria/issues/320 | ||||
|     - 失败回调增加错误原因 https://github.com/AriaLyy/Aria/issues/310 | ||||
|       ``` | ||||
|       @Download.onTaskFail void taskFail(DownloadTask task, Exception e) { | ||||
|          e.getMessage(); | ||||
|         ... | ||||
|       } | ||||
|       ``` | ||||
|      - fix bug https://github.com/AriaLyy/Aria/issues/322 | ||||
|      - 新增201 重定向支持 https://github.com/AriaLyy/Aria/issues/318 | ||||
|      - 修复使用`useServerFileName(true)`中含有`"`导致的文件后缀名错误问题 | ||||
|      - 优化logcat日志提示 | ||||
|      - 修改下载线程的优先级为`Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);` | ||||
|      - fix bug https://github.com/AriaLyy/Aria/issues/319 | ||||
|      - 修复分卡下载失败的问题 https://github.com/AriaLyy/Aria/issues/326 | ||||
|      - 初始化Aria时会将所有数据库状态为下载中的任务改为已停止,防止应用被kill后,任务状态错误 | ||||
|      - 初始化时自动判断文件是否被删除,文件被删除的任务将自动重置默认值 | ||||
|      - 修复刷新url后,文件无法删除的 bug | ||||
|      - fix bug https://github.com/AriaLyy/Aria/issues/309 | ||||
|      - 优化配置文件的读取 | ||||
|   + v_3.5.1 | ||||
|     - 优化`taskExists`方法 | ||||
|     - 添加`post`参数请求支持 | ||||
|       ```java | ||||
|       Aria.download(SingleTaskActivity.this) | ||||
|               .load(DOWNLOAD_URL) | ||||
|               .setFilePath(path) | ||||
|               .asPost() // post请求 | ||||
|               .setParam("key", "value") //传递参数 | ||||
|               //.setParams(Map<String, String>) // 传递多参数 | ||||
|               .start(); | ||||
|       ``` | ||||
|      - 增加强制设置文件路径的api, https://github.com/AriaLyy/Aria/issues/311 | ||||
|        ``` | ||||
|        Aria.download(SingleTaskActivity.this) | ||||
|                      .load(DOWNLOAD_URL) | ||||
|                      .setFilePath(path, true) // true表示忽略路径是否被占用 | ||||
|                      .start(); | ||||
|        ``` | ||||
|   + v_3.5 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/302 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/283 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/305 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/306 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/272  (现在,停止所有任务,未开始的任务状态将变为停止) | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/277 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/303 | ||||
|     - 优化停止任务的速度 | ||||
|     - 修复组合任务修改子任务文件名失败的问题 | ||||
|   + v_3.4.12 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/286 | ||||
|     - 优化线程池任务 | ||||
|   + v_3.4.11 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/288 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/282 | ||||
|   + v_3.4.10 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/280 | ||||
|   + v_3.4.9 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/276 | ||||
|   + v_3.4.8 | ||||
|     - 组合任务新增`updateUrls(List<String>)`用于修改组合子任务的url,[see](https://aria.laoyuyu.me/aria_doc/api/update_url.html) | ||||
|     - 出于安全考虑,FTP数据库去掉密码的保存 | ||||
|     - 增加FTPS支持 [see](https://aria.laoyuyu.me/aria_doc/download/ftps.html) | ||||
|     - 增加速度限制支持[see](https://aria.laoyuyu.me/aria_doc/api/speed_handle.html) | ||||
|     - 增加内存空间不足验证 | ||||
|   + v_3.4.7 | ||||
|     - 修复分块任务异常操作导致的问题 | ||||
|   + v_3.4.6 | ||||
|     - 修复android 4.4.4 版本多dex下无法进行回调的问题 | ||||
|     - 新增`updateUrl(newUrl)`用于修改任务的url,[see](https://aria.laoyuyu.me/aria_doc/api/task_handle.html#%E6%9B%B4%E6%96%B0%E4%BB%BB%E5%8A%A1url) | ||||
|     - 优化分块下载 | ||||
|     - 修复了字符串中有特殊字符导致的路径冲突问题;修复ftp分块下载失败问题 | ||||
|     - 修复连接中有`+`导致的地址呗使用问题。 | ||||
|     - 修复表重复创建导致的崩溃问题 https://github.com/AriaLyy/Aria/issues/264 | ||||
|   + v_3.4.4 | ||||
|     - 实现[多线程分块下载](https://aria.laoyuyu.me/aria_doc/start/config.html) | ||||
|     - 修复`stopAll()`和`resumeAll()`导致的进度为0问题 | ||||
|     - 修复任务组添加header无效的问题 | ||||
|   + v_3.4.3 | ||||
|     - 修复在activity 的onStop中取消注册导致的内存泄露问题 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/258 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/259 | ||||
|   + v_3.4.2 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/248 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/247 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/250 | ||||
|     - 添加任务判断是否存在的api | ||||
|     - 添加代理api | ||||
|     - 修复删除所有没有进出等待的问题 | ||||
|     - 进度有时出错的问题 | ||||
|     - FTP添加超时处理 | ||||
|   + v_3.4.1 | ||||
|     - 移除记录配置文件,改用数据库记录任务记录 | ||||
|     - 上传配置添加io超时时间、缓存大小配置 | ||||
|     - 添加没有网络也会重试的开关 | ||||
|     - 修复多次删除记录的bug | ||||
|     - 文件长度现在可动态增加,详情见 https://aria.laoyuyu.me/aria_doc/start/config.html | ||||
|     - 修复多module同时引用Aria导致打正式包出错的问题 https://github.com/AriaLyy/Aria/issues/240 | ||||
|   + v_3.4 | ||||
|     - 优化大量代码 | ||||
|     - 重构Aria的ORM模型,提高了数据读取的可靠性和读写速度 | ||||
|     - 现在可在任意类中使用Aria了,[使用方法](http://aria.laoyuyu.me/aria_doc/start/any_java.html) | ||||
|     - 添加`window.location.replace("http://xxxx")`类型的网页重定向支持 | ||||
|     - 支持gzip、deflate 压缩类型的输入流 | ||||
|     - 添加`useServerFileName`,可使用服务端响应header的`Content-Disposition`携带的文件名 | ||||
|   + v_3.3.16 | ||||
|     - 修复一个activity启动多次,无法进行回掉的bug https://github.com/AriaLyy/Aria/issues/200 | ||||
|     - 优化target代码结构,移除路径被占用的提示 | ||||
|     - 添加支持chunked模式的下载 | ||||
|     - 去掉上一个版本"//"的限制 | ||||
|   + v_3.3.14 | ||||
|     - 修复ftp上传和下载的兼容性问题 | ||||
|     - 如果url中的path有"//"将替换为"/" | ||||
|     - 修复http上传成功后,如果服务器没有设置返回码导致上传失败的问题 | ||||
|     - 上传实体UploadEntity增加responseStr字段,http上传完成后,在被`@Upload.onComplete`注解的方法中,可通过`task.getEntity().getResponseStr())`获取服务器返回的数据 | ||||
|     - 如果服务器存在已上传了一部分的文件,用户执行删除该FTP上传任务,再次重新上传,会出现550,权限错误;本版本已修复该问题 | ||||
|   + v_3.3.13 | ||||
|     - 添加`@Download.onWait、@Upload.onWait、@DownloadGroup.onWait`三个新注解,队列已经满了,继续创建新任务,任务处于等待中,将会执行被这三个注解标志的方法 | ||||
|     - app被kill,但是还存在等待中的任务A;第二次重新启动,先创建一个新的任务B,Aria会自动把B放进等待队列中,这时再次创建任务A,会导致重复下载,进度错乱的问题;本版本已修复这个问题 | ||||
|   + v_3.3.11 | ||||
|     - 添加进度更新间隔api,在`aria_config.xml`配置`<updateInterval value="1000"/>`或在代码中调用 | ||||
|       `AriaManager.getInstance(AriaManager.APP).getDownloadConfig().setUpdateInterval(3000)`便可以改变进度刷新间隔 | ||||
|     - 修复下载过程中kill进程可能出现的文件错误的问题 https://github.com/AriaLyy/Aria/issues/192 | ||||
|     - 修复http上传的空指针问题 https://github.com/AriaLyy/Aria/issues/193 | ||||
|     - 修复下载地址中含有`'`导致的崩溃问题 https://github.com/AriaLyy/Aria/issues/194 | ||||
|   + v_3.3.10 | ||||
|     - 修复地址切换导致下载失败的问题 https://github.com/AriaLyy/Aria/issues/181 | ||||
|     - 添加重置状态的api,当下载信息不改变,只是替换了服务器的对应的文件,可用`Aria.download(this).load(url).resetState()`重置下载状态 https://github.com/AriaLyy/Aria/issues/182 | ||||
|   + v_3.3.9 | ||||
|     - 添加POST支持 | ||||
|     - 任务执行的过程中,如果调用removeRecord()方法,将会取消任务 https://github.com/AriaLyy/Aria/issues/174 | ||||
|     - 修复一个数据库初始化的问题 https://github.com/AriaLyy/Aria/issues/173 | ||||
|     - 修复head头部信息过长时出现的崩溃问题 https://github.com/AriaLyy/Aria/issues/177 | ||||
|   + v_3.3.7 | ||||
|     - 修复一个线程重启的问题 https://github.com/AriaLyy/Aria/issues/160 | ||||
|     - 修复配置文件异常问题、格式化速度为0问题 https://github.com/AriaLyy/Aria/issues/161 | ||||
|   + v_3.3.6 | ||||
|     - 增加日志输出级别控制 | ||||
|     - 修复公网FTP地址不能下载的问题  https://github.com/AriaLyy/Aria/issues/146 | ||||
|     - 修复http下载地址有空格的时候下载失败的问题 https://github.com/AriaLyy/Aria/issues/131 | ||||
|     - 修复Activity在`onDestroy()`中调用`Aria.download(this).unRegister();`导致回调失效的问题 | ||||
|     - 修复Adapter下载FTP任务问题、任务调度问题 https://github.com/AriaLyy/Aria/issues/157 | ||||
|     - 优化代码,优化了IO性能 | ||||
|   + v_3.3.5 修复任务组、上传任务无法启动的bug | ||||
|   + v_3.3.4 优化任务代码结构,修复上一个版本暂停后无法自动执行任务的问题 | ||||
|   + v_3.3.3 修复进度条错乱的问题,修复同一时间多次调用start导致重复下载的问题 | ||||
|   + v_3.3.2 新加reTry(),修复上一个版本不会回调失败事件的问题;增加running状态下5秒钟保存一次数据库的功能;修复FTP断点上传文件不完整的问题 | ||||
|   + v_3.3.1 增加网络事件,网络未连接,将不会重试下载,修复删除未开始任务,状态回调错误 | ||||
|   + v_3.3.0 增加任务组子任务暂停和开始控制功能、修复5.0系统以上数据库多生成两个字段的bug、去掉addSchedulerListener事件 | ||||
|   + v_3.2.26 修复任务组有时注解不起作用的问题 | ||||
|   + v_3.2.25 修复删除任务组文件,记录无法删除的问题 | ||||
|   + v_3.2.17 修复一个版本兼容性问题,线程中使用Aria出错问题 | ||||
|   + v_3.2.15 修复大型文件分段下载失败的问题,修复中文URL乱码问题 | ||||
|   + v_3.2.14 修复恢复所有任务的api接口,不能恢复下载组任务的问题 | ||||
|   + v_3.2.13 修复某些服务器头文件返回描述文件格式错误的问题、修复有时删除任务,需要两次删除的问题 | ||||
|   + v_3.2.12 实现FTP多线程断点续传下载,FTP断点续传上传功能 | ||||
|   + v_3.2.9 修复任务组下载完成两次回掉的问题,修复又是获取不到下载状态的问题 | ||||
|   + v_3.2.8 修复下载超过2G大小的文件失败的问题 | ||||
|   + v_3.2.7 移除设置文件名的api接口,修复断开网络时出现的进度条错误的问题 | ||||
|   + v_3.2.6 移除广播事件,增加任务组下载功能 | ||||
|   + v_3.1.9 修复stopAll队列没有任务时崩溃的问题,增加针对单个任务监听的功能 | ||||
|   + v_3.1.7 修复某些文件下载不了的bug,增加apt注解方法,事件获取更加简单了 | ||||
|   + v_3.1.6 取消任务时onTaskCancel回调两次的bug | ||||
|   + v_3.1.5 优化代码结构,增加优先下载任务功能。 | ||||
|   + v_3.1.4 修复快速切换,暂停、恢复功能时,概率性出现的重新下载问题,添加onPre()回调,onPre()用于请求地址之前执行界面UI更新操作。 | ||||
|   + v_3.1.0 添加Aria配置文件,优化代码 | ||||
|   + v_3.0.3 修复暂停后删除任务,闪退问题,添加删除记录的api | ||||
|   + v_3.0.2 支持30x重定向链接下载 | ||||
|   + v_3.0.0 添加上传任务支持,修复一些已发现的bug | ||||
|   + v_2.4.4 修复不支持断点的下载链接拿不到文件大小的问题 | ||||
|   + v_2.4.3 修复404链接卡顿的问题 | ||||
|   + v_2.4.2 修复失败重试无效的bug | ||||
|   + v_2.4.1 修复下载慢的问题,修复application、service 不能使用的问题 | ||||
|   + v_2.4.0 支持https链接下载 | ||||
|   + v_2.3.8 修复数据错乱的bug、添加fragment支持 | ||||
|   + v_2.3.6 添加dialog、popupWindow支持 | ||||
|   + v_2.3.3 添加断点支持、修改下载逻辑,让使用更加简单、修复一个内存泄露的bug | ||||
|   + v_2.3.1 重命名为Aria,下载流程简化 | ||||
| ## 开发日志 | ||||
|   + v_3.6.2 (2019/4/1) | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/368 | ||||
|     - 增加gradle 5.0支持 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/374 | ||||
|   + v_3.6.1 (2019/3/5) | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/367 | ||||
|   + v_3.6 (2019/2/27) | ||||
|     - 优化数据库写入\修改的速度 | ||||
|     - 精减任务实体的存储 | ||||
|     - 增加下载组合任务的配置 | ||||
|     - useBroadcast\notNetRetry这两个配置,统一在AppConfig中配置 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/361 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/365 | ||||
|   + v_3.5.4 (2019/1/8) | ||||
|     - 修复不支持断点的下载地址,重复下载出现的数据库主键冲突问题 | ||||
|   + v_3.5.3 (2018/12/23) | ||||
|     - 修复ftps不能加载默认证书的bug https://github.com/AriaLyy/Aria/issues/334 | ||||
|     - 优化注解性能,移除不必要的判断代码 | ||||
|     - 增加广播支持,详情见:http://aria.laoyuyu.me/aria_doc/api/use_broadcast.html | ||||
|     - 增加get参数支持 | ||||
|       ```java | ||||
|       Aria.download(SingleTaskActivity.this) | ||||
|               .load(DOWNLOAD_URL) // url 必须是主体url,也就是?前面的内容 | ||||
|               .setFilePath(path, true) | ||||
|               .asGet() | ||||
|               .setParams(params) // 设置参数 | ||||
|               .start(); | ||||
|       ``` | ||||
|       - fix bug https://github.com/AriaLyy/Aria/issues/335 | ||||
|       - 新增进度百分比保存 https://github.com/AriaLyy/Aria/issues/336 | ||||
|       - fix bug https://github.com/AriaLyy/Aria/issues/335 | ||||
|   + v_3.5.2 | ||||
|     - 添加Serializable接口支持 https://github.com/AriaLyy/Aria/issues/320 | ||||
|     - 失败回调增加错误原因 https://github.com/AriaLyy/Aria/issues/310 | ||||
|       ``` | ||||
|       @Download.onTaskFail void taskFail(DownloadTask task, Exception e) { | ||||
|          e.getMessage(); | ||||
|         ... | ||||
|       } | ||||
|       ``` | ||||
|      - fix bug https://github.com/AriaLyy/Aria/issues/322 | ||||
|      - 新增201 重定向支持 https://github.com/AriaLyy/Aria/issues/318 | ||||
|      - 修复使用`useServerFileName(true)`中含有`"`导致的文件后缀名错误问题 | ||||
|      - 优化logcat日志提示 | ||||
|      - 修改下载线程的优先级为`Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);` | ||||
|      - fix bug https://github.com/AriaLyy/Aria/issues/319 | ||||
|      - 修复分卡下载失败的问题 https://github.com/AriaLyy/Aria/issues/326 | ||||
|      - 初始化Aria时会将所有数据库状态为下载中的任务改为已停止,防止应用被kill后,任务状态错误 | ||||
|      - 初始化时自动判断文件是否被删除,文件被删除的任务将自动重置默认值 | ||||
|      - 修复刷新url后,文件无法删除的 bug | ||||
|      - fix bug https://github.com/AriaLyy/Aria/issues/309 | ||||
|      - 优化配置文件的读取 | ||||
|   + v_3.5.1 | ||||
|     - 优化`taskExists`方法 | ||||
|     - 添加`post`参数请求支持 | ||||
|       ```java | ||||
|       Aria.download(SingleTaskActivity.this) | ||||
|               .load(DOWNLOAD_URL) | ||||
|               .setFilePath(path) | ||||
|               .asPost() // post请求 | ||||
|               .setParam("key", "value") //传递参数 | ||||
|               //.setParams(Map<String, String>) // 传递多参数 | ||||
|               .start(); | ||||
|       ``` | ||||
|      - 增加强制设置文件路径的api, https://github.com/AriaLyy/Aria/issues/311 | ||||
|        ``` | ||||
|        Aria.download(SingleTaskActivity.this) | ||||
|                      .load(DOWNLOAD_URL) | ||||
|                      .setFilePath(path, true) // true表示忽略路径是否被占用 | ||||
|                      .start(); | ||||
|        ``` | ||||
|   + v_3.5 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/302 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/283 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/305 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/306 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/272  (现在,停止所有任务,未开始的任务状态将变为停止) | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/277 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/303 | ||||
|     - 优化停止任务的速度 | ||||
|     - 修复组合任务修改子任务文件名失败的问题 | ||||
|   + v_3.4.12 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/286 | ||||
|     - 优化线程池任务 | ||||
|   + v_3.4.11 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/288 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/282 | ||||
|   + v_3.4.10 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/280 | ||||
|   + v_3.4.9 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/276 | ||||
|   + v_3.4.8 | ||||
|     - 组合任务新增`updateUrls(List<String>)`用于修改组合子任务的url,[see](https://aria.laoyuyu.me/aria_doc/api/update_url.html) | ||||
|     - 出于安全考虑,FTP数据库去掉密码的保存 | ||||
|     - 增加FTPS支持 [see](https://aria.laoyuyu.me/aria_doc/download/ftps.html) | ||||
|     - 增加速度限制支持[see](https://aria.laoyuyu.me/aria_doc/api/speed_handle.html) | ||||
|     - 增加内存空间不足验证 | ||||
|   + v_3.4.7 | ||||
|     - 修复分块任务异常操作导致的问题 | ||||
|   + v_3.4.6 | ||||
|     - 修复android 4.4.4 版本多dex下无法进行回调的问题 | ||||
|     - 新增`updateUrl(newUrl)`用于修改任务的url,[see](https://aria.laoyuyu.me/aria_doc/api/task_handle.html#%E6%9B%B4%E6%96%B0%E4%BB%BB%E5%8A%A1url) | ||||
|     - 优化分块下载 | ||||
|     - 修复了字符串中有特殊字符导致的路径冲突问题;修复ftp分块下载失败问题 | ||||
|     - 修复连接中有`+`导致的地址呗使用问题。 | ||||
|     - 修复表重复创建导致的崩溃问题 https://github.com/AriaLyy/Aria/issues/264 | ||||
|   + v_3.4.4 | ||||
|     - 实现[多线程分块下载](https://aria.laoyuyu.me/aria_doc/start/config.html) | ||||
|     - 修复`stopAll()`和`resumeAll()`导致的进度为0问题 | ||||
|     - 修复任务组添加header无效的问题 | ||||
|   + v_3.4.3 | ||||
|     - 修复在activity 的onStop中取消注册导致的内存泄露问题 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/258 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/259 | ||||
|   + v_3.4.2 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/248 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/247 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/250 | ||||
|     - 添加任务判断是否存在的api | ||||
|     - 添加代理api | ||||
|     - 修复删除所有没有进出等待的问题 | ||||
|     - 进度有时出错的问题 | ||||
|     - FTP添加超时处理 | ||||
|   + v_3.4.1 | ||||
|     - 移除记录配置文件,改用数据库记录任务记录 | ||||
|     - 上传配置添加io超时时间、缓存大小配置 | ||||
|     - 添加没有网络也会重试的开关 | ||||
|     - 修复多次删除记录的bug | ||||
|     - 文件长度现在可动态增加,详情见 https://aria.laoyuyu.me/aria_doc/start/config.html | ||||
|     - 修复多module同时引用Aria导致打正式包出错的问题 https://github.com/AriaLyy/Aria/issues/240 | ||||
|   + v_3.4 | ||||
|     - 优化大量代码 | ||||
|     - 重构Aria的ORM模型,提高了数据读取的可靠性和读写速度 | ||||
|     - 现在可在任意类中使用Aria了,[使用方法](http://aria.laoyuyu.me/aria_doc/start/any_java.html) | ||||
|     - 添加`window.location.replace("http://xxxx")`类型的网页重定向支持 | ||||
|     - 支持gzip、deflate 压缩类型的输入流 | ||||
|     - 添加`useServerFileName`,可使用服务端响应header的`Content-Disposition`携带的文件名 | ||||
|   + v_3.3.16 | ||||
|     - 修复一个activity启动多次,无法进行回掉的bug https://github.com/AriaLyy/Aria/issues/200 | ||||
|     - 优化target代码结构,移除路径被占用的提示 | ||||
|     - 添加支持chunked模式的下载 | ||||
|     - 去掉上一个版本"//"的限制 | ||||
|   + v_3.3.14 | ||||
|     - 修复ftp上传和下载的兼容性问题 | ||||
|     - 如果url中的path有"//"将替换为"/" | ||||
|     - 修复http上传成功后,如果服务器没有设置返回码导致上传失败的问题 | ||||
|     - 上传实体UploadEntity增加responseStr字段,http上传完成后,在被`@Upload.onComplete`注解的方法中,可通过`task.getEntity().getResponseStr())`获取服务器返回的数据 | ||||
|     - 如果服务器存在已上传了一部分的文件,用户执行删除该FTP上传任务,再次重新上传,会出现550,权限错误;本版本已修复该问题 | ||||
|   + v_3.3.13 | ||||
|     - 添加`@Download.onWait、@Upload.onWait、@DownloadGroup.onWait`三个新注解,队列已经满了,继续创建新任务,任务处于等待中,将会执行被这三个注解标志的方法 | ||||
|     - app被kill,但是还存在等待中的任务A;第二次重新启动,先创建一个新的任务B,Aria会自动把B放进等待队列中,这时再次创建任务A,会导致重复下载,进度错乱的问题;本版本已修复这个问题 | ||||
|   + v_3.3.11 | ||||
|     - 添加进度更新间隔api,在`aria_config.xml`配置`<updateInterval value="1000"/>`或在代码中调用 | ||||
|       `AriaManager.getInstance(AriaManager.APP).getDownloadConfig().setUpdateInterval(3000)`便可以改变进度刷新间隔 | ||||
|     - 修复下载过程中kill进程可能出现的文件错误的问题 https://github.com/AriaLyy/Aria/issues/192 | ||||
|     - 修复http上传的空指针问题 https://github.com/AriaLyy/Aria/issues/193 | ||||
|     - 修复下载地址中含有`'`导致的崩溃问题 https://github.com/AriaLyy/Aria/issues/194 | ||||
|   + v_3.3.10 | ||||
|     - 修复地址切换导致下载失败的问题 https://github.com/AriaLyy/Aria/issues/181 | ||||
|     - 添加重置状态的api,当下载信息不改变,只是替换了服务器的对应的文件,可用`Aria.download(this).load(url).resetState()`重置下载状态 https://github.com/AriaLyy/Aria/issues/182 | ||||
|   + v_3.3.9 | ||||
|     - 添加POST支持 | ||||
|     - 任务执行的过程中,如果调用removeRecord()方法,将会取消任务 https://github.com/AriaLyy/Aria/issues/174 | ||||
|     - 修复一个数据库初始化的问题 https://github.com/AriaLyy/Aria/issues/173 | ||||
|     - 修复head头部信息过长时出现的崩溃问题 https://github.com/AriaLyy/Aria/issues/177 | ||||
|   + v_3.3.7 | ||||
|     - 修复一个线程重启的问题 https://github.com/AriaLyy/Aria/issues/160 | ||||
|     - 修复配置文件异常问题、格式化速度为0问题 https://github.com/AriaLyy/Aria/issues/161 | ||||
|   + v_3.3.6 | ||||
|     - 增加日志输出级别控制 | ||||
|     - 修复公网FTP地址不能下载的问题  https://github.com/AriaLyy/Aria/issues/146 | ||||
|     - 修复http下载地址有空格的时候下载失败的问题 https://github.com/AriaLyy/Aria/issues/131 | ||||
|     - 修复Activity在`onDestroy()`中调用`Aria.download(this).unRegister();`导致回调失效的问题 | ||||
|     - 修复Adapter下载FTP任务问题、任务调度问题 https://github.com/AriaLyy/Aria/issues/157 | ||||
|     - 优化代码,优化了IO性能 | ||||
|   + v_3.3.5 修复任务组、上传任务无法启动的bug | ||||
|   + v_3.3.4 优化任务代码结构,修复上一个版本暂停后无法自动执行任务的问题 | ||||
|   + v_3.3.3 修复进度条错乱的问题,修复同一时间多次调用start导致重复下载的问题 | ||||
|   + v_3.3.2 新加reTry(),修复上一个版本不会回调失败事件的问题;增加running状态下5秒钟保存一次数据库的功能;修复FTP断点上传文件不完整的问题 | ||||
|   + v_3.3.1 增加网络事件,网络未连接,将不会重试下载,修复删除未开始任务,状态回调错误 | ||||
|   + v_3.3.0 增加任务组子任务暂停和开始控制功能、修复5.0系统以上数据库多生成两个字段的bug、去掉addSchedulerListener事件 | ||||
|   + v_3.2.26 修复任务组有时注解不起作用的问题 | ||||
|   + v_3.2.25 修复删除任务组文件,记录无法删除的问题 | ||||
|   + v_3.2.17 修复一个版本兼容性问题,线程中使用Aria出错问题 | ||||
|   + v_3.2.15 修复大型文件分段下载失败的问题,修复中文URL乱码问题 | ||||
|   + v_3.2.14 修复恢复所有任务的api接口,不能恢复下载组任务的问题 | ||||
|   + v_3.2.13 修复某些服务器头文件返回描述文件格式错误的问题、修复有时删除任务,需要两次删除的问题 | ||||
|   + v_3.2.12 实现FTP多线程断点续传下载,FTP断点续传上传功能 | ||||
|   + v_3.2.9 修复任务组下载完成两次回掉的问题,修复又是获取不到下载状态的问题 | ||||
|   + v_3.2.8 修复下载超过2G大小的文件失败的问题 | ||||
|   + v_3.2.7 移除设置文件名的api接口,修复断开网络时出现的进度条错误的问题 | ||||
|   + v_3.2.6 移除广播事件,增加任务组下载功能 | ||||
|   + v_3.1.9 修复stopAll队列没有任务时崩溃的问题,增加针对单个任务监听的功能 | ||||
|   + v_3.1.7 修复某些文件下载不了的bug,增加apt注解方法,事件获取更加简单了 | ||||
|   + v_3.1.6 取消任务时onTaskCancel回调两次的bug | ||||
|   + v_3.1.5 优化代码结构,增加优先下载任务功能。 | ||||
|   + v_3.1.4 修复快速切换,暂停、恢复功能时,概率性出现的重新下载问题,添加onPre()回调,onPre()用于请求地址之前执行界面UI更新操作。 | ||||
|   + v_3.1.0 添加Aria配置文件,优化代码 | ||||
|   + v_3.0.3 修复暂停后删除任务,闪退问题,添加删除记录的api | ||||
|   + v_3.0.2 支持30x重定向链接下载 | ||||
|   + v_3.0.0 添加上传任务支持,修复一些已发现的bug | ||||
|   + v_2.4.4 修复不支持断点的下载链接拿不到文件大小的问题 | ||||
|   + v_2.4.3 修复404链接卡顿的问题 | ||||
|   + v_2.4.2 修复失败重试无效的bug | ||||
|   + v_2.4.1 修复下载慢的问题,修复application、service 不能使用的问题 | ||||
|   + v_2.4.0 支持https链接下载 | ||||
|   + v_2.3.8 修复数据错乱的bug、添加fragment支持 | ||||
|   + v_2.3.6 添加dialog、popupWindow支持 | ||||
|   + v_2.3.3 添加断点支持、修改下载逻辑,让使用更加简单、修复一个内存泄露的bug | ||||
|   + v_2.3.1 重命名为Aria,下载流程简化 | ||||
|   + v_2.1.1 增加,选择最大下载任务数接口 | ||||
| @ -1,164 +1,161 @@ | ||||
| # Aria | ||||
| </br> | ||||
| ## [ENGLISH DOC](https://github.com/AriaLyy/Aria/blob/master/ENGLISH_README.md)</br> | ||||
| ## [中文文档](https://aria.laoyuyu.me/aria_doc) | ||||
| Aria项目源于工作中遇到的一个文件下载管理的需求,当时被下载折磨的痛不欲生,从那时起便萌生了编写一个简单易用,稳当高效的下载框架,aria经历了1.0到3.0的开发,算是越来越接近当初所制定的目标了。 | ||||
| 
 | ||||
| Aria有以下特点: | ||||
|  + 简单、方便 | ||||
|    - 可以在Activity、Service、Fragment、Dialog、popupWindow、Notification等组件中使用 | ||||
|    - 支持HTTP\FTP断点续传、多任务自动调度 | ||||
|    - 支持HTTP任务组\FTP文件夹,断点续传下载 | ||||
|    - 支持HTTP表单上传 | ||||
|    - 支持文件FTP断点续传上传 | ||||
|    - 支持FTPS/SFTP断点续传,[see](https://aria.laoyuyu.me/aria_doc/download/ftps.html) | ||||
|  + 支持https地址下载 | ||||
|    - 在配置文件中很容易就可以设置CA证书的信息 | ||||
|  + 支持[多线程分块下载](https://aria.laoyuyu.me/aria_doc/start/config.html),能更有效的发挥机器IO性能 | ||||
|  + 支持300、301、302重定向下载链接下载 | ||||
|  + 下载支持文件长度动态增加,文件下载初始化时将不再占用过多的内存空间,见[动态长度配置](https://aria.laoyuyu.me/aria_doc/start/config.html#%E4%B8%8B%E8%BD%BD%E5%8A%A8%E6%80%81%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E) | ||||
|   | ||||
| [怎样使用Aria?](#使用) | ||||
| 
 | ||||
| 如果你觉得Aria对你有帮助,您的star和issues将是对我最大支持.`^_^` | ||||
| 
 | ||||
| ## 示例 | ||||
|  | ||||
|  | ||||
|  | ||||
| 
 | ||||
| 
 | ||||
| ## 下载 | ||||
| [](https://bintray.com/arialyy/maven/AriaApi/_latestVersion) | ||||
| [](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion) | ||||
| 
 | ||||
| ```java | ||||
| compile 'com.arialyy.aria:aria-core:3.5.4' | ||||
| annotationProcessor 'com.arialyy.aria:aria-compiler:3.5.4' | ||||
| ``` | ||||
| 如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:aria-core:<last-version>'`替换为 | ||||
| ``` | ||||
| api('com.arialyy.aria:aria-core:<last-version>'){ | ||||
|    exclude group: 'com.android.support' | ||||
| } | ||||
| ``` | ||||
| 如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html) | ||||
| 
 | ||||
| __注意:3.5.4以下版本升级时,需要更新[配置文件]!!(https://aria.laoyuyu.me/aria_doc/start/config.html)__ | ||||
| 
 | ||||
| *** | ||||
| ## 使用 | ||||
| 由于Aria涉及到文件和网络的操作,因此需要你在manifest文件中添加以下权限,如果你希望在6.0以上的系统中使用Aria,那么你需要动态向安卓系统申请文件系统读写权限,[如何使用安卓系统权限](https://developer.android.com/training/permissions/index.html?hl=zh-cn) | ||||
| ```xml | ||||
| <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> | ||||
| <uses-permission android:name="android.permission.INTERNET"/> | ||||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | ||||
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||||
| ``` | ||||
| 
 | ||||
| ## 使用Aria | ||||
| ### 基本使用 | ||||
| 例子为单任务下载,只需要很简单的代码,便可以实现下载功能 | ||||
|   ```java | ||||
|   Aria.download(this) | ||||
|       .load(DOWNLOAD_URL)     //读取下载地址 | ||||
|       .setDownloadPath(DOWNLOAD_PATH) //设置文件保存的完整路径 | ||||
|       .start();   //启动下载 | ||||
|   ``` | ||||
| 
 | ||||
| ### 任务状态的获取 | ||||
| 基于解耦合的考虑,Aria的下载功能是和状态获取相分离的,状态的获取并不会集成到链式代码中,但是Aria提供了另一种更简单更灵活的方案。 | ||||
| 通过注解,你可以很容易获取任务的所有状态。 | ||||
| 
 | ||||
| 1. 将对象注册到Aria | ||||
| ```java | ||||
| protected void onCreate(Bundle savedInstanceState) { | ||||
|     super.onCreate(savedInstanceState); | ||||
|     Aria.download(this).register(); | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| 2. 通过注解获取任务执行状态 | ||||
|  **注意:** | ||||
|  - 注解回掉采用Apt的方式实现,所以,你不需要担心这会影响你机器的性能 | ||||
|  - 被注解的方法**不能被private修饰** | ||||
|  - 被注解的方法**只能有一个参数,并且参数类型必须是`DownloadTask`或`UploadTask`或`DownloadGroupTask`** | ||||
|  - 方法名可以为任意字符串 | ||||
|   | ||||
| ```java | ||||
| //在这里处理任务执行中的状态,如进度进度条的刷新 | ||||
| @Download.onTaskRunning protected void running(DownloadTask task) { | ||||
| 	if(task.getUrl().eques(url)){ | ||||
| 		.... | ||||
| 		可以通过url判断是否是指定任务的回调 | ||||
| 	} | ||||
| 	int p = task.getPercent();	//任务进度百分比 | ||||
|     String speed = task.getConvertSpeed();	//转换单位后的下载速度,单位转换需要在配置文件中打开 | ||||
|    	String speed1 = task.getSpeed(); //原始byte长度速度 | ||||
| } | ||||
| 
 | ||||
| @Download.onTaskComplete void taskComplete(DownloadTask task) { | ||||
| 	//在这里处理任务完成的状态 | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| 
 | ||||
| ### 版本日志 | ||||
|   + v_3.6(2019/2/27) | ||||
|     - 优化数据库写入\修改的速度 | ||||
|     - 精减任务实体的存储 | ||||
|     - 增加下载组合任务的配置 | ||||
|     - useBroadcast\notNetRetry这两个配置,统一在AppConfig中配置 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/361 | ||||
|     - fix bug https://github.com/AriaLyy/Aria/issues/365 | ||||
| 
 | ||||
| [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) | ||||
| 
 | ||||
| ## 混淆配置 | ||||
| ``` | ||||
| -dontwarn com.arialyy.aria.** | ||||
| -keep class com.arialyy.aria.**{*;} | ||||
| -keep class **$$DownloadListenerProxy{ *; } | ||||
| -keep class **$$UploadListenerProxy{ *; } | ||||
| -keep class **$$DownloadGroupListenerProxy{ *; } | ||||
| -keepclasseswithmembernames class * { | ||||
|     @Download.* <methods>; | ||||
|     @Upload.* <methods>; | ||||
|     @DownloadGroup.* <methods>; | ||||
| } | ||||
| 
 | ||||
| ``` | ||||
| 
 | ||||
| ## 其他 | ||||
|  有任何问题,可以在[issues](https://github.com/AriaLyy/Aria/issues)给我留言反馈。</br> | ||||
|  在提交问题前,希望你已经查看过[wiki](https://aria.laoyuyu.me/aria_doc/)或搜索过[issues](https://github.com/AriaLyy/Aria/issues)。</br> | ||||
|  交流群:524329160 | ||||
| 
 | ||||
| *** | ||||
| 
 | ||||
| License | ||||
| ------- | ||||
| 
 | ||||
|     Copyright 2016 AriaLyy(https://github.com/AriaLyy/Aria) | ||||
| 
 | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
| 
 | ||||
|        http://www.apache.org/licenses/LICENSE-2.0 | ||||
| 
 | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| # Aria | ||||
| </br> | ||||
| ## [ENGLISH DOC](https://github.com/AriaLyy/Aria/blob/master/ENGLISH_README.md)</br> | ||||
| ## [中文文档](https://aria.laoyuyu.me/aria_doc) | ||||
| Aria项目源于工作中遇到的一个文件下载管理的需求,当时被下载折磨的痛不欲生,从那时起便萌生了编写一个简单易用,稳当高效的下载框架,aria经历了1.0到3.0的开发,算是越来越接近当初所制定的目标了。 | ||||
| 
 | ||||
| Aria有以下特点: | ||||
|  + 简单、方便 | ||||
|    - 可以在Activity、Service、Fragment、Dialog、popupWindow、Notification等组件中使用 | ||||
|    - 支持HTTP\FTP断点续传、多任务自动调度 | ||||
|    - 支持HTTP任务组\FTP文件夹,断点续传下载 | ||||
|    - 支持HTTP表单上传 | ||||
|    - 支持文件FTP断点续传上传 | ||||
|    - 支持FTPS/SFTP断点续传,[see](https://aria.laoyuyu.me/aria_doc/download/ftps.html) | ||||
|  + 支持https地址下载 | ||||
|    - 在配置文件中很容易就可以设置CA证书的信息 | ||||
|  + 支持[多线程分块下载](https://aria.laoyuyu.me/aria_doc/start/config.html),能更有效的发挥机器IO性能 | ||||
|  + 支持300、301、302重定向下载链接下载 | ||||
|  + 下载支持文件长度动态增加,文件下载初始化时将不再占用过多的内存空间,见[动态长度配置](https://aria.laoyuyu.me/aria_doc/start/config.html#%E4%B8%8B%E8%BD%BD%E5%8A%A8%E6%80%81%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E) | ||||
|   | ||||
| [怎样使用Aria?](#使用) | ||||
| 
 | ||||
| 如果你觉得Aria对你有帮助,您的star和issues将是对我最大支持.`^_^` | ||||
| 
 | ||||
| ## 示例 | ||||
|  | ||||
|  | ||||
|  | ||||
| 
 | ||||
| 
 | ||||
| ## 下载 | ||||
| [](https://bintray.com/arialyy/maven/AriaApi/_latestVersion) | ||||
| [](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion) | ||||
| 
 | ||||
| ```java | ||||
| compile 'com.arialyy.aria:aria-core:3.6.2' | ||||
| annotationProcessor 'com.arialyy.aria:aria-compiler:3.6.2' | ||||
| ``` | ||||
| 如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:aria-core:<last-version>'`替换为 | ||||
| ``` | ||||
| api('com.arialyy.aria:aria-core:<last-version>'){ | ||||
|    exclude group: 'com.android.support' | ||||
| } | ||||
| ``` | ||||
| 如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html) | ||||
| 
 | ||||
| __注意:3.5.4以下版本升级时,需要更新[配置文件]!!(https://aria.laoyuyu.me/aria_doc/start/config.html)__ | ||||
| 
 | ||||
| *** | ||||
| ## 使用 | ||||
| 由于Aria涉及到文件和网络的操作,因此需要你在manifest文件中添加以下权限,如果你希望在6.0以上的系统中使用Aria,那么你需要动态向安卓系统申请文件系统读写权限,[如何使用安卓系统权限](https://developer.android.com/training/permissions/index.html?hl=zh-cn) | ||||
| ```xml | ||||
| <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> | ||||
| <uses-permission android:name="android.permission.INTERNET"/> | ||||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | ||||
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||||
| ``` | ||||
| 
 | ||||
| ## 使用Aria | ||||
| ### 基本使用 | ||||
| 例子为单任务下载,只需要很简单的代码,便可以实现下载功能 | ||||
|   ```java | ||||
|   Aria.download(this) | ||||
|       .load(DOWNLOAD_URL)     //读取下载地址 | ||||
|       .setDownloadPath(DOWNLOAD_PATH) //设置文件保存的完整路径 | ||||
|       .start();   //启动下载 | ||||
|   ``` | ||||
| 
 | ||||
| ### 任务状态的获取 | ||||
| 基于解耦合的考虑,Aria的下载功能是和状态获取相分离的,状态的获取并不会集成到链式代码中,但是Aria提供了另一种更简单更灵活的方案。 | ||||
| 通过注解,你可以很容易获取任务的所有状态。 | ||||
| 
 | ||||
| 1. 将对象注册到Aria | ||||
| ```java | ||||
| protected void onCreate(Bundle savedInstanceState) { | ||||
|     super.onCreate(savedInstanceState); | ||||
|     Aria.download(this).register(); | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| 2. 通过注解获取任务执行状态 | ||||
|  **注意:** | ||||
|  - 注解回掉采用Apt的方式实现,所以,你不需要担心这会影响你机器的性能 | ||||
|  - 被注解的方法**不能被private修饰** | ||||
|  - 被注解的方法**只能有一个参数,并且参数类型必须是`DownloadTask`或`UploadTask`或`DownloadGroupTask`** | ||||
|  - 方法名可以为任意字符串 | ||||
|   | ||||
| ```java | ||||
| //在这里处理任务执行中的状态,如进度进度条的刷新 | ||||
| @Download.onTaskRunning protected void running(DownloadTask task) { | ||||
| 	if(task.getUrl().eques(url)){ | ||||
| 		.... | ||||
| 		可以通过url判断是否是指定任务的回调 | ||||
| 	} | ||||
| 	int p = task.getPercent();	//任务进度百分比 | ||||
|     String speed = task.getConvertSpeed();	//转换单位后的下载速度,单位转换需要在配置文件中打开 | ||||
|    	String speed1 = task.getSpeed(); //原始byte长度速度 | ||||
| } | ||||
| 
 | ||||
| @Download.onTaskComplete void taskComplete(DownloadTask task) { | ||||
| 	//在这里处理任务完成的状态 | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| 
 | ||||
| ### 版本日志 | ||||
|     + v_3.6.2 (2019/4/1) | ||||
|       - fix bug https://github.com/AriaLyy/Aria/issues/368 | ||||
|       - 增加gradle 5.0支持 | ||||
|       - fix bug https://github.com/AriaLyy/Aria/issues/374 | ||||
| 
 | ||||
| [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) | ||||
| 
 | ||||
| ## 混淆配置 | ||||
| ``` | ||||
| -dontwarn com.arialyy.aria.** | ||||
| -keep class com.arialyy.aria.**{*;} | ||||
| -keep class **$$DownloadListenerProxy{ *; } | ||||
| -keep class **$$UploadListenerProxy{ *; } | ||||
| -keep class **$$DownloadGroupListenerProxy{ *; } | ||||
| -keepclasseswithmembernames class * { | ||||
|     @Download.* <methods>; | ||||
|     @Upload.* <methods>; | ||||
|     @DownloadGroup.* <methods>; | ||||
| } | ||||
| 
 | ||||
| ``` | ||||
| 
 | ||||
| ## 其他 | ||||
|  有任何问题,可以在[issues](https://github.com/AriaLyy/Aria/issues)给我留言反馈。</br> | ||||
|  在提交问题前,希望你已经查看过[wiki](https://aria.laoyuyu.me/aria_doc/)或搜索过[issues](https://github.com/AriaLyy/Aria/issues)。</br> | ||||
|  交流群:524329160 | ||||
| 
 | ||||
| *** | ||||
| 
 | ||||
| License | ||||
| ------- | ||||
| 
 | ||||
|     Copyright 2016 AriaLyy(https://github.com/AriaLyy/Aria) | ||||
| 
 | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
| 
 | ||||
|        http://www.apache.org/licenses/LICENSE-2.0 | ||||
| 
 | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -1,58 +1,58 @@ | ||||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||||
| buildscript { | ||||
|   ext.kotlin_version = '1.3.11' | ||||
|   repositories { | ||||
|     jcenter() | ||||
|     mavenCentral() | ||||
|     google() | ||||
|     maven { url 'https://jitpack.io' } | ||||
|   } | ||||
|   dependencies { | ||||
| //    classpath 'com.android.tools.build:gradle:2.3.3' | ||||
|     classpath 'com.android.tools.build:gradle:3.3.2' | ||||
|     classpath 'com.novoda:bintray-release:0.9' | ||||
|     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" | ||||
|     //        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' | ||||
|     //        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' | ||||
|     // NOTE: Do not place your application dependencies here; they belong | ||||
|     // in the individual module build.gradle files | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| allprojects { | ||||
|   repositories { | ||||
|     jcenter() | ||||
|     mavenCentral() | ||||
|     google() | ||||
|     maven { url 'https://jitpack.io' } | ||||
|   } | ||||
| 
 | ||||
|   tasks.withType(Javadoc) { | ||||
|     options { | ||||
|       encoding "UTF-8" | ||||
|       charSet 'UTF-8' | ||||
|       links "http://docs.oracle.com/javase/7/docs/api" | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| task clean(type: Delete) { | ||||
|   delete rootProject.buildDir | ||||
| } | ||||
| 
 | ||||
| ext { | ||||
|   userOrg = 'arialyy' | ||||
|   groupId = 'com.arialyy.aria' | ||||
|   publishVersion = '3.6.2_debug_6' | ||||
| //  publishVersion = '1.0.4'  //FTP插件 | ||||
|   repoName='maven' | ||||
|   desc = 'android 下载框架' | ||||
|   website = 'https://github.com/AriaLyy/Aria' | ||||
|   licences = ['Apache-2.0'] | ||||
| 
 | ||||
|   compileSdkVersion = 28 | ||||
|   supportLibVersion = "28.0.0" | ||||
|   buildToolsVersion = "28.0.3" | ||||
|   targetSdkVersion = 28 | ||||
|   minSdkVersion = 15 | ||||
| } | ||||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||||
| buildscript { | ||||
|   ext.kotlin_version = '1.3.11' | ||||
|   repositories { | ||||
|     jcenter() | ||||
|     mavenCentral() | ||||
|     google() | ||||
|     maven { url 'https://jitpack.io' } | ||||
|   } | ||||
|   dependencies { | ||||
| //    classpath 'com.android.tools.build:gradle:2.3.3' | ||||
|     classpath 'com.android.tools.build:gradle:3.3.2' | ||||
|     classpath 'com.novoda:bintray-release:0.9' | ||||
|     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" | ||||
|     //        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' | ||||
|     //        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' | ||||
|     // NOTE: Do not place your application dependencies here; they belong | ||||
|     // in the individual module build.gradle files | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| allprojects { | ||||
|   repositories { | ||||
|     jcenter() | ||||
|     mavenCentral() | ||||
|     google() | ||||
|     maven { url 'https://jitpack.io' } | ||||
|   } | ||||
| 
 | ||||
|   tasks.withType(Javadoc) { | ||||
|     options { | ||||
|       encoding "UTF-8" | ||||
|       charSet 'UTF-8' | ||||
|       links "http://docs.oracle.com/javase/7/docs/api" | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| task clean(type: Delete) { | ||||
|   delete rootProject.buildDir | ||||
| } | ||||
| 
 | ||||
| ext { | ||||
|   userOrg = 'arialyy' | ||||
|   groupId = 'com.arialyy.aria' | ||||
|   publishVersion = '3.6.2' | ||||
| //  publishVersion = '1.0.4'  //FTP插件 | ||||
|   repoName='maven' | ||||
|   desc = 'android 下载框架' | ||||
|   website = 'https://github.com/AriaLyy/Aria' | ||||
|   licences = ['Apache-2.0'] | ||||
| 
 | ||||
|   compileSdkVersion = 28 | ||||
|   supportLibVersion = "28.0.0" | ||||
|   buildToolsVersion = "28.0.3" | ||||
|   targetSdkVersion = 28 | ||||
|   minSdkVersion = 15 | ||||
| } | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue