From b191bb24706182e343c7bbaa3969f66ce2ed77cd Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Tue, 30 Jan 2018 23:01:42 +0800 Subject: [PATCH] 3.3.11 --- .../arialyy/aria/core/common/AbsFileer.java | 24 ++++++++++++------- .../aria/core/common/AbsThreadTask.java | 4 ++-- DEV_LOG.md | 3 +++ README.md | 13 ++++++---- .../multi_download/MultiDownloadActivity.java | 3 +++ .../multi_download/MultiTaskActivity.java | 7 ++++++ .../simple/upload/HttpUploadActivity.java | 4 ++-- build.gradle | 2 +- 8 files changed, 41 insertions(+), 19 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java index 78220724..c7fb1145 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java @@ -40,6 +40,9 @@ import java.util.concurrent.Executors; */ public abstract class AbsFileer> implements Runnable, IUtil { + public static final String STATE = "_state_"; + public static final String RECORD = "_record_"; + private final String TAG = "AbsFileer"; protected IEventListener mListener; protected TASK_ENTITY mTaskEntity; @@ -265,10 +268,13 @@ public abstract class AbsFileer= 0) { Long r = Long.parseLong(record + ""); diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java index c490372e..fd6952d8 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java @@ -263,10 +263,10 @@ public abstract class AbsThreadTask= mConfig.END_LOCATION || isComplete) { - key = mConfig.TEMP_FILE.getName() + "_state_" + mConfig.THREAD_ID; + key = mConfig.TEMP_FILE.getName() + AbsFileer.STATE + mConfig.THREAD_ID; value = "1"; } else if (0 < record && record < mConfig.END_LOCATION) { - key = mConfig.TEMP_FILE.getName() + "_record_" + mConfig.THREAD_ID; + key = mConfig.TEMP_FILE.getName() + AbsFileer.RECORD + mConfig.THREAD_ID; value = String.valueOf(record); } if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) { diff --git a/DEV_LOG.md b/DEV_LOG.md index c429a9e6..3b31349b 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -2,6 +2,9 @@ + v_3.3.11 - 添加进度更新间隔api,在`aria_config.xml`配置``或在代码中调用 `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 diff --git a/README.md b/README.md index 43816bf4..f3d1aa47 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.10' -annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.10' +compile 'com.arialyy.aria:aria-core:3.3.11' +annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.11' ``` 如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html) @@ -97,9 +97,12 @@ protected void onCreate(Bundle savedInstanceState) { ### [更多说明,见WIKI](https://github.com/AriaLyy/Aria/wiki) ### 升级日志 -+ 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.11 + - 添加进度更新间隔api,在`aria_config.xml`配置``或在代码中调用 + `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 [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) diff --git a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiDownloadActivity.java b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiDownloadActivity.java index 0793d9a3..428d3f90 100644 --- a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiDownloadActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiDownloadActivity.java @@ -19,6 +19,7 @@ package com.arialyy.simple.download.multi_download; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; +import android.util.Log; import android.view.Menu; import android.view.MenuItem; import butterknife.Bind; @@ -29,10 +30,12 @@ import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadGroupTask; import com.arialyy.aria.core.download.DownloadTask; import com.arialyy.aria.core.inf.AbsEntity; +import com.arialyy.frame.util.FileUtil; import com.arialyy.frame.util.show.L; import com.arialyy.simple.R; import com.arialyy.simple.base.BaseActivity; import com.arialyy.simple.databinding.ActivityMultiDownloadBinding; +import java.io.File; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiTaskActivity.java b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiTaskActivity.java index fe422b61..00037fcd 100644 --- a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiTaskActivity.java @@ -21,6 +21,7 @@ import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; +import android.util.Log; import android.view.View; import butterknife.Bind; import com.arialyy.annotations.Download; @@ -28,10 +29,12 @@ import com.arialyy.annotations.DownloadGroup; import com.arialyy.aria.core.Aria; import com.arialyy.aria.core.download.DownloadGroupTask; import com.arialyy.aria.core.download.DownloadTask; +import com.arialyy.frame.util.FileUtil; import com.arialyy.simple.R; import com.arialyy.simple.base.BaseActivity; import com.arialyy.simple.databinding.ActivityMultiBinding; import com.arialyy.simple.download.DownloadModule; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -95,6 +98,10 @@ public class MultiTaskActivity extends BaseActivity { mAdapter.updateBtState(task.getKey(), true); } + @Download.onTaskComplete void taskComplete(DownloadTask task){ + Log.d(TAG, FileUtil.getFileMD5(new File(task.getDownloadPath()))); + } + //############################### 任务组 ############################## @DownloadGroup.onTaskComplete void groupTaskComplete(DownloadGroupTask task) { mAdapter.updateBtState(task.getKey(), true); diff --git a/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java b/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java index 5d19e08c..91963876 100644 --- a/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java +++ b/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java @@ -50,8 +50,8 @@ public class HttpUploadActivity extends BaseActivity { @OnClick(R.id.upload) void upload() { Aria.upload(HttpUploadActivity.this) .load(FILE_PATH) - .setUploadUrl("http://127.0.0.1:8080/upload/") - .setAttachment("file") + .setUploadUrl("http://192.168.1.9:8080/upload/") + .setAttachment("serveFile") .start(); } diff --git a/build.gradle b/build.gradle index f7cca8f1..0f373625 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.10' + publishVersion = '3.3.11' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架'