AriaLyy 8 years ago
parent b7b1c88cc9
commit 3c876d8d52
  1. 6
      Aria/src/main/java/com/arialyy/aria/core/QueueMod.java
  2. 3
      Aria/src/main/java/com/arialyy/aria/core/command/AddCmd.java
  3. 3
      Aria/src/main/java/com/arialyy/aria/core/command/CancelCmd.java
  4. 3
      Aria/src/main/java/com/arialyy/aria/core/command/HighestPriorityCmd.java
  5. 7
      Aria/src/main/java/com/arialyy/aria/core/command/ResumeAllCmd.java
  6. 26
      Aria/src/main/java/com/arialyy/aria/core/command/StartCmd.java
  7. 3
      Aria/src/main/java/com/arialyy/aria/core/command/StopCmd.java
  8. 27
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadUtil.java
  9. 12
      Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
  10. 9
      Aria/src/main/java/com/arialyy/aria/core/inf/AbsTask.java
  11. 5
      Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java
  12. 3
      Aria/src/main/java/com/arialyy/aria/core/queue/ITaskQueue.java
  13. 6
      Aria/src/main/java/com/arialyy/aria/core/scheduler/AbsSchedulers.java
  14. 1
      app/build.gradle
  15. 9
      app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
  16. 5
      app/src/main/java/com/arialyy/simple/download/multi_download/MultiDownloadActivity.java

@ -6,8 +6,10 @@ package com.arialyy.aria.core;
*/ */
public enum QueueMod { public enum QueueMod {
/** /**
* 等待模式如果执行队列已经满了再次使用start命令执行任务时该任务会被添加到缓存队列中 * 等待模式
* 当执行队列的任务完成时将自动执行缓存队列中的任务 * 如果执行队列已经满了再对其它任务TASK_A使用start命令执行任务时
* 1TASK_A添加到缓存队列中当执行队列中的任务完成时系统会将自动执行缓存队列中的TASK_A
* 2如果再次对TASK_A使用start命令TASK_A将会立刻执行
*/ */
WAIT("wait"), WAIT("wait"),

@ -17,6 +17,7 @@
package com.arialyy.aria.core.command; package com.arialyy.aria.core.command;
import android.util.Log; import android.util.Log;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
@ -33,7 +34,7 @@ class AddCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
@Override public void executeCmd() { @Override public void executeCmd() {
if (!canExeCmd) return; if (!canExeCmd) return;
ITask task = mQueue.getTask(mTaskEntity.getEntity()); AbsTask task = mQueue.getTask(mTaskEntity.getEntity());
if (task == null) { if (task == null) {
mTaskEntity.getEntity().setState(IEntity.STATE_WAIT); mTaskEntity.getEntity().setState(IEntity.STATE_WAIT);
mQueue.createTask(mTargetName, mTaskEntity); mQueue.createTask(mTargetName, mTaskEntity);

@ -17,6 +17,7 @@
package com.arialyy.aria.core.command; package com.arialyy.aria.core.command;
import android.text.TextUtils; import android.text.TextUtils;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
@ -31,7 +32,7 @@ class CancelCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
@Override public void executeCmd() { @Override public void executeCmd() {
if (!canExeCmd) return; if (!canExeCmd) return;
ITask task = mQueue.getTask(mTaskEntity.getEntity()); AbsTask task = mQueue.getTask(mTaskEntity.getEntity());
if (task == null) { if (task == null) {
task = mQueue.createTask(mTargetName, mTaskEntity); task = mQueue.createTask(mTargetName, mTaskEntity);
} }

@ -16,6 +16,7 @@
package com.arialyy.aria.core.command; package com.arialyy.aria.core.command;
import android.text.TextUtils; import android.text.TextUtils;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
@ -39,7 +40,7 @@ final class HighestPriorityCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
@Override public void executeCmd() { @Override public void executeCmd() {
if (!canExeCmd) return; if (!canExeCmd) return;
ITask task = mQueue.getTask(mTaskEntity.getEntity()); AbsTask task = mQueue.getTask(mTaskEntity.getEntity());
if (task == null) { if (task == null) {
task = mQueue.createTask(mTargetName, mTaskEntity); task = mQueue.createTask(mTargetName, mTaskEntity);
} }

@ -3,6 +3,7 @@ package com.arialyy.aria.core.command;
import android.util.Log; import android.util.Log;
import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.DownloadTaskEntity; import com.arialyy.aria.core.download.DownloadTaskEntity;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
@ -29,7 +30,7 @@ final class ResumeAllCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
for (DownloadEntity entity : allEntity) { for (DownloadEntity entity : allEntity) {
int exeNum = mQueue.getExePoolSize(); int exeNum = mQueue.getExePoolSize();
if (exeNum == 0 || exeNum < mQueue.getMaxTaskNum()) { if (exeNum == 0 || exeNum < mQueue.getMaxTaskNum()) {
ITask task = createTask(entity); AbsTask task = createTask(entity);
mQueue.startTask(task); mQueue.startTask(task);
} else { } else {
entity.setState(IEntity.STATE_WAIT); entity.setState(IEntity.STATE_WAIT);
@ -38,8 +39,8 @@ final class ResumeAllCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
} }
} }
private ITask createTask(DownloadEntity entity) { private AbsTask createTask(DownloadEntity entity) {
ITask task = mQueue.getTask(entity); AbsTask task = mQueue.getTask(entity);
if (task == null) { if (task == null) {
DownloadTaskEntity taskEntity = new DownloadTaskEntity(entity); DownloadTaskEntity taskEntity = new DownloadTaskEntity(entity);
task = mQueue.createTask(mTargetName, taskEntity); task = mQueue.createTask(mTargetName, taskEntity);

@ -19,12 +19,15 @@ package com.arialyy.aria.core.command;
import android.text.TextUtils; import android.text.TextUtils;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
import com.arialyy.aria.core.QueueMod; import com.arialyy.aria.core.QueueMod;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
/** /**
* Created by lyy on 2016/8/22. * Created by lyy on 2016/8/22.
* 开始命令 * 开始命令
* 队列模型{@link QueueMod#NOW}{@link QueueMod#WAIT}
*/ */
class StartCmd<T extends AbsTaskEntity> extends AbsCmd<T> { class StartCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
@ -34,14 +37,6 @@ class StartCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
@Override public void executeCmd() { @Override public void executeCmd() {
if (!canExeCmd) return; if (!canExeCmd) return;
ITask task = mQueue.getTask(mTaskEntity.getEntity());
if (task == null) {
task = mQueue.createTask(mTargetName, mTaskEntity);
}
if (task != null) {
if (!TextUtils.isEmpty(mTargetName)) {
task.setTargetName(mTargetName);
}
String mod; String mod;
int maxTaskNum; int maxTaskNum;
AriaManager manager = AriaManager.getInstance(AriaManager.APP); AriaManager manager = AriaManager.getInstance(AriaManager.APP);
@ -52,6 +47,14 @@ class StartCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
mod = manager.getUploadConfig().getQueueMod(); mod = manager.getUploadConfig().getQueueMod();
maxTaskNum = manager.getUploadConfig().getMaxTaskNum(); maxTaskNum = manager.getUploadConfig().getMaxTaskNum();
} }
AbsTask task = mQueue.getTask(mTaskEntity.getEntity());
if (task == null) {
task = mQueue.createTask(mTargetName, mTaskEntity);
if (!TextUtils.isEmpty(mTargetName)) {
task.setTargetName(mTargetName);
}
// 任务不存在时,根据配置不同,对任务执行操作
if (mod.equals(QueueMod.NOW.getTag())) { if (mod.equals(QueueMod.NOW.getTag())) {
mQueue.startTask(task); mQueue.startTask(task);
} else if (mod.equals(QueueMod.WAIT.getTag())) { } else if (mod.equals(QueueMod.WAIT.getTag())) {
@ -59,6 +62,13 @@ class StartCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
mQueue.startTask(task); mQueue.startTask(task);
} }
} }
} else {
// 任务不存在时,根据配置不同,对任务执行操作
if (!task.isRunning()
&& mod.equals(QueueMod.WAIT.getTag())
&& task.getState() == IEntity.STATE_WAIT) {
mQueue.startTask(task);
}
} }
} }
} }

@ -18,6 +18,7 @@ package com.arialyy.aria.core.command;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
@ -34,7 +35,7 @@ class StopCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
@Override public void executeCmd() { @Override public void executeCmd() {
if (!canExeCmd) return; if (!canExeCmd) return;
ITask task = mQueue.getTask(mTaskEntity.getEntity()); AbsTask task = mQueue.getTask(mTaskEntity.getEntity());
if (task == null) { if (task == null) {
if (mTaskEntity.getEntity().getState() == IEntity.STATE_RUNNING) { if (mTaskEntity.getEntity().getState() == IEntity.STATE_RUNNING) {
task = mQueue.createTask(mTargetName, mTaskEntity); task = mQueue.createTask(mTargetName, mTaskEntity);

@ -20,6 +20,8 @@ import android.content.Context;
import android.util.Log; import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
import com.arialyy.aria.orm.DbEntity;
import com.arialyy.aria.orm.DbUtil;
import com.arialyy.aria.util.BufferedRandomAccessFile; import com.arialyy.aria.util.BufferedRandomAccessFile;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
import java.io.File; import java.io.File;
@ -78,12 +80,28 @@ class DownloadUtil implements IDownloadUtil, Runnable {
+ AriaManager.DOWNLOAD_TEMP_DIR + AriaManager.DOWNLOAD_TEMP_DIR
+ mDownloadFile.getName() + mDownloadFile.getName()
+ ".properties"); + ".properties");
checkTask();
}
/**
* 检查任务是否是新任务新任务条件
* 1文件不存在
* 2下载记录文件不存在
* 3下载记录文件缺失或不匹配
* 4数据库记录不存在
*/
private void checkTask() {
try { try {
if (!mConfigFile.exists()) { //记录文件被删除,则重新下载 if (!mConfigFile.exists()) { //记录文件被删除,则重新下载
isNewTask = true; isNewTask = true;
CommonUtil.createFile(mConfigFile.getPath()); CommonUtil.createFile(mConfigFile.getPath());
} else if (!mDownloadFile.exists()) {
isNewTask = true;
} else if (DbEntity.findData(DownloadEntity.class, "downloadUrl=?",
mDownloadEntity.getDownloadUrl()) == null) {
isNewTask = true;
} else { } else {
isNewTask = !mDownloadFile.exists(); isNewTask = false;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -195,9 +213,10 @@ class DownloadUtil implements IDownloadUtil, Runnable {
} }
@Override public void run() { @Override public void run() {
HttpURLConnection conn = null;
try { try {
URL url = new URL(mDownloadEntity.getDownloadUrl()); URL url = new URL(mDownloadEntity.getDownloadUrl());
HttpURLConnection conn = ConnectionHelp.handleConnection(url); conn = ConnectionHelp.handleConnection(url);
conn = ConnectionHelp.setConnectParam(mDownloadTaskEntity, conn); conn = ConnectionHelp.setConnectParam(mDownloadTaskEntity, conn);
conn.setRequestProperty("Range", "bytes=" + 0 + "-"); conn.setRequestProperty("Range", "bytes=" + 0 + "-");
conn.setConnectTimeout(mConnectTimeOut); conn.setConnectTimeout(mConnectTimeOut);
@ -210,6 +229,10 @@ class DownloadUtil implements IDownloadUtil, Runnable {
+ mDownloadFile.getPath() + mDownloadFile.getPath()
+ "】\n" + "】\n"
+ CommonUtil.getPrintException(e)); + CommonUtil.getPrintException(e));
} finally {
if (conn != null) {
conn.disconnect();
}
} }
} }

@ -206,11 +206,13 @@ public abstract class AbsTarget<ENTITY extends AbsEntity, TASK_ENTITY extends Ab
* 开始下载 * 开始下载
*/ */
public void start() { public void start() {
List<AbsCmd> cmds = new ArrayList<>(); //List<AbsCmd> cmds = new ArrayList<>();
cmds.add(CommonUtil.createCmd(targetName, taskEntity, CmdFactory.TASK_CREATE)); //cmds.add(CommonUtil.createCmd(targetName, taskEntity, CmdFactory.TASK_CREATE));
cmds.add(CommonUtil.createCmd(targetName, taskEntity, CmdFactory.TASK_START)); //cmds.add(CommonUtil.createCmd(targetName, taskEntity, CmdFactory.TASK_START));
AriaManager.getInstance(AriaManager.APP).setCmds(cmds).exe(); //cmds.clear();
cmds.clear(); AriaManager.getInstance(AriaManager.APP)
.setCmd(CommonUtil.createCmd(targetName, taskEntity, CmdFactory.TASK_START))
.exe();
} }
/** /**

@ -37,6 +37,15 @@ public abstract class AbsTask<TASK_ENTITY extends AbsTaskEntity, ENTITY extends
} }
/**
* 任务当前状态
*
* @return {@link IEntity}
*/
public int getState() {
return mEntity == null ? IEntity.STATE_OTHER : mEntity.getState();
}
/** /**
* @return 返回原始byte速度需要你在配置文件中配置 * @return 返回原始byte速度需要你在配置文件中配置
* <pre> * <pre>

@ -20,6 +20,7 @@ import android.util.Log;
import com.arialyy.aria.core.Aria; import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
import com.arialyy.aria.core.inf.AbsEntity; import com.arialyy.aria.core.inf.AbsEntity;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
import com.arialyy.aria.core.queue.pool.CachePool; import com.arialyy.aria.core.queue.pool.CachePool;
@ -30,7 +31,7 @@ import java.util.Set;
* Created by lyy on 2017/2/23. * Created by lyy on 2017/2/23.
* 任务队列 * 任务队列
*/ */
abstract class AbsTaskQueue<TASK extends ITask, TASK_ENTITY extends AbsTaskEntity, ENTITY extends AbsEntity> abstract class AbsTaskQueue<TASK extends AbsTask, TASK_ENTITY extends AbsTaskEntity, ENTITY extends AbsEntity>
implements ITaskQueue<TASK, TASK_ENTITY, ENTITY> { implements ITaskQueue<TASK, TASK_ENTITY, ENTITY> {
private final String TAG = "AbsTaskQueue"; private final String TAG = "AbsTaskQueue";
CachePool<TASK> mCachePool = new CachePool<>(); CachePool<TASK> mCachePool = new CachePool<>();
@ -118,7 +119,7 @@ abstract class AbsTaskQueue<TASK extends ITask, TASK_ENTITY extends AbsTaskEntit
task.stop(); task.stop();
} else { } else {
task.stop(); task.stop();
Log.w(TAG, "停止任务失败,【任务已经停止】"); Log.w(TAG, "删除任务失败,【执行队列中没有该任务】");
} }
} }

@ -19,6 +19,7 @@ package com.arialyy.aria.core.queue;
import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.DownloadTaskEntity; import com.arialyy.aria.core.download.DownloadTaskEntity;
import com.arialyy.aria.core.download.DownloadTask; import com.arialyy.aria.core.download.DownloadTask;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
@ -30,7 +31,7 @@ import com.arialyy.aria.core.upload.UploadTaskEntity;
* Created by lyy on 2016/8/16. * Created by lyy on 2016/8/16.
* 任务功能接口 * 任务功能接口
*/ */
public interface ITaskQueue<TASK extends ITask, TASK_ENTITY extends AbsTaskEntity, ENTITY extends IEntity> { public interface ITaskQueue<TASK extends AbsTask, TASK_ENTITY extends AbsTaskEntity, ENTITY extends IEntity> {
/** /**
* 通过key判断任务是否正在执行 * 通过key判断任务是否正在执行

@ -21,6 +21,7 @@ import android.util.Log;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
import com.arialyy.aria.core.download.DownloadTask; import com.arialyy.aria.core.download.DownloadTask;
import com.arialyy.aria.core.inf.AbsEntity; import com.arialyy.aria.core.inf.AbsEntity;
import com.arialyy.aria.core.inf.AbsTask;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.inf.ITask; import com.arialyy.aria.core.inf.ITask;
@ -34,7 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
/** /**
* Created by lyy on 2017/6/4. * Created by lyy on 2017/6/4.
*/ */
public abstract class AbsSchedulers<TASK_ENTITY extends AbsTaskEntity, ENTITY extends AbsEntity, TASK extends ITask<ENTITY>, QUEUE extends ITaskQueue<TASK, TASK_ENTITY, ENTITY>> public abstract class AbsSchedulers<TASK_ENTITY extends AbsTaskEntity, ENTITY extends AbsEntity, TASK extends AbsTask<TASK_ENTITY, ENTITY>, QUEUE extends ITaskQueue<TASK, TASK_ENTITY, ENTITY>>
implements ISchedulers<TASK> { implements ISchedulers<TASK> {
private static final String TAG = "AbsSchedulers"; private static final String TAG = "AbsSchedulers";
@ -131,7 +132,7 @@ public abstract class AbsSchedulers<TASK_ENTITY extends AbsTaskEntity, ENTITY ex
Log.e(TAG, "请传入下载任务"); Log.e(TAG, "请传入下载任务");
return true; return true;
} }
callback(msg.what, task); //callback(msg.what, task);
ENTITY entity = task.getEntity(); ENTITY entity = task.getEntity();
switch (msg.what) { switch (msg.what) {
case STOP: case STOP:
@ -154,6 +155,7 @@ public abstract class AbsSchedulers<TASK_ENTITY extends AbsTaskEntity, ENTITY ex
handleFailTask(task); handleFailTask(task);
break; break;
} }
callback(msg.what, task);
return true; return true;
} }

@ -42,6 +42,7 @@ dependencies {
compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.arialyy.frame:MVVM2:2.2.0' compile 'com.arialyy.frame:MVVM2:2.2.0'
compile project(':Aria') compile project(':Aria')
compile project(':AriaCompiler')
// compile 'com.arialyy.aria:aria-core:3.1.9' // compile 'com.arialyy.aria:aria-core:3.1.9'
// annotationProcessor 'com.arialyy.aria:aria-compiler:3.1.9' // annotationProcessor 'com.arialyy.aria:aria-compiler:3.1.9'

@ -209,6 +209,10 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
@Download.onTaskCancel(DOWNLOAD_URL) void taskCancel(DownloadTask task) { @Download.onTaskCancel(DOWNLOAD_URL) void taskCancel(DownloadTask task) {
mUpdateHandler.sendEmptyMessage(DOWNLOAD_CANCEL); mUpdateHandler.sendEmptyMessage(DOWNLOAD_CANCEL);
L.d(TAG, "task__cancel"); L.d(TAG, "task__cancel");
//Aria.download(this)
// .load(DOWNLOAD_URL)
// .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/test.apk")
// .add();
} }
@Download.onTaskFail(DOWNLOAD_URL) void taskFail(DownloadTask task) { @Download.onTaskFail(DOWNLOAD_URL) void taskFail(DownloadTask task) {
@ -257,6 +261,11 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
} else if (text.equals("恢复")) { } else if (text.equals("恢复")) {
Aria.download(this).load(DOWNLOAD_URL).resume(); Aria.download(this).load(DOWNLOAD_URL).resume();
} }
//DownloadTarget target = Aria.download(this)
// .load(DOWNLOAD_URL)
// .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/test.apk");
//target.add();
//target.cancel();
break; break;
case R.id.stop: case R.id.stop:
Aria.download(this).load(DOWNLOAD_URL).pause(); Aria.download(this).load(DOWNLOAD_URL).pause();

@ -106,10 +106,7 @@ public class MultiDownloadActivity extends BaseActivity<ActivityMultiDownloadBin
mAdapter.updateState(task.getDownloadEntity()); mAdapter.updateState(task.getDownloadEntity());
} }
@Download.onTaskRunning({ @Download.onTaskRunning() void taskRunning(DownloadTask task) {
"https://g37.gdl.netease.com/onmyoji_netease_10_1.0.20.apk",
"http://static.gaoshouyou.com/d/eb/f2/dfeba30541f209ab8a50d847fc1661ce.apk"
}) void taskRunning(DownloadTask task) {
mAdapter.setProgress(task.getDownloadEntity()); mAdapter.setProgress(task.getDownloadEntity());
} }
} }

Loading…
Cancel
Save