This commit is contained in:
@@ -164,9 +164,15 @@ abstract class BaseNormalTarget<TARGET extends BaseNormalTarget>
|
|||||||
|
|
||||||
//设置文件保存路径,如果新文件路径和旧文件路径不同,则修改路径
|
//设置文件保存路径,如果新文件路径和旧文件路径不同,则修改路径
|
||||||
if (!filePath.equals(mEntity.getDownloadPath())) {
|
if (!filePath.equals(mEntity.getDownloadPath())) {
|
||||||
if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=?", filePath) && !forceDownload) {
|
if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=?", filePath)) {
|
||||||
ALog.e(TAG, "下载失败,保存路径【" + filePath + "】已经被其它任务占用,请设置其它保存路径");
|
if (!forceDownload) {
|
||||||
return false;
|
ALog.e(TAG, "下载失败,保存路径【" + filePath + "】已经被其它任务占用,请设置其它保存路径");
|
||||||
|
return false;
|
||||||
|
}else {
|
||||||
|
ALog.d(TAG, "保存路径【" + filePath + "】已经被其它任务占用,当前任务将覆盖该路径的文件");
|
||||||
|
DbEntity.deleteData(DownloadEntity.class, "downloadPath=?", filePath);
|
||||||
|
mTaskEntity = TEManager.getInstance().getTEntity(DownloadTaskEntity.class, url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File oldFile = new File(mEntity.getDownloadPath());
|
File oldFile = new File(mEntity.getDownloadPath());
|
||||||
File newFile = new File(filePath);
|
File newFile = new File(filePath);
|
||||||
|
|||||||
@@ -11,6 +11,13 @@
|
|||||||
//.setParams(Map<String, String>) // 传递多参数
|
//.setParams(Map<String, String>) // 传递多参数
|
||||||
.start();
|
.start();
|
||||||
```
|
```
|
||||||
|
- 增加强制设置文件路径的api, https://github.com/AriaLyy/Aria/issues/311
|
||||||
|
```
|
||||||
|
Aria.download(SingleTaskActivity.this)
|
||||||
|
.load(DOWNLOAD_URL)
|
||||||
|
.setFilePath(path, true) // true表示忽略路径是否被占用
|
||||||
|
.start();
|
||||||
|
```
|
||||||
+ v_3.5
|
+ v_3.5
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/302
|
- fix bug https://github.com/AriaLyy/Aria/issues/302
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/283
|
- fix bug https://github.com/AriaLyy/Aria/issues/283
|
||||||
|
|||||||
33
README.md
33
README.md
@@ -32,8 +32,8 @@ Aria有以下特点:
|
|||||||
[](https://bintray.com/arialyy/maven/AriaApi/_latestVersion)
|
[](https://bintray.com/arialyy/maven/AriaApi/_latestVersion)
|
||||||
[](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion)
|
[](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion)
|
||||||
```java
|
```java
|
||||||
compile 'com.arialyy.aria:aria-core:3.5'
|
compile 'com.arialyy.aria:aria-core:3.5.1'
|
||||||
annotationProcessor 'com.arialyy.aria:aria-compiler:3.5'
|
annotationProcessor 'com.arialyy.aria:aria-compiler:3.5.1'
|
||||||
```
|
```
|
||||||
如果出现android support,请将 `compile 'com.arialyy.aria:aria-core:<last-version>'`替换为
|
如果出现android support,请将 `compile 'com.arialyy.aria:aria-core:<last-version>'`替换为
|
||||||
```
|
```
|
||||||
@@ -101,16 +101,25 @@ protected void onCreate(Bundle savedInstanceState) {
|
|||||||
|
|
||||||
|
|
||||||
### 版本日志
|
### 版本日志
|
||||||
+ v_3.5
|
+ v_3.5.1
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/302
|
- 优化`taskExists`方法
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/283
|
- 添加`post`参数请求支持
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/305
|
```java
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/306
|
Aria.download(SingleTaskActivity.this)
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/272 (现在,停止所有任务,未开始的任务状态将变为停止)
|
.load(DOWNLOAD_URL)
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/277
|
.setFilePath(path)
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/303
|
.asPost() // post请求
|
||||||
- 优化停止任务的速度
|
.setParam("key", "value") //传递参数
|
||||||
- 修复组合任务修改子任务文件名失败的问题
|
//.setParams(Map<String, String>) // 传递多参数
|
||||||
|
.start();
|
||||||
|
```
|
||||||
|
- 增加强制设置文件路径的api, https://github.com/AriaLyy/Aria/issues/311
|
||||||
|
```
|
||||||
|
Aria.download(SingleTaskActivity.this)
|
||||||
|
.load(DOWNLOAD_URL)
|
||||||
|
.setFilePath(path, true) // true表示忽略路径是否被占用
|
||||||
|
.start();
|
||||||
|
```
|
||||||
|
|
||||||
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
|
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
|||||||
private static final String DOWNLOAD_URL =
|
private static final String DOWNLOAD_URL =
|
||||||
//"http://kotlinlang.org/docs/kotlin-docs.pdf";
|
//"http://kotlinlang.org/docs/kotlin-docs.pdf";
|
||||||
//"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe";
|
//"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe";
|
||||||
//"http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk";
|
"http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk";
|
||||||
//"https://yizi-kejian.oss-cn-beijing.aliyuncs.com/qimeng/package1/qmtable11.zip";
|
//"https://yizi-kejian.oss-cn-beijing.aliyuncs.com/qimeng/package1/qmtable11.zip";
|
||||||
//"http://rs.0.gaoshouyou.com/d/04/1e/400423a7551e1f3f0eb1812afa1f9b44.apk";
|
//"http://rs.0.gaoshouyou.com/d/04/1e/400423a7551e1f3f0eb1812afa1f9b44.apk";
|
||||||
//"http://58.210.9.131/tpk/sipgt//TDLYZTGH.tpk"; //chunked 下载
|
//"http://58.210.9.131/tpk/sipgt//TDLYZTGH.tpk"; //chunked 下载
|
||||||
@@ -58,7 +58,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
|||||||
//"https://d.pcs.baidu.com/file/a02c89a2d479d4fd2756f3313d42491d?fid=4232431903-250528-1114369760340736&dstime=1525491372&rt=sh&sign=FDtAERVY-DCb740ccc5511e5e8fedcff06b081203-3C13vkOkuk4TqXvVYW05zj1K0ao%3D&expires=8h&chkv=1&chkbd=0&chkpc=et&dp-logid=8651730921842106225&dp-callid=0&r=165533013";
|
//"https://d.pcs.baidu.com/file/a02c89a2d479d4fd2756f3313d42491d?fid=4232431903-250528-1114369760340736&dstime=1525491372&rt=sh&sign=FDtAERVY-DCb740ccc5511e5e8fedcff06b081203-3C13vkOkuk4TqXvVYW05zj1K0ao%3D&expires=8h&chkv=1&chkbd=0&chkpc=et&dp-logid=8651730921842106225&dp-callid=0&r=165533013";
|
||||||
//"http://apk500.bce.baidu-mgame.com/game/67000/67734/20170622040827_oem_5502845.apk?r=1";
|
//"http://apk500.bce.baidu-mgame.com/game/67000/67734/20170622040827_oem_5502845.apk?r=1";
|
||||||
//"https://dl.genymotion.com/releases/genymotion-2.12.1/genymotion-2.12.1-vbox.exe";
|
//"https://dl.genymotion.com/releases/genymotion-2.12.1/genymotion-2.12.1-vbox.exe";
|
||||||
"http://9.9.9.59:5000/download/CentOS-7-x86_64-Minimal-1804.iso";
|
//"http://9.9.9.59:5000/download/CentOS-7-x86_64-Minimal-1804.iso";
|
||||||
@Bind(R.id.start) Button mStart;
|
@Bind(R.id.start) Button mStart;
|
||||||
@Bind(R.id.stop) Button mStop;
|
@Bind(R.id.stop) Button mStop;
|
||||||
@Bind(R.id.cancel) Button mCancel;
|
@Bind(R.id.cancel) Button mCancel;
|
||||||
@@ -262,8 +262,8 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
|||||||
//.addHeader("Cookie", "BAIDUID=648E5FF020CC69E8DD6F492D1068AAA9:FG=1; BIDUPSID=648E5FF020CC69E8DD6F492D1068AAA9; PSTM=1519099573; BD_UPN=12314753; locale=zh; BDSVRTM=0")
|
//.addHeader("Cookie", "BAIDUID=648E5FF020CC69E8DD6F492D1068AAA9:FG=1; BIDUPSID=648E5FF020CC69E8DD6F492D1068AAA9; PSTM=1519099573; BD_UPN=12314753; locale=zh; BDSVRTM=0")
|
||||||
//.useServerFileName(true)
|
//.useServerFileName(true)
|
||||||
//.setRequestMode(RequestEnum.GET)
|
//.setRequestMode(RequestEnum.GET)
|
||||||
.setFilePath(path)
|
.setFilePath(path, false)
|
||||||
.asPost().setParams("key", "value")
|
//.asPost().setParam("key", "value")
|
||||||
//.setExtendField("{\n"
|
//.setExtendField("{\n"
|
||||||
// + "\"id\":\"你的样子\"\n< > "
|
// + "\"id\":\"你的样子\"\n< > "
|
||||||
// + "}")
|
// + "}")
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ task clean(type: Delete) {
|
|||||||
ext {
|
ext {
|
||||||
userOrg = 'arialyy'
|
userOrg = 'arialyy'
|
||||||
groupId = 'com.arialyy.aria'
|
groupId = 'com.arialyy.aria'
|
||||||
publishVersion = '3.5'
|
publishVersion = '3.5.1'
|
||||||
// publishVersion = '1.0.3' //FTP插件
|
// publishVersion = '1.0.3' //FTP插件
|
||||||
repoName='maven'
|
repoName='maven'
|
||||||
desc = 'android 下载框架'
|
desc = 'android 下载框架'
|
||||||
|
|||||||
Reference in New Issue
Block a user