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 74374242..71211cd2 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/ConfigHelper.java +++ b/Aria/src/main/java/com/arialyy/aria/core/ConfigHelper.java @@ -163,7 +163,7 @@ class ConfigHelper extends DefaultHandler { private void loadMaxSpeed(String value) { int maxSpeed = checkInt(value) ? Integer.parseInt(value) : 0; if (isDownloadConfig) { - mDownloadConfig.msxSpeed = maxSpeed; + mDownloadConfig.maxSpeed = maxSpeed; } } 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 84bec8f1..46cdb23b 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 @@ -86,7 +86,7 @@ public abstract class AbsThreadTask //设置文件保存路径,如果新文件路径和就文件路径不同,则修改路径 if (!filePath.equals(mEntity.getDownloadPath())) { - if (!mTaskEntity.isRefreshInfo() && DbEntity.checkDataExist(DownloadEntity.class, - "downloadPath=?", filePath)) { + if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=?", filePath)) { ALog.e(TAG, "下载失败,保存路径【" + filePath + "】已经被其它任务占用,请设置其它保存路径"); return false; } diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java index d97be189..9fccd6d5 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java @@ -51,7 +51,7 @@ public class DownloadReceiver extends AbsReceiver { * @param maxSpeed 为0表示不限速 */ @Deprecated public void setMaxSpeed(int maxSpeed) { - AriaManager.getInstance(AriaManager.APP).getDownloadConfig().setMsxSpeed(maxSpeed); + AriaManager.getInstance(AriaManager.APP).getDownloadConfig().setMaxSpeed(maxSpeed); } /** diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java index 2c90fc26..7e96d1d0 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java @@ -202,6 +202,7 @@ abstract class AbsTaskQueue { AnyRunnModule module; String[] urls; int index = 0; + String URL = "http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk"; @Override protected int setLayoutId() { return R.layout.activity_test; @@ -26,22 +30,30 @@ public class AnyRunActivity extends BaseActivity { mBar.setVisibility(View.GONE); module = new AnyRunnModule(this); urls = getResources().getStringArray(R.array.group_urls); + } public void onClick(View view) { switch (view.getId()) { case R.id.start: //module.start(); - if (index < urls.length) { - module.start(urls[index]); - index++; - } + //if (index < urls.length) { + // module.start(urls[index]); + // index++; + //} + //module.start("https://www.baidu.com/link?url=_LFCuTPtnzFxVJByJ504QymRywIA1Z_T5xUxe9ZLuxcGM0C_RcdpWyB1eGjbJC-e5wv5wAKM4WmLMAS5KeF6EZJHB8Va3YqZUiaErqK_pxm&wd=&eqid=e8583fe70002d126000000065a99f864"); + module.start(URL); break; case R.id.stop: - module.stop(); + List list = Aria.download(this).getTotalTaskList(); + + //module.stop(); + module.stop(URL); + break; case R.id.cancel: - module.cancel(); + module.cancel(URL); + //module.cancel(); break; } } diff --git a/app/src/main/java/com/arialyy/simple/test/AnyRunnModule.java b/app/src/main/java/com/arialyy/simple/test/AnyRunnModule.java index cceb8f91..98ba7ce3 100644 --- a/app/src/main/java/com/arialyy/simple/test/AnyRunnModule.java +++ b/app/src/main/java/com/arialyy/simple/test/AnyRunnModule.java @@ -69,17 +69,17 @@ public class AnyRunnModule { .load(url) .addHeader("Accept-Encoding", "gzip, deflate") .setRequestMode(RequestEnum.GET) - .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg1.apk") + .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg123.apk") .resetState() .start(); } - void stop() { - Aria.download(this).load(mUrl).stop(); + void stop(String url) { + Aria.download(this).load(url).stop(); } - void cancel() { - Aria.download(this).load(mUrl).cancel(); + void cancel(String url) { + Aria.download(this).load(url).cancel(); } void unRegister() { 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 7223cd67..d6382c66 100644 --- a/aria/src/main/java/com/arialyy/aria/core/Configuration.java +++ b/aria/src/main/java/com/arialyy/aria/core/Configuration.java @@ -111,7 +111,7 @@ class Configuration { field.setFloat(this, Float.parseFloat(value)); } else if (type == double.class || type == Double.class) { if (TextUtils.isEmpty(value)) { - value = "0.0"; + value = "0"; } field.setDouble(this, Double.parseDouble(value)); } else if (type == long.class || type == Long.class) { @@ -333,7 +333,7 @@ class Configuration { /** * 设置最大下载速度,单位:kb, 为0表示不限速 */ - int msxSpeed = 0; + int maxSpeed = 0; public DownloadConfig setMaxTaskNum(int maxTaskNum) { oldMaxTaskNum = this.maxTaskNum; @@ -347,14 +347,14 @@ class Configuration { return iOTimeOut; } - public int getMsxSpeed() { - return msxSpeed; + public int getMaxSpeed() { + return maxSpeed; } - public DownloadConfig setMsxSpeed(int msxSpeed) { - this.msxSpeed = msxSpeed; - saveKey("msxSpeed", String.valueOf(msxSpeed)); - DownloadTaskQueue.getInstance().setMaxSpeed(msxSpeed); + public DownloadConfig setMaxSpeed(int maxSpeed) { + this.maxSpeed = maxSpeed; + saveKey("maxSpeed", String.valueOf(maxSpeed)); + DownloadTaskQueue.getInstance().setMaxSpeed(maxSpeed); return this; } diff --git a/build.gradle b/build.gradle index 4aab319a..3dcbefee 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.16' + publishVersion = '3.4_dev_1' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架'