This commit is contained in:
@@ -15,8 +15,8 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<!--android:name=".test.TestGroupActivity"-->
|
||||
<!--android:name=".test.TestActivity"-->
|
||||
<!--android:name=".MainActivity"-->
|
||||
<!--android:name=".test.TestActivity"-->
|
||||
<activity
|
||||
android:name=".test.AnyRunActivity"
|
||||
android:label="@string/app_name">
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
<!--注意,修改该配置文件中的属性会覆盖代码中所设置的属性-->
|
||||
<download>
|
||||
<!--是否使用虚拟文件,使用虚拟文件初始化时将不占用磁盘空间,下载多少byte,占多少空间,效果见chrome的下载。-->
|
||||
<!--是否开启动态文件,开启动态文件后初始化时将不占用磁盘空间,下载多少byte,占多少空间,效果见chrome的下载。-->
|
||||
<!--注意:
|
||||
1、使用该功能,将自动关闭多线程下载;
|
||||
2、对于已经采用了多线程的任务,依然采用原来的下载方式;
|
||||
3、原本参数是true,任务没下载完成,就参数改为false,那么没下载完成的任务还是会按照参数修改前的方式下载;只有新任务才会根据参数调用不同的下载方式。-->
|
||||
<useVirtualFile value="true"/>
|
||||
<openDynamicFile value="false"/>
|
||||
|
||||
<!--断网的时候是否重试,true:断网也重试;false:断网不重试,直接走失败的回调-->
|
||||
<notNetRetry value="true"/>
|
||||
@@ -25,7 +25,7 @@
|
||||
<threadNum value="3"/>
|
||||
|
||||
<!--设置下载队列最大任务数, 默认为2-->
|
||||
<maxTaskNum value="2"/>
|
||||
<maxTaskNum value="20"/>
|
||||
|
||||
<!--设置下载失败,重试次数,默认为10-->
|
||||
<reTryNum value="2"/>
|
||||
|
||||
@@ -3,12 +3,9 @@ package com.arialyy.simple.test;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.inf.AbsEntity;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
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.
|
||||
@@ -18,8 +15,9 @@ public class AnyRunActivity extends BaseActivity<ActivityTestBinding> {
|
||||
AnyRunnModule module;
|
||||
String[] urls;
|
||||
int index = 0;
|
||||
String URL = "http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk";
|
||||
//String URL = "http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk";
|
||||
//String URL = "http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk";
|
||||
private final String URL = "ftp://192.168.29.140:21/download//AriaPrj.rar";
|
||||
//String URL = "https://dl.genymotion.com/releases/genymotion-2.12.1/genymotion-2.12.1-vbox.exe";
|
||||
|
||||
@Override protected int setLayoutId() {
|
||||
@@ -42,9 +40,12 @@ public class AnyRunActivity extends BaseActivity<ActivityTestBinding> {
|
||||
// module.start(urls[index]);
|
||||
// index++;
|
||||
//}
|
||||
module.start(URL);
|
||||
List<AbsEntity> list = Aria.download(this).getTotalTaskList();
|
||||
ALog.d(TAG, "size ==> " + list.size());
|
||||
//for (int i = 0; i < 10; i++) {
|
||||
|
||||
module.startFtp(URL);
|
||||
//}
|
||||
//List<AbsEntity> list = Aria.download(this).getTotalTaskList();
|
||||
//ALog.d(TAG, "size ==> " + list.size());
|
||||
break;
|
||||
case R.id.stop:
|
||||
//List<AbsEntity> list = Aria.download(this).getTotalTaskList();
|
||||
|
||||
@@ -62,16 +62,58 @@ public class AnyRunnModule {
|
||||
L.d(TAG, "md5Code ==> " + CommonUtil.getFileMD5(new File(task.getDownloadPath())));
|
||||
}
|
||||
|
||||
|
||||
void start(String url) {
|
||||
mUrl = url;
|
||||
Aria.download(this)
|
||||
.load(url)
|
||||
.addHeader("Accept-Encoding", "gzip")
|
||||
//.addHeader("Accept-Encoding", "gzip")
|
||||
.setRequestMode(RequestEnum.GET)
|
||||
.setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg123456.apk")
|
||||
.resetState()
|
||||
//.resetState()
|
||||
.start();
|
||||
//String[] urls = new String[] {
|
||||
// "http://cdn-s1.touchfound.net/1526449199142_3617.png",
|
||||
// "http://cdn-s1.touchfound.net/mtVmResources/1526287158571.zip",
|
||||
// "http://cdn-s1.touchfound.net/1526450206960_2186.png",
|
||||
// "http://cdn-s1.touchfound.net/1526449199025_1476.png"
|
||||
//};
|
||||
//for (int i = 0, len = urls.length; i < len; i++){
|
||||
//
|
||||
// Aria.download(this)
|
||||
// .load(urls[i])
|
||||
// //.addHeader("Accept-Encoding", "gzip")
|
||||
// .setRequestMode(RequestEnum.GET)
|
||||
// .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg123456.apk" + i)
|
||||
// //.resetState()
|
||||
// .start();
|
||||
//}
|
||||
}
|
||||
|
||||
void startFtp(String url) {
|
||||
mUrl = url;
|
||||
Aria.download(this)
|
||||
.loadFtp(url)
|
||||
.login("lao", "123456")
|
||||
//.addHeader("Accept-Encoding", "gzip")
|
||||
.setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ftp_ggsg16.apk")
|
||||
//.resetState()
|
||||
.start();
|
||||
//String[] urls = new String[] {
|
||||
// "http://cdn-s1.touchfound.net/1526449199142_3617.png",
|
||||
// "http://cdn-s1.touchfound.net/mtVmResources/1526287158571.zip",
|
||||
// "http://cdn-s1.touchfound.net/1526450206960_2186.png",
|
||||
// "http://cdn-s1.touchfound.net/1526449199025_1476.png"
|
||||
//};
|
||||
//for (int i = 0, len = urls.length; i < len; i++){
|
||||
//
|
||||
// Aria.download(this)
|
||||
// .load(urls[i])
|
||||
// //.addHeader("Accept-Encoding", "gzip")
|
||||
// .setRequestMode(RequestEnum.GET)
|
||||
// .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg123456.apk" + i)
|
||||
// //.resetState()
|
||||
// .start();
|
||||
//}
|
||||
}
|
||||
|
||||
void stop(String url) {
|
||||
|
||||
Reference in New Issue
Block a user