fix bug
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
|
||||
mEntity = mTaskEntity.getEntity();
|
||||
mConfigFPath = info.CONFIG_FILE_PATH;
|
||||
mBufSize = manager.getDownloadConfig().getBuffSize();
|
||||
setMaxSpeed(AriaManager.getInstance(AriaManager.APP).getDownloadConfig().getMsxSpeed());
|
||||
setMaxSpeed(AriaManager.getInstance(AriaManager.APP).getDownloadConfig().getMaxSpeed());
|
||||
mTaskType = getTaskType();
|
||||
mLastSaveTime = System.currentTimeMillis();
|
||||
mConfigThreadPool = Executors.newCachedThreadPool();
|
||||
|
||||
@@ -141,8 +141,7 @@ abstract class BaseNormalTarget<TARGET extends BaseNormalTarget>
|
||||
|
||||
//设置文件保存路径,如果新文件路径和就文件路径不同,则修改路径
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -202,6 +202,7 @@ abstract class AbsTaskQueue<TASK extends AbsTask, TASK_ENTITY extends AbsTaskEnt
|
||||
if (!task.isRunning()) {
|
||||
task.start();
|
||||
} else {
|
||||
task.stop();
|
||||
ALog.e(TAG, "任务【" + task.getTaskName() + "】重试失败,原因:任务没有完全停止,");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,9 @@ public interface Regular {
|
||||
* 匹配双字节字符、空格、制表符、换行符
|
||||
*/
|
||||
String REG_DOUBLE_CHAR_AND_SPACE = "[^\\x00-\\xff]|[\\s\\p{Zs}]";
|
||||
|
||||
/**
|
||||
* 匹配window.location.replace
|
||||
*/
|
||||
String REG_WINLOD_REPLACE = "\\.*replace(\\.*)\\.*";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
## 开发日志
|
||||
+ v_3.4
|
||||
- 优化大量代码
|
||||
- 重构Aria的ORM模型
|
||||
- 可在任意类中使用Aria了,[使用方法](http://aria.laoyuyu.me/aria_doc/start/any_java.html)
|
||||
- window.location.replace("http://xxxx")类型的重定向支持
|
||||
+ v_3.3.16
|
||||
- 修复一个activity启动多次,无法进行回掉的bug https://github.com/AriaLyy/Aria/issues/200
|
||||
- 优化target代码结构,移除路径被占用的提示
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.arialyy.simple.test;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.inf.AbsEntity;
|
||||
import com.arialyy.simple.R;
|
||||
import com.arialyy.simple.base.BaseActivity;
|
||||
import com.arialyy.simple.databinding.ActivityTestBinding;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by laoyuyu on 2018/4/13.
|
||||
@@ -15,6 +18,7 @@ public class AnyRunActivity extends BaseActivity<ActivityTestBinding> {
|
||||
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<ActivityTestBinding> {
|
||||
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<AbsEntity> list = Aria.download(this).getTotalTaskList();
|
||||
|
||||
//module.stop();
|
||||
module.stop(URL);
|
||||
|
||||
break;
|
||||
case R.id.cancel:
|
||||
module.cancel();
|
||||
module.cancel(URL);
|
||||
//module.cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 下载框架'
|
||||
|
||||
Reference in New Issue
Block a user