From 755e333d8bc6a47896b44b3b2ba04bbf47fb8941 Mon Sep 17 00:00:00 2001
From: AriaLyy <511455842@qq.com>
Date: Wed, 17 Jan 2018 21:15:53 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=9B=E5=BA=A6?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=97=B4=E9=9A=94api=EF=BC=8C=E5=9C=A8`aria?=
=?UTF-8?q?=5Fconfig.xml`=E9=85=8D=E7=BD=AE``=E6=88=96=E5=9C=A8=E4=BB=A3=E7=A0=81=E4=B8=AD=E8=B0=83?=
=?UTF-8?q?=E7=94=A8`AriaManager.getInstance(AriaManager.APP).getDownloadC?=
=?UTF-8?q?onfig().setUpdateInterval(3000)`=E4=BE=BF=E5=8F=AF=E4=BB=A5?=
=?UTF-8?q?=E6=94=B9=E5=8F=98=E8=BF=9B=E5=BA=A6=E5=88=B7=E6=96=B0=E9=97=B4?=
=?UTF-8?q?=E9=9A=94.=20https://github.com/AriaLyy/Aria/issues/190?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/arialyy/aria/core/ConfigHelper.java | 19 ++++++++++++
.../arialyy/aria/core/common/AbsFileer.java | 31 ++++++++++++++-----
.../aria/core/download/BaseDListener.java | 5 +++
.../download/downloader/AbsGroupUtil.java | 5 ++-
.../core/download/downloader/Downloader.java | 3 ++
.../arialyy/aria/core/inf/AbsTaskEntity.java | 9 +++---
.../aria/core/upload/BaseUListener.java | 5 +++
.../aria/core/upload/uploader/Uploader.java | 3 ++
DEV_LOG.md | 3 ++
app/src/main/assets/aria_config.xml | 6 ++++
.../simple/download/SingleTaskActivity.java | 1 +
.../com/arialyy/aria/core/Configuration.java | 27 +++++++++++++++-
12 files changed, 103 insertions(+), 14 deletions(-)
diff --git a/Aria/src/main/java/com/arialyy/aria/core/ConfigHelper.java b/Aria/src/main/java/com/arialyy/aria/core/ConfigHelper.java
index 586ceb4e..1eb12427 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/ConfigHelper.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/ConfigHelper.java
@@ -86,8 +86,27 @@ class ConfigHelper extends DefaultHandler {
case "queueMod":
loadQueueMod(value);
break;
+ case "updateInterval":
+ loadUpdateInterval(value);
+ break;
+ }
+ }
+ }
+
+ private void loadUpdateInterval(String value) {
+ long temp = 1000;
+ if (!TextUtils.isEmpty(value)) {
+ temp = Long.parseLong(value);
+ if (temp <= 0) {
+ temp = 1000;
}
}
+ if (isDownloadConfig) {
+ mDownloadConfig.updateInterval = temp;
+ }
+ if (isUploadConfig) {
+ mUploadConfig.updateInterval = temp;
+ }
}
private void loadQueueMod(String value) {
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 78c0fe71..01d2fb9f 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
@@ -63,6 +63,7 @@ public abstract class AbsFileer 0) {
@@ -390,7 +405,7 @@ public abstract class AbsFileer config = new SubThreadConfig<>();
diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java b/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java
index 7c68b96d..ce686b2d 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java
@@ -41,6 +41,7 @@ class BaseDListener(outHandler);
@@ -51,6 +52,7 @@ class BaseDListener {
Downloader(IDownloadListener listener, DownloadTaskEntity taskEntity) {
super(listener, taskEntity);
+ setUpdateInterval(
+ AriaManager.getInstance(AriaManager.APP).getDownloadConfig().getUpdateInterval());
}
@Override protected void checkTask() {
diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTaskEntity.java b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTaskEntity.java
index be5e1bc8..b63fad34 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTaskEntity.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTaskEntity.java
@@ -36,10 +36,6 @@ public abstract class AbsTaskEntity extends DbEntity {
* HTTP任务组下载
*/
public static final int DG_HTTP = 0x12;
- /**
- * HTTP单文件上传
- */
- public static final int U_HTTP = 0xA1;
/**
* FTP单文件下载
@@ -49,6 +45,11 @@ public abstract class AbsTaskEntity extends DbEntity {
* FTP文件夹下载,为避免登录过多,子任务由单线程进行处理
*/
public static final int D_FTP_DIR = 0x14;
+
+ /**
+ * HTTP单文件上传
+ */
+ public static final int U_HTTP = 0xA1;
/**
* FTP单文件上传
*/
diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/BaseUListener.java b/Aria/src/main/java/com/arialyy/aria/core/upload/BaseUListener.java
index a0591d78..48aa5b73 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/upload/BaseUListener.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/upload/BaseUListener.java
@@ -41,6 +41,7 @@ class BaseUListener(outHandler);
@@ -51,6 +52,7 @@ class BaseUListener {
Uploader(IUploadListener listener, UploadTaskEntity taskEntity) {
super(listener, taskEntity);
mTempFile = new File(mEntity.getFilePath());
+ setUpdateInterval(
+ AriaManager.getInstance(AriaManager.APP).getUploadConfig().getUpdateInterval());
}
/**
diff --git a/DEV_LOG.md b/DEV_LOG.md
index 69d361d2..c429a9e6 100644
--- a/DEV_LOG.md
+++ b/DEV_LOG.md
@@ -1,4 +1,7 @@
## 开发日志
+ + v_3.3.11
+ - 添加进度更新间隔api,在`aria_config.xml`配置``或在代码中调用
+ `AriaManager.getInstance(AriaManager.APP).getDownloadConfig().setUpdateInterval(3000)`便可以改变进度刷新间隔
+ 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/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml
index 92324c01..ce92a575 100644
--- a/app/src/main/assets/aria_config.xml
+++ b/app/src/main/assets/aria_config.xml
@@ -34,6 +34,9 @@
+
+
+
@@ -54,6 +57,9 @@
+
+
+
\ No newline at end of file
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 afa60d39..4ae8dae5 100644
--- a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
@@ -157,6 +157,7 @@ public class SingleTaskActivity extends BaseActivity {
mStart.setText("开始");
setBtState(true);
getBinding().setSpeed("");
+ Log.d(TAG, "cancel");
}
@Download.onTaskFail void taskFail(DownloadTask task) {
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 6ae2b732..1b4b060e 100644
--- a/aria/src/main/java/com/arialyy/aria/core/Configuration.java
+++ b/aria/src/main/java/com/arialyy/aria/core/Configuration.java
@@ -19,6 +19,7 @@ import android.text.TextUtils;
import com.arialyy.aria.core.common.QueueMod;
import com.arialyy.aria.core.queue.DownloadTaskQueue;
import com.arialyy.aria.core.queue.UploadTaskQueue;
+import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
import java.io.File;
import java.lang.reflect.Field;
@@ -39,6 +40,11 @@ class Configuration {
* 通用配置
*/
public static class BaseConfig {
+ /**
+ * 进度刷新间隔,默认1秒
+ */
+ long updateInterval = 1000;
+
/**
* 旧任务数
*/
@@ -73,6 +79,25 @@ class Configuration {
*/
String queueMod = "wait";
+ public long getUpdateInterval() {
+ return updateInterval;
+ }
+
+ /**
+ * 设置进度更新间隔,该设置对正在运行的任务无效,默认为1000毫秒
+ *
+ * @param updateInterval 不能小于0
+ */
+ public BaseConfig setUpdateInterval(long updateInterval) {
+ if (updateInterval <= 0) {
+ ALog.w("Configuration", "进度更新间隔不能小于0");
+ return this;
+ }
+ this.updateInterval = updateInterval;
+ saveKey("updateInterval", String.valueOf(updateInterval));
+ return this;
+ }
+
public String getQueueMod() {
return queueMod;
}
@@ -272,7 +297,7 @@ class Configuration {
return this;
}
- public void setThreadNum(int threadNum){
+ public void setThreadNum(int threadNum) {
this.threadNum = threadNum;
saveKey("threadNum", String.valueOf(threadNum));
}
From 754e23a2f29320adaed29bcce7b9051d5f1987e0 Mon Sep 17 00:00:00 2001
From: e <511455842@qq.com>
Date: Mon, 29 Jan 2018 21:19:06 +0800
Subject: [PATCH 2/5] fix bug https://github.com/AriaLyy/Aria/issues/192
---
.../arialyy/aria/core/common/AbsFileer.java | 39 +++++++------------
.../aria/core/common/StateConstance.java | 2 +-
2 files changed, 14 insertions(+), 27 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 01d2fb9f..54690796 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
@@ -63,7 +63,6 @@ public abstract class AbsFileer= 0) {
Long r = Long.parseLong(record + "");
- if (r > startL) {
+ //记录的位置需要在线程区间中
+ if (startL < r && r < (i == (mTotalThreadNum - 1) ? fileLength : endL)) {
mConstance.CURRENT_LOCATION += r - startL;
startL = r;
}
- ALog.d(TAG, "任务【" + mEntity.getFileName() + "】线程__" + i + "__恢复");
+ ALog.d(TAG, "任务【" + mEntity.getFileName() + "】线程__" + i + "__恢复下载");
recordL[rl] = i;
rl++;
} else {
@@ -380,7 +367,7 @@ public abstract class AbsFileer 0) {
@@ -405,7 +392,7 @@ public abstract class AbsFileer config = new SubThreadConfig<>();
diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java b/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java
index 386c55f0..e42e3f86 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java
@@ -63,7 +63,7 @@ public class StateConstance {
* 所有子线程是否都已经完成下载
*/
public boolean isComplete() {
- return COMPLETE_THREAD_NUM == THREAD_NUM;
+ return COMPLETE_THREAD_NUM >= THREAD_NUM;
}
/**
From 75421b92c4016b451c5ebb80025dd7aac4b601d1 Mon Sep 17 00:00:00 2001
From: e <511455842@qq.com>
Date: Tue, 30 Jan 2018 20:51:22 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dorm`'`=E5=86=B2=E7=AA=81?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20https://github.com/AriaLyy/Aria/i?=
=?UTF-8?q?ssues/194?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/arialyy/aria/core/common/AbsFileer.java | 17 ++++++++++++++++-
.../java/com/arialyy/aria/orm/SqlHelper.java | 16 ++++++++--------
.../simple/download/SingleTaskActivity.java | 3 ++-
3 files changed, 26 insertions(+), 10 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 54690796..78220724 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
@@ -63,6 +63,7 @@ public abstract class AbsFileer= wheres.length - 1 ? "" : " AND ");
i++;
}
@@ -315,7 +315,7 @@ final class SqlHelper extends SQLiteOpenHelper {
sql = sql.replace("?", "%s");
Object[] params = new String[expression.length - 1];
for (int i = 0, len = params.length; i < len; i++) {
- params[i] = "'" + expression[i + 1] + "'";
+ params[i] = "\"" + expression[i + 1] + "\"";
}
sql = String.format(sql, params);
SqlHelper.print(DEL_DATA, sql);
@@ -350,7 +350,7 @@ final class SqlHelper extends SQLiteOpenHelper {
//sb.append(field.getName()).append("='");
String value;
prams.append(i > 0 ? ", " : "");
- prams.append(field.getName()).append("='");
+ prams.append(field.getName()).append("=\"");
Type type = field.getType();
if (type == Map.class) {
value = SqlUtil.map2Str((Map) field.get(dbEntity));
@@ -370,7 +370,7 @@ final class SqlHelper extends SQLiteOpenHelper {
//sb.append(value == null ? "" : value);
//sb.append("'");
prams.append(TextUtils.isEmpty(value) ? "" : value);
- prams.append("'");
+ prams.append("\"");
} catch (IllegalAccessException e) {
e.printStackTrace();
}
@@ -415,7 +415,7 @@ final class SqlHelper extends SQLiteOpenHelper {
continue;
}
sb.append(i > 0 ? ", " : "");
- sb.append("'");
+ sb.append("\"");
Type type = field.getType();
if (type == Map.class) {
sb.append(SqlUtil.map2Str((Map) field.get(dbEntity)));
@@ -430,7 +430,7 @@ final class SqlHelper extends SQLiteOpenHelper {
} else {
sb.append(field.get(dbEntity));
}
- sb.append("'");
+ sb.append("\"");
i++;
}
} catch (IllegalAccessException e) {
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 4ae8dae5..d6b07b78 100644
--- a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
@@ -62,7 +62,8 @@ public class SingleTaskActivity extends BaseActivity {
//不支持断点的链接
//"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-";
//"http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk";
- "http://qudao.5535.cn/one/game.html?game=531&cpsuser=xiaoeryu2";
+ //"http://qudao.5535.cn/one/game.html?game=531&cpsuser=xiaoeryu2";
+ "https://bogoe-res.mytbz.com/tbzengsong/If You're Happy.mp3";
@Bind(R.id.start) Button mStart;
@Bind(R.id.stop) Button mStop;
@Bind(R.id.cancel) Button mCancel;
From 9ae1d8b5305138263f42ed2f61efc911435c24ae Mon Sep 17 00:00:00 2001
From: e <511455842@qq.com>
Date: Tue, 30 Jan 2018 22:05:25 +0800
Subject: [PATCH 4/5] fix bug
https://github.com/AriaLyy/Aria/issues/191#issuecomment-361515367
---
.../core/upload/uploader/HttpThreadTask.java | 2 +-
.../upload/uploader/SimpleUploadUtil.java | 32 ++++++++++++-------
.../simple/upload/HttpUploadActivity.java | 4 +--
3 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java
index 2ac37421..3e108dcd 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java
@@ -90,7 +90,7 @@ class HttpThreadTask extends AbsThreadTask {
}
uploadFile(writer, mTaskEntity.attachment, uploadFile);
finish(writer);
- } catch (IOException e) {
+ } catch (Exception e) {
e.printStackTrace();
fail();
}
diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/SimpleUploadUtil.java b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/SimpleUploadUtil.java
index 753be0b9..94c9d486 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/SimpleUploadUtil.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/SimpleUploadUtil.java
@@ -17,6 +17,7 @@ package com.arialyy.aria.core.upload.uploader;
import com.arialyy.aria.core.common.IUtil;
import com.arialyy.aria.core.common.OnFileInfoCallback;
+import com.arialyy.aria.core.inf.AbsTaskEntity;
import com.arialyy.aria.core.inf.IUploadListener;
import com.arialyy.aria.core.upload.UploadEntity;
import com.arialyy.aria.core.upload.UploadTaskEntity;
@@ -47,19 +48,26 @@ public class SimpleUploadUtil implements IUtil, Runnable {
@Override public void run() {
mListener.onPre();
- new FtpFileInfoThread(mTaskEntity, new OnFileInfoCallback() {
- @Override public void onComplete(String url, int code) {
- if (code == FtpFileInfoThread.CODE_COMPLETE) {
- mListener.onComplete();
- } else {
- mUploader.start();
- }
- }
+ switch (mTaskEntity.requestType) {
+ case AbsTaskEntity.U_FTP:
+ new FtpFileInfoThread(mTaskEntity, new OnFileInfoCallback() {
+ @Override public void onComplete(String url, int code) {
+ if (code == FtpFileInfoThread.CODE_COMPLETE) {
+ mListener.onComplete();
+ } else {
+ mUploader.start();
+ }
+ }
- @Override public void onFail(String url, String errorMsg, boolean needRetry) {
- mListener.onFail(needRetry);
- }
- }).start();
+ @Override public void onFail(String url, String errorMsg, boolean needRetry) {
+ mListener.onFail(needRetry);
+ }
+ }).start();
+ break;
+ case AbsTaskEntity.U_HTTP:
+ mUploader.start();
+ break;
+ }
}
@Override public long getFileSize() {
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 6485ed54..5d19e08c 100644
--- a/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java
+++ b/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java
@@ -35,7 +35,7 @@ public class HttpUploadActivity extends BaseActivity {
private static final String TAG = "HttpUploadActivity";
@Bind(R.id.pb) HorizontalProgressBarWithNumber mPb;
- private static final String FILE_PATH = "/sdcard/large.rar";
+ private static final String FILE_PATH = "/mnt/sdcard/gg.zip";
@Override protected int setLayoutId() {
return R.layout.activity_upload;
@@ -50,7 +50,7 @@ public class HttpUploadActivity extends BaseActivity {
@OnClick(R.id.upload) void upload() {
Aria.upload(HttpUploadActivity.this)
.load(FILE_PATH)
- .setUploadUrl("http://172.18.104.66:8080/upload/sign_file")
+ .setUploadUrl("http://127.0.0.1:8080/upload/")
.setAttachment("file")
.start();
}
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 5/5] 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 下载框架'