From 4a21fc518d5c9e8bc0ce5a0b19935e4b7827c493 Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Fri, 17 Nov 2017 22:10:40 +0800 Subject: [PATCH 1/3] 3.3.7 --- README.md | 11 ++++++++--- .../arialyy/simple/download/SingleTaskActivity.java | 3 ++- .../java/com/arialyy/aria/core/Configuration.java | 9 +++++++-- build.gradle | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cffa3b82..e4d99ede 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ Aria有以下特点: [![Download](https://api.bintray.com/packages/arialyy/maven/AriaApi/images/download.svg)](https://bintray.com/arialyy/maven/AriaApi/_latestVersion) [![Download](https://api.bintray.com/packages/arialyy/maven/AriaCompiler/images/download.svg)](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion) ```java -compile 'com.arialyy.aria:aria-core:3.3.6' -annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.6' +compile 'com.arialyy.aria:aria-core:3.3.7' +annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.7' ``` 如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html) @@ -92,7 +92,12 @@ protected void onCreate(Bundle savedInstanceState) { ### [更多说明,见WIKI](https://github.com/AriaLyy/Aria/wiki) -### [历史版本说明](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) +### 升级日志 ++ v_3.3.7 + - 修复一个线程重启的问题 https://github.com/AriaLyy/Aria/issues/160 + - 修复配置文件异常问题、格式化速度为0问题 https://github.com/AriaLyy/Aria/issues/161 + +[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) ## 混淆配置 ``` diff --git a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java index 7adfdc78..1c12838f 100644 --- a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java @@ -59,7 +59,8 @@ public class SingleTaskActivity extends BaseActivity { //不支持断点的链接 //"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-"; //"http://172.18.104.50:8080/download/_302turn"; - "http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk"; + //"http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk"; + "http://shouji.360tpcdn.com/160824/2c0407dbab4a86c7a84fa7340b9969e7/block.app.wars_30.apk"; //"http://172.21.1.99:8080/download/test+ 中文123.zip"; @Bind(R.id.start) Button mStart; @Bind(R.id.stop) Button mStop; diff --git a/aria/src/main/java/com/arialyy/aria/core/Configuration.java b/aria/src/main/java/com/arialyy/aria/core/Configuration.java index 0b927cf7..8188d415 100644 --- a/aria/src/main/java/com/arialyy/aria/core/Configuration.java +++ b/aria/src/main/java/com/arialyy/aria/core/Configuration.java @@ -157,8 +157,13 @@ class Configuration { try { for (Field field : fields) { int m = field.getModifiers(); - if (field.getName().equals("oldMaxTaskNum") || Modifier.isFinal(m) || Modifier.isStatic( - m)) { + String fileName = field.getName(); + if (fileName.equals("oldMaxTaskNum") + || field.isSynthetic() + || Modifier.isFinal(m) + || Modifier.isStatic(m) + || fileName.equals("shadow$_klass_") + || fileName.equals("shadow$_monitor_")) { continue; } field.setAccessible(true); diff --git a/build.gradle b/build.gradle index dceeba05..dca1776b 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ task clean(type: Delete) { ext { userOrg = 'arialyy' groupId = 'com.arialyy.aria' - publishVersion = '3.3.6' + publishVersion = '3.3.7' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架' From 1d7f59c0a54c74b81acca4bc9eeaca132e67d115 Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@QQ.com> Date: Fri, 17 Nov 2017 16:18:41 +0800 Subject: [PATCH 2/3] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e4d99ede..1b592c21 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,17 @@ protected void onCreate(Bundle savedInstanceState) { ```java //在这里处理任务执行中的状态,如进度进度条的刷新 -@Download.onTaskRunning(DOWNLOAD_URL) protected void running(DownloadTask task) { +@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(DOWNLOAD_URL) void taskComplete(DownloadTask task) { +@Download.onTaskComplete void taskComplete(DownloadTask task) { //在这里处理任务完成的状态 } ``` From 3773e254d8a232a3f81caa26b156383c73f03678 Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Thu, 30 Nov 2017 20:42:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?POST=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../arialyy/aria/core/download/DownloadTarget.java | 13 ++++++++++++- .../download/downloader/HttpFileInfoThread.java | 1 + .../java/com/arialyy/aria/core/inf/AbsTarget.java | 3 ++- .../com/arialyy/aria/core/inf/AbsTaskEntity.java | 6 ++++++ .../main/java/com/arialyy/aria/orm/DBConfig.java | 2 +- DEV_LOG.md | 2 ++ .../arialyy/simple/download/SingleTaskActivity.java | 6 ++++-- 7 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java index b242af47..6c9cdeab 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java @@ -17,7 +17,6 @@ package com.arialyy.aria.core.download; import android.support.annotation.NonNull; import android.text.TextUtils; -import android.util.Log; import com.arialyy.aria.core.inf.AbsDownloadTarget; import com.arialyy.aria.core.manager.TEManager; import com.arialyy.aria.core.queue.DownloadTaskQueue; @@ -63,6 +62,18 @@ public class DownloadTarget mTaskEntity.refreshInfo = refreshInfo; } + /** + * 是否使用服务器通过content-disposition传递的文件名,内容格式{@code attachment;filename=***} + * 如果获取不到服务器文件名,则使用用户设置的文件名 + * 只适用于HTTP请求 + * + * @param use {@code true} 使用 + */ + @Deprecated public DownloadTarget useServerFileName(boolean use) { + mTaskEntity.useServerFileName = use; + return this; + } + /** * 将任务设置为最高优先级任务,最高优先级任务有以下特点: * 1、在下载队列中,有且只有一个最高优先级任务 diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpFileInfoThread.java b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpFileInfoThread.java index 652696d1..64aa80ca 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpFileInfoThread.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpFileInfoThread.java @@ -54,6 +54,7 @@ class HttpFileInfoThread implements Runnable { conn = ConnectionHelp.setConnectParam(mTaskEntity, conn); conn.setRequestProperty("Range", "bytes=" + 0 + "-"); conn.setConnectTimeout(mConnectTimeOut); + conn.setRequestMethod(mTaskEntity.requestEnum.name); conn.connect(); handleConnect(conn); } catch (IOException e) { diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java index aea773c3..cd922c51 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java @@ -154,7 +154,8 @@ public abstract class AbsTarget extends DbEntity { */ public String md5Key = "Content-MD5"; + /** + * 是否使用服务器通过content-disposition传递的文件名,内容格式{@code attachment;filename=***} + * {@code true} 使用 + */ + public boolean useServerFileName = false; + /** * 从header中获取文件描述信息所需要的key */ diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java b/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java index c5f44524..748f063d 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java @@ -35,7 +35,7 @@ class DBConfig { static Map mapping = new HashMap<>(); static String DB_NAME; //static int VERSION = 16; - static int VERSION = 17; + static int VERSION = 18; static { if (TextUtils.isEmpty(DB_NAME)) { diff --git a/DEV_LOG.md b/DEV_LOG.md index 48d2342f..b088dc4f 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,4 +1,6 @@ ## 开发日志 + + v_3.3.8 + - 添加POST支持 + v_3.3.7 - 修复一个线程重启的问题 https://github.com/AriaLyy/Aria/issues/160 - 修复配置文件异常问题、格式化速度为0问题 https://github.com/AriaLyy/Aria/issues/161 diff --git a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java index 1c12838f..3c81ee05 100644 --- a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java @@ -29,6 +29,7 @@ import butterknife.Bind; import com.arialyy.annotations.Download; import com.arialyy.annotations.DownloadGroup; import com.arialyy.aria.core.Aria; +import com.arialyy.aria.core.common.RequestEnum; import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadGroupTask; import com.arialyy.aria.core.download.DownloadTarget; @@ -60,8 +61,8 @@ public class SingleTaskActivity extends BaseActivity { //"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-"; //"http://172.18.104.50:8080/download/_302turn"; //"http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk"; - "http://shouji.360tpcdn.com/160824/2c0407dbab4a86c7a84fa7340b9969e7/block.app.wars_30.apk"; - //"http://172.21.1.99:8080/download/test+ 中文123.zip"; + //"http://shouji.360tpcdn.com/160824/2c0407dbab4a86c7a84fa7340b9969e7/block.app.wars_30.apk"; + "http://172.21.1.72:8080/download/test+ 中文123.zip"; @Bind(R.id.start) Button mStart; @Bind(R.id.stop) Button mStop; @Bind(R.id.cancel) Button mCancel; @@ -228,6 +229,7 @@ public class SingleTaskActivity extends BaseActivity { Aria.download(SingleTaskActivity.this) .load(DOWNLOAD_URL) .addHeader("groupName", "value") + .setRequestMode(RequestEnum.POST) .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/hhhhhhhh.apk") .start(); }