|
|
|
@ -61,7 +61,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> { |
|
|
|
|
//"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";
|
|
|
|
|
//"http://9.9.9.59:5000/download/CentOS-7-x86_64-Minimal-1804.iso";
|
|
|
|
|
"http://120.55.95.61:8811/ghcg/zg/武义总规纲要成果.zip"; |
|
|
|
|
"https://firmwareapi.azurewebsites.net/firmware-overview?name=A19_Filament_W_IMG0038_00102411-encrypted.ota"; |
|
|
|
|
@Bind(R.id.start) Button mStart; |
|
|
|
|
@Bind(R.id.stop) Button mStop; |
|
|
|
|
@Bind(R.id.cancel) Button mCancel; |
|
|
|
@ -178,10 +178,11 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Download.onTaskFail void taskFail(DownloadTask task) { |
|
|
|
|
@Download.onTaskFail void taskFail(DownloadTask task, Exception e) { |
|
|
|
|
if (task.getKey().equals(DOWNLOAD_URL)) { |
|
|
|
|
Toast.makeText(SingleTaskActivity.this, "下载失败", Toast.LENGTH_SHORT).show(); |
|
|
|
|
setBtState(true); |
|
|
|
|
//ALog.d(TAG, ALog.getExceptionString(e));
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -196,11 +197,11 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> { |
|
|
|
|
L.d(TAG, "path ==> " + task.getDownloadEntity().getDownloadPath()); |
|
|
|
|
L.d(TAG, "md5Code ==> " + CommonUtil.getFileMD5(new File(task.getDownloadPath()))); |
|
|
|
|
L.d(TAG, "data ==> " + Aria.download(this).getDownloadEntity(DOWNLOAD_URL)); |
|
|
|
|
//Intent install = new Intent(Intent.ACTION_VIEW);
|
|
|
|
|
//install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
|
//File apkFile = new File(task.getDownloadPath());
|
|
|
|
|
//install.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
|
|
|
|
|
//startActivity(install);
|
|
|
|
|
Intent install = new Intent(Intent.ACTION_VIEW); |
|
|
|
|
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
|
|
File apkFile = new File(task.getDownloadPath()); |
|
|
|
|
install.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); |
|
|
|
|
startActivity(install); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -251,7 +252,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> { |
|
|
|
|
private void startD() { |
|
|
|
|
//Aria.get(this).setLogLevel(ALog.LOG_CLOSE);
|
|
|
|
|
//Aria.download(this).load("aaaa.apk");
|
|
|
|
|
String path = Environment.getExternalStorageDirectory().getPath() + "/ggsg11.apk"; |
|
|
|
|
String path = Environment.getExternalStorageDirectory().getPath() + "/ggsg11.ota"; |
|
|
|
|
//File file = new File(path);
|
|
|
|
|
//if (file.exists()){
|
|
|
|
|
// file.delete();
|
|
|
|
@ -260,7 +261,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> { |
|
|
|
|
Aria.download(SingleTaskActivity.this) |
|
|
|
|
.load(DOWNLOAD_URL) |
|
|
|
|
//.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
|
|
|
|
|
//.addHeader("Accept-Encoding", "gzip, deflate")
|
|
|
|
|
.addHeader("Accept-Encoding", "gzip, deflate") |
|
|
|
|
//.addHeader("DNT", "1")
|
|
|
|
|
//.addHeader("Cookie", "BAIDUID=648E5FF020CC69E8DD6F492D1068AAA9:FG=1; BIDUPSID=648E5FF020CC69E8DD6F492D1068AAA9; PSTM=1519099573; BD_UPN=12314753; locale=zh; BDSVRTM=0")
|
|
|
|
|
.useServerFileName(true) |
|
|
|
|