修复单线程下载时,文件已经完成,重复下载回调下载失败的问题

修复一个重新下载文件时,同名路径文件没有被被删除的问题
This commit is contained in:
laoyuyu
2020-11-12 22:35:14 +08:00
parent 840facd1cc
commit d7d081ffb1
9 changed files with 31 additions and 17 deletions

View File

@@ -44,7 +44,7 @@
3、从3.4.1开始如果线程数为1文件初始化时将不再预占用对应长度的空间下载多少byte则占多大的空间
对于采用多线程的任务或旧任务,依然采用原来的文件空间占用方式;
-->
<threadNum value="3"/>
<threadNum value="1"/>
<!--设置下载队列最大任务数, 默认为2-->
<maxTaskNum value="1"/>

View File

@@ -51,10 +51,11 @@ public class HttpDownloadModule extends BaseViewModule {
//String url = AppUtil.getConfigValue(context, HTTP_URL_KEY, defUrl);
//String url = "http://fdfs.speedata.cn:9989/group1/M00/00/05/rBGFrl3fdAKAVJwfMtSa9R18wLU139.zip";
//String url = "http://9.9.9.28:8088/files/update.zip";
//String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip";
String url = "https://gitee.com/huang-junhua/iptv/raw/master/guonei.m3u8";
String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip";
//String url = "https://gitee.com/huang-junhua/iptv/raw/master/guonei.m3u8";
//String url = "http://v.kjjl100.com/kz/zx/cj/2020cjswxdb/1.mp4";
//String url = "https://static.runoob.com/images/demo/demo2.jpg";
String filePath = "/mnt/sdcard/xxx.m3u8";
String filePath = "/mnt/sdcard/qq.zip";
singDownloadInfo = Aria.download(context).getFirstDownloadEntity(url);
if (singDownloadInfo == null) {

View File

@@ -266,7 +266,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
if (task.getKey().equals(mUrl)) {
Toast.makeText(SingleTaskActivity.this, getString(R.string.download_success),
Toast.LENGTH_SHORT).show();
//ALog.d(TAG, "文件md5: 9886e90f014d462b560dcec9c327bdb7");
ALog.d(TAG, "文件md5: e088677570afe2e9f847cc8159b932dd");
ALog.d(TAG, "下载完成的文件md5: " + CommonUtil.getFileMD5(new File(task.getFilePath())));
getBinding().pl.setInfo(task.getEntity());
getBinding().pl.setProgress(100);