修复resumeall 导致的进度错乱问题,修复ftp文件上传不完整问题 https://github.com/AriaLyy/Aria/issues/127

This commit is contained in:
AriaLyy
2017-09-29 11:13:23 +08:00
parent afb47c8446
commit 2d64c50ed0
33 changed files with 175 additions and 174 deletions

View File

@@ -46,14 +46,14 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
private static final String DOWNLOAD_URL =
//"http://kotlinlang.org/docs/kotlin-docs.pdf";
//"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";
//"http://sitcac.daxincf.cn/wp-content/uploads/swift_vido/01/element.mp4_1";
//"http://120.25.196.56:8000/filereq?id=15692406294&ipncid=105635&client=android&filename=20170819185541.avi";
//"http://down2.xiaoshuofuwuqi.com/d/file/filetxt/20170608/14/%BA%DA%CE%D7%CA%A6%E1%C8%C6%F0.txt";
//"http://tinghuaapp.oss-cn-shanghai.aliyuncs.com/20170612201739607815";
//"http://static.gaoshouyou.com/d/36/69/2d3699acfa69e9632262442c46516ad8.apk";
//"http://oqcpqqvuf.bkt.clouddn.com/ceshi.txt";
//"http://down8.androidgame-store.com/201706122321/97967927DD4E53D9905ECAA7874C8128/new/game1/19/45319/com.neuralprisma-2.5.2.174-2000174_1494784835.apk?f=web_1";
"http://down8.androidgame-store.com/201706122321/97967927DD4E53D9905ECAA7874C8128/new/game1/19/45319/com.neuralprisma-2.5.2.174-2000174_1494784835.apk?f=web_1";
//不支持断点的链接
//"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-";
//"http://172.18.104.50:8080/download/_302turn";

View File

@@ -35,7 +35,7 @@ import com.arialyy.simple.widget.SubStateLinearLayout;
* Created by Aria.Lao on 2017/7/6.
*/
public class FTPDirDownloadActivity extends BaseActivity<ActivityDownloadGroupBinding> {
private static final String dir = "ftp://172.18.104.66:21/haha/";
private static final String dir = "ftp://172.18.104.49:21/haha/";
@Bind(R.id.child_list) SubStateLinearLayout mChildList;

View File

@@ -19,6 +19,7 @@ package com.arialyy.simple.download.multi_download;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
@@ -182,7 +183,7 @@ public class DownloadAdapter extends AbsRVAdapter<AbsEntity, DownloadAdapter.Sim
color = android.R.color.holo_red_light;
break;
case IEntity.STATE_COMPLETE:
str = "重新开始?";
str = "完成";
holder.progress.setProgress(100);
break;
}
@@ -206,9 +207,9 @@ public class DownloadAdapter extends AbsRVAdapter<AbsEntity, DownloadAdapter.Sim
mData.remove(entity);
notifyDataSetChanged();
if (isSimpleDownload(entity)) {
Aria.download(getContext()).load((DownloadEntity) entity).cancel();
Aria.download(getContext()).load((DownloadEntity) entity).cancel(true);
} else {
Aria.download(getContext()).load((DownloadGroupEntity) entity).cancel();
Aria.download(getContext()).load((DownloadGroupEntity) entity).cancel(true);
}
}
});
@@ -254,7 +255,6 @@ public class DownloadAdapter extends AbsRVAdapter<AbsEntity, DownloadAdapter.Sim
case IEntity.STATE_OTHER:
case IEntity.STATE_FAIL:
case IEntity.STATE_STOP:
case IEntity.STATE_COMPLETE:
case IEntity.STATE_PRE:
case IEntity.STATE_POST_PRE:
start(entity);
@@ -262,6 +262,9 @@ public class DownloadAdapter extends AbsRVAdapter<AbsEntity, DownloadAdapter.Sim
case IEntity.STATE_RUNNING:
stop(entity);
break;
case IEntity.STATE_COMPLETE:
Log.d(TAG, "任务已完成");
break;
}
}

View File

@@ -66,8 +66,8 @@ public class MultiTaskActivity extends BaseActivity<ActivityMultiBinding> {
dialog.show(getSupportFragmentManager(), "download_num");
break;
case R.id.stop_all:
//Aria.download(this).stopAllTask();
Aria.download(this).removeAllTask(true);
Aria.download(this).stopAllTask();
//Aria.download(this).removeAllTask(true);
break;
case R.id.turn:
startActivity(new Intent(this, MultiDownloadActivity.class));

View File

@@ -34,8 +34,8 @@ import com.arialyy.simple.databinding.ActivityFtpUploadBinding;
* Ftp 文件上传demo
*/
public class FtpUploadActivity extends BaseActivity<ActivityFtpUploadBinding> {
private final String FILE_PATH = "/mnt/sdcard/Download/jd.jpg";
private final String URL = "ftp://192.168.1.9:21/upload/测试";
private final String FILE_PATH = "/mnt/sdcard/Download/me.jpg";
private final String URL = "ftp://172.18.104.49:21/upload/测试";
@Override protected void init(Bundle savedInstanceState) {
setTile("FTP 文件上传");
@@ -92,6 +92,7 @@ public class FtpUploadActivity extends BaseActivity<ActivityFtpUploadBinding> {
}
@Upload.onTaskRunning public void taskRunning(UploadTask task) {
Log.d(TAG, "PP = " + task.getPercent());
getBinding().setProgress(task.getPercent());
getBinding().setSpeed(task.getConvertSpeed());
}