3.1.2代码合并

pull/330/head
AriaLyy 8 years ago
commit 810b87aa99
  1. 4
      Aria/build.gradle
  2. 6
      Aria/src/main/java/com/arialyy/aria/core/Aria.java
  3. 2
      Aria/src/main/java/com/arialyy/aria/core/Configuration.java
  4. 1
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java
  5. 8
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java
  6. 7
      Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
  7. 2
      Aria/src/main/java/com/arialyy/aria/core/inf/IEntity.java
  8. 82
      Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java
  9. 86
      Aria/src/main/java/com/arialyy/aria/core/queue/DownloadTaskQueue.java
  10. 27
      Aria/src/main/java/com/arialyy/aria/core/queue/ITaskQueue.java
  11. 51
      Aria/src/main/java/com/arialyy/aria/core/queue/UploadTaskQueue.java
  12. 2
      Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java
  13. 2
      Aria/src/main/java/com/arialyy/aria/core/scheduler/UploadSchedulers.java
  14. 2
      Aria/src/main/java/com/arialyy/aria/core/upload/UploadEntity.java
  15. 6
      Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java
  16. 2
      BroadCast.md
  17. 2
      DownloadApi.md
  18. 3
      README.md
  19. 2
      app/src/main/java/com/arialyy/simple/download/DownloadModule.java

@ -7,8 +7,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 9 minSdkVersion 9
targetSdkVersion 23 targetSdkVersion 23
versionCode 311 versionCode 312
versionName "3.1.1" versionName "3.1.2"
} }
buildTypes { buildTypes {
release { release {

@ -100,7 +100,11 @@ import com.arialyy.aria.core.upload.UploadTask;
/** /**
* 下载实体 * 下载实体
*/ */
public static final String ENTITY = "DOWNLOAD_ENTITY"; public static final String DOWNLOAD_ENTITY = "DOWNLOAD_ENTITY";
/**
* 上传实体
*/
public static final String UPLOAD_ENTITY = "UPLOAD_ENTITY";
/** /**
* 位置 * 位置
*/ */

@ -86,7 +86,7 @@ class Configuration {
oldMaxTaskNum = this.maxTaskNum; oldMaxTaskNum = this.maxTaskNum;
this.maxTaskNum = maxTaskNum; this.maxTaskNum = maxTaskNum;
saveKey("maxTaskNum", maxTaskNum + ""); saveKey("maxTaskNum", maxTaskNum + "");
DownloadTaskQueue.getInstance().setDownloadNum(maxTaskNum); DownloadTaskQueue.getInstance().setMaxTaskNum(maxTaskNum);
return this; return this;
} }

@ -69,6 +69,7 @@ public class DownloadEntity extends DbEntity implements Parcelable, IEntity {
return failNum; return failNum;
} }
@Override
public void setFailNum(int failNum) { public void setFailNum(int failNum) {
this.failNum = failNum; this.failNum = failNum;
} }

@ -208,7 +208,7 @@ public class DownloadTask implements ITask {
// 发送停止下载的广播 // 发送停止下载的广播
Intent intent = CommonUtil.createIntent(mContext.getPackageName(), Aria.ACTION_STOP); Intent intent = CommonUtil.createIntent(mContext.getPackageName(), Aria.ACTION_STOP);
intent.putExtra(Aria.CURRENT_LOCATION, mEntity.getCurrentProgress()); intent.putExtra(Aria.CURRENT_LOCATION, mEntity.getCurrentProgress());
intent.putExtra(Aria.ENTITY, mEntity); intent.putExtra(Aria.DOWNLOAD_ENTITY, mEntity);
mContext.sendBroadcast(intent); mContext.sendBroadcast(intent);
} }
} }
@ -227,7 +227,7 @@ public class DownloadTask implements ITask {
} }
//发送取消下载的广播 //发送取消下载的广播
Intent intent = CommonUtil.createIntent(mContext.getPackageName(), Aria.ACTION_CANCEL); Intent intent = CommonUtil.createIntent(mContext.getPackageName(), Aria.ACTION_CANCEL);
intent.putExtra(Aria.ENTITY, mEntity); intent.putExtra(Aria.DOWNLOAD_ENTITY, mEntity);
mContext.sendBroadcast(intent); mContext.sendBroadcast(intent);
} }
} }
@ -285,7 +285,7 @@ public class DownloadTask implements ITask {
this.task = wTask.get(); this.task = wTask.get();
this.downloadEntity = this.task.getDownloadEntity(); this.downloadEntity = this.task.getDownloadEntity();
sendIntent = CommonUtil.createIntent(context.getPackageName(), Aria.ACTION_RUNNING); sendIntent = CommonUtil.createIntent(context.getPackageName(), Aria.ACTION_RUNNING);
sendIntent.putExtra(Aria.ENTITY, downloadEntity); sendIntent.putExtra(Aria.DOWNLOAD_ENTITY, downloadEntity);
final AriaManager manager = AriaManager.getInstance(context); final AriaManager manager = AriaManager.getInstance(context);
isOpenBroadCast = manager.getDownloadConfig().isOpenBreadCast(); isOpenBroadCast = manager.getDownloadConfig().isOpenBreadCast();
isConvertSpeed = manager.getDownloadConfig().isConvertSpeed(); isConvertSpeed = manager.getDownloadConfig().isConvertSpeed();
@ -406,7 +406,7 @@ public class DownloadTask implements ITask {
downloadEntity.update(); downloadEntity.update();
if (!isOpenBroadCast) return; if (!isOpenBroadCast) return;
Intent intent = CommonUtil.createIntent(context.getPackageName(), action); Intent intent = CommonUtil.createIntent(context.getPackageName(), action);
intent.putExtra(Aria.ENTITY, downloadEntity); intent.putExtra(Aria.DOWNLOAD_ENTITY, downloadEntity);
if (location != -1) { if (location != -1) {
intent.putExtra(Aria.CURRENT_LOCATION, location); intent.putExtra(Aria.CURRENT_LOCATION, location);
} }

@ -40,6 +40,13 @@ public class AbsTarget<ENTITY extends IEntity, TASK_ENTITY extends ITaskEntity>
protected TASK_ENTITY taskEntity; protected TASK_ENTITY taskEntity;
protected String targetName; protected String targetName;
/**
* 将该任务优先级提到最高
*/
protected void setToFirst(){
}
/** /**
* 重定向后新url的key默认为location * 重定向后新url的key默认为location
*/ */

@ -60,4 +60,6 @@ public interface IEntity {
@Ignore public static final int STATE_CANCEL = 7; @Ignore public static final int STATE_CANCEL = 7;
public int getState(); public int getState();
public void setFailNum(int failNum);
} }

@ -16,6 +16,7 @@
package com.arialyy.aria.core.queue; package com.arialyy.aria.core.queue;
import android.util.Log;
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.ITaskEntity; import com.arialyy.aria.core.inf.ITaskEntity;
@ -24,8 +25,89 @@ import com.arialyy.aria.core.queue.pool.ExecutePool;
/** /**
* Created by Aria.Lao on 2017/2/23. * Created by Aria.Lao on 2017/2/23.
* 任务队列
*/ */
abstract class AbsTaskQueue<TASK extends ITask, TASK_ENTITY extends ITaskEntity, ENTITY extends IEntity> abstract class AbsTaskQueue<TASK extends ITask, TASK_ENTITY extends ITaskEntity, ENTITY extends IEntity>
implements ITaskQueue<TASK, TASK_ENTITY, ENTITY> { implements ITaskQueue<TASK, TASK_ENTITY, ENTITY> {
private final String TAG = "AbsTaskQueue";
CachePool<TASK> mCachePool = new CachePool<>(); CachePool<TASK> mCachePool = new CachePool<>();
ExecutePool<TASK> mExecutePool = null;
/**
* 获取任务执行池
*/
public ExecutePool getExecutePool() {
return mExecutePool;
}
/**
* 获取缓存池
*/
public CachePool getCachePool() {
return mCachePool;
}
/**
* 获取缓存任务数
*
* @return 获取缓存的任务数
*/
@Override public int cachePoolSize() {
return mCachePool.size();
}
/**
* 获取当前运行的任务数
*
* @return 当前正在执行的任务数
*/
@Override public int executePoolSize() {
return mExecutePool.size();
}
@Override public TASK getTask(String url) {
TASK task = mExecutePool.getTask(url);
if (task == null) {
task = mCachePool.getTask(url);
}
return task;
}
@Override public void startTask(TASK task) {
if (mExecutePool.putTask(task)) {
mCachePool.removeTask(task);
task.getEntity().setFailNum(0);
task.start();
}
}
@Override public void stopTask(TASK task) {
if (!task.isRunning()) Log.w(TAG, "停止任务失败,【任务已经停止】");
if (mExecutePool.removeTask(task)) {
task.stop();
} else {
task.stop();
Log.w(TAG, "停止任务失败,【任务已经停止】");
}
}
@Override public void reTryStart(TASK task) {
if (task == null) {
Log.w(TAG, "重试下载失败,task 为null");
return;
}
if (!task.isRunning()) {
task.start();
} else {
Log.w(TAG, "任务没有完全停止,重试下载失败");
}
}
@Override public void cancelTask(TASK task) {
task.cancel();
}
@Override public TASK getNextTask() {
return mCachePool.pollTask();
}
} }

@ -23,7 +23,6 @@ import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.DownloadTask; import com.arialyy.aria.core.download.DownloadTask;
import com.arialyy.aria.core.download.DownloadTaskEntity; import com.arialyy.aria.core.download.DownloadTaskEntity;
import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.queue.pool.CachePool;
import com.arialyy.aria.core.queue.pool.ExecutePool; import com.arialyy.aria.core.queue.pool.ExecutePool;
import com.arialyy.aria.core.scheduler.DownloadSchedulers; import com.arialyy.aria.core.scheduler.DownloadSchedulers;
@ -36,7 +35,6 @@ public class DownloadTaskQueue
private static final String TAG = "DownloadTaskQueue"; private static final String TAG = "DownloadTaskQueue";
private static volatile DownloadTaskQueue INSTANCE = null; private static volatile DownloadTaskQueue INSTANCE = null;
private static final Object LOCK = new Object(); private static final Object LOCK = new Object();
private ExecutePool<DownloadTask> mExecutePool = new ExecutePool<>(true);
public static DownloadTaskQueue getInstance() { public static DownloadTaskQueue getInstance() {
if (INSTANCE == null) { if (INSTANCE == null) {
@ -48,79 +46,10 @@ public class DownloadTaskQueue
} }
private DownloadTaskQueue() { private DownloadTaskQueue() {
mExecutePool = new ExecutePool<>(true);
} }
/** @Override public void setMaxTaskNum(int downloadNum) {
* 获取任务执行池
*/
public ExecutePool getExecutePool() {
return mExecutePool;
}
/**
* 获取缓存池
*/
public CachePool getCachePool() {
return mCachePool;
}
/**
* 获取当前运行的任务数
*
* @return 当前正在执行的任务数
*/
public int getCurrentTaskNum() {
return mExecutePool.size();
}
/**
* 获取缓存任务数
*
* @return 获取缓存的任务数
*/
public int getCacheTaskNum() {
return mCachePool.size();
}
@Override public void startTask(DownloadTask task) {
if (mExecutePool.putTask(task)) {
mCachePool.removeTask(task);
task.getDownloadEntity().setFailNum(0);
task.start();
}
}
@Override public void stopTask(DownloadTask task) {
if (!task.isRunning()) Log.w(TAG, "停止任务失败,【任务已经停止】");
if (mExecutePool.removeTask(task)) {
task.stop();
} else {
task.stop();
Log.w(TAG, "停止任务失败,【任务已经停止】");
}
}
@Override public void cancelTask(DownloadTask task) {
task.cancel();
}
@Override public void reTryStart(DownloadTask task) {
if (task == null) {
Log.w(TAG, "重试下载失败,task 为null");
return;
}
if (!task.isRunning()) {
task.start();
} else {
Log.w(TAG, "任务没有完全停止,重试下载失败");
}
}
@Override public int size() {
return mExecutePool.size();
}
@Override public void setDownloadNum(int downloadNum) {
//原始长度 //原始长度
int size = AriaManager.getInstance(AriaManager.APP).getDownloadConfig().oldMaxTaskNum; int size = AriaManager.getInstance(AriaManager.APP).getDownloadConfig().oldMaxTaskNum;
int diff = downloadNum - size; int diff = downloadNum - size;
@ -164,14 +93,6 @@ public class DownloadTaskQueue
return getTask(entity.getDownloadUrl()); return getTask(entity.getDownloadUrl());
} }
@Override public DownloadTask getTask(String url) {
DownloadTask task = mExecutePool.getTask(url);
if (task == null) {
task = mCachePool.getTask(url);
}
return task;
}
@Override public void removeTask(DownloadEntity entity) { @Override public void removeTask(DownloadEntity entity) {
DownloadTask task = mExecutePool.getTask(entity.getDownloadUrl()); DownloadTask task = mExecutePool.getTask(entity.getDownloadUrl());
if (task != null) { if (task != null) {
@ -183,7 +104,4 @@ public class DownloadTaskQueue
} }
} }
@Override public DownloadTask getNextTask() {
return mCachePool.pollTask();
}
} }

@ -37,40 +37,45 @@ public interface ITaskQueue<TASK extends ITask, TASK_ENTITY extends ITaskEntity,
* *
* @param task {@link DownloadTask}{@link UploadTask} * @param task {@link DownloadTask}{@link UploadTask}
*/ */
public void startTask(TASK task); void startTask(TASK task);
/** /**
* 停止任务 * 停止任务
* *
* @param task {@link DownloadTask}{@link UploadTask} * @param task {@link DownloadTask}{@link UploadTask}
*/ */
public void stopTask(TASK task); void stopTask(TASK task);
/** /**
* 取消任务 * 取消任务
* *
* @param task {@link DownloadTask}{@link UploadTask} * @param task {@link DownloadTask}{@link UploadTask}
*/ */
public void cancelTask(TASK task); void cancelTask(TASK task);
/** /**
* 重试下载 * 重试下载
* *
* @param task {@link DownloadTask}{@link UploadTask} * @param task {@link DownloadTask}{@link UploadTask}
*/ */
public void reTryStart(TASK task); void reTryStart(TASK task);
/** /**
* 任务池队列大小 * 任务池队列大小
*/ */
public int size(); int executePoolSize();
/**
* 任务缓存池大小
*/
int cachePoolSize();
/** /**
* 设置最大任务数 * 设置最大任务数
* *
* @param newMaxNum 下载任务数 * @param newMaxNum 下载任务数
*/ */
public void setDownloadNum(int newMaxNum); void setMaxTaskNum(int newMaxNum);
/** /**
* 创建一个新的任务创建时只是将新任务存储到缓存池 * 创建一个新的任务创建时只是将新任务存储到缓存池
@ -79,7 +84,7 @@ public interface ITaskQueue<TASK extends ITask, TASK_ENTITY extends ITaskEntity,
* @param targetName 生成该任务的对象 * @param targetName 生成该任务的对象
* @return {@link DownloadTask}{@link UploadTask} * @return {@link DownloadTask}{@link UploadTask}
*/ */
public TASK createTask(String targetName, TASK_ENTITY entity); TASK createTask(String targetName, TASK_ENTITY entity);
/** /**
* 通过工作实体缓存池或任务池搜索下载任务如果缓存池或任务池都没有任务则创建新任务 * 通过工作实体缓存池或任务池搜索下载任务如果缓存池或任务池都没有任务则创建新任务
@ -87,7 +92,7 @@ public interface ITaskQueue<TASK extends ITask, TASK_ENTITY extends ITaskEntity,
* @param entity 工作实体{@link DownloadEntity}{@link UploadEntity} * @param entity 工作实体{@link DownloadEntity}{@link UploadEntity}
* @return {@link DownloadTask}{@link UploadTask} * @return {@link DownloadTask}{@link UploadTask}
*/ */
public TASK getTask(ENTITY entity); TASK getTask(ENTITY entity);
/** /**
* 通过工作实体缓存池或任务池搜索下载任务如果缓存池或任务池都没有任务则创建新任务 * 通过工作实体缓存池或任务池搜索下载任务如果缓存池或任务池都没有任务则创建新任务
@ -95,19 +100,19 @@ public interface ITaskQueue<TASK extends ITask, TASK_ENTITY extends ITaskEntity,
* @param url 链接地址如果是下载则为下载链接如果是上传为文件保存路径 * @param url 链接地址如果是下载则为下载链接如果是上传为文件保存路径
* @return {@link DownloadTask}{@link UploadTask} * @return {@link DownloadTask}{@link UploadTask}
*/ */
public TASK getTask(String url); TASK getTask(String url);
/** /**
* 通过工作实体删除任务 * 通过工作实体删除任务
* *
* @param entity 工作实体{@link DownloadEntity}{@link UploadEntity} * @param entity 工作实体{@link DownloadEntity}{@link UploadEntity}
*/ */
public void removeTask(ENTITY entity); void removeTask(ENTITY entity);
/** /**
* 获取缓存池的下一个任务 * 获取缓存池的下一个任务
* *
* @return 下载任务 or null * @return 下载任务 or null
*/ */
public TASK getNextTask(); TASK getNextTask();
} }

@ -18,7 +18,6 @@ package com.arialyy.aria.core.queue;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.arialyy.aria.core.download.DownloadTask;
import com.arialyy.aria.core.queue.pool.ExecutePool; import com.arialyy.aria.core.queue.pool.ExecutePool;
import com.arialyy.aria.core.scheduler.UploadSchedulers; import com.arialyy.aria.core.scheduler.UploadSchedulers;
import com.arialyy.aria.core.upload.UploadEntity; import com.arialyy.aria.core.upload.UploadEntity;
@ -44,45 +43,8 @@ public class UploadTaskQueue extends AbsTaskQueue<UploadTask, UploadTaskEntity,
return INSTANCE; return INSTANCE;
} }
@Override public void startTask(UploadTask task) {
if (mExecutePool.putTask(task)) {
mCachePool.removeTask(task);
//task.getEntity().setFailNum(0);
task.start();
}
}
@Override public void stopTask(UploadTask task) {
if (!task.isRunning()) Log.w(TAG, "停止任务失败,【任务已经停止】");
if (mExecutePool.removeTask(task)) {
task.stop();
} else {
task.stop();
Log.w(TAG, "停止任务失败,【任务已经停止】");
}
}
@Override public void cancelTask(UploadTask task) {
task.cancel();
}
@Override public void reTryStart(UploadTask task) {
if (task == null) {
Log.w(TAG, "重试下载失败,task 为null");
return;
}
if (!task.isRunning()) {
task.start();
} else {
Log.w(TAG, "任务没有完全停止,重试下载失败");
}
}
@Override public int size() {
return mExecutePool.size();
}
@Override public void setDownloadNum(int downloadNum) { @Override public void setMaxTaskNum(int newMaxNum) {
} }
@ -102,14 +64,6 @@ public class UploadTaskQueue extends AbsTaskQueue<UploadTask, UploadTaskEntity,
return getTask(entity.getFilePath()); return getTask(entity.getFilePath());
} }
@Override public UploadTask getTask(String url) {
UploadTask task = mExecutePool.getTask(url);
if (task == null) {
task = mCachePool.getTask(url);
}
return task;
}
@Override public void removeTask(UploadEntity entity) { @Override public void removeTask(UploadEntity entity) {
UploadTask task = mExecutePool.getTask(entity.getFilePath()); UploadTask task = mExecutePool.getTask(entity.getFilePath());
if (task != null) { if (task != null) {
@ -121,7 +75,4 @@ public class UploadTaskQueue extends AbsTaskQueue<UploadTask, UploadTaskEntity,
} }
} }
@Override public UploadTask getNextTask() {
return mCachePool.pollTask();
}
} }

@ -86,7 +86,7 @@ public class DownloadSchedulers implements ISchedulers<DownloadTask> {
case STOP: case STOP:
case CANCEL: case CANCEL:
mQueue.removeTask(entity); mQueue.removeTask(entity);
if (mQueue.size() < AriaManager.getInstance(AriaManager.APP) if (mQueue.executePoolSize() < AriaManager.getInstance(AriaManager.APP)
.getUploadConfig() .getUploadConfig()
.getMaxTaskNum()) { .getMaxTaskNum()) {
startNextTask(); startNextTask();

@ -171,7 +171,7 @@ public class UploadSchedulers implements ISchedulers<UploadTask> {
case STOP: case STOP:
case CANCEL: case CANCEL:
mQueue.removeTask(entity); mQueue.removeTask(entity);
if (mQueue.size() < AriaManager.getInstance(AriaManager.APP) if (mQueue.executePoolSize() < AriaManager.getInstance(AriaManager.APP)
.getUploadConfig() .getUploadConfig()
.getMaxTaskNum()) { .getMaxTaskNum()) {
startNextTask(); startNextTask();

@ -81,7 +81,7 @@ public class UploadEntity extends DbEntity implements IEntity, Parcelable {
return failNum; return failNum;
} }
public void setFailNum(int failNum) { @Override public void setFailNum(int failNum) {
this.failNum = failNum; this.failNum = failNum;
} }

@ -99,7 +99,7 @@ public class UploadTask implements ITask {
} }
//发送取消下载的广播 //发送取消下载的广播
Intent intent = CommonUtil.createIntent(AriaManager.APP.getPackageName(), Aria.ACTION_CANCEL); Intent intent = CommonUtil.createIntent(AriaManager.APP.getPackageName(), Aria.ACTION_CANCEL);
intent.putExtra(Aria.ENTITY, mUploadEntity); intent.putExtra(Aria.UPLOAD_ENTITY, mUploadEntity);
AriaManager.APP.sendBroadcast(intent); AriaManager.APP.sendBroadcast(intent);
} }
} }
@ -201,7 +201,7 @@ public class UploadTask implements ITask {
this.task = new WeakReference<>(task); this.task = new WeakReference<>(task);
uploadEntity = this.task.get().getUploadEntity(); uploadEntity = this.task.get().getUploadEntity();
sendIntent = CommonUtil.createIntent(AriaManager.APP.getPackageName(), Aria.ACTION_RUNNING); sendIntent = CommonUtil.createIntent(AriaManager.APP.getPackageName(), Aria.ACTION_RUNNING);
sendIntent.putExtra(Aria.ENTITY, uploadEntity); sendIntent.putExtra(Aria.UPLOAD_ENTITY, uploadEntity);
context = AriaManager.APP; context = AriaManager.APP;
final AriaManager manager = AriaManager.getInstance(context); final AriaManager manager = AriaManager.getInstance(context);
isOpenBroadCast = manager.getUploadConfig().isOpenBreadCast(); isOpenBroadCast = manager.getUploadConfig().isOpenBreadCast();
@ -301,7 +301,7 @@ public class UploadTask implements ITask {
uploadEntity.update(); uploadEntity.update();
if (!isOpenBroadCast) return; if (!isOpenBroadCast) return;
Intent intent = CommonUtil.createIntent(context.getPackageName(), action); Intent intent = CommonUtil.createIntent(context.getPackageName(), action);
intent.putExtra(Aria.ENTITY, uploadEntity); intent.putExtra(Aria.UPLOAD_ENTITY, uploadEntity);
if (location != -1) { if (location != -1) {
intent.putExtra(Aria.CURRENT_LOCATION, location); intent.putExtra(Aria.CURRENT_LOCATION, location);
} }

@ -6,7 +6,7 @@ private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override public void onReceive(Context context, Intent intent) { @Override public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();
//可以通过intent获取到下载实体,下载实体中包含了各种下载状态 //可以通过intent获取到下载实体,下载实体中包含了各种下载状态
DownloadEntity entity = intent.getParcelableExtra(Aria.ENTITY); DownloadEntity entity = intent.getParcelableExtra(Aria.DOWNLOAD_ENTITY);
switch (action) { switch (action) {
case Aria.ACTION_PRE: //预处理 case Aria.ACTION_PRE: //预处理
break; break;

@ -1,7 +1,7 @@
## 关于Aria,你还需要知道的一些东西 ## 关于Aria,你还需要知道的一些东西
- 设置下载任务数,Aria默认下载任务为**2** - 设置下载任务数,Aria默认下载任务为**2**
```java ```java
Aria.get(getContext()).setMaxDownloadNum(num); Aria.get(getContext()).setMaxDownloadNum(num);
``` ```
- 停止所有下载 - 停止所有下载

@ -25,7 +25,7 @@ Aria怎样使用?
## 下载 ## 下载
[![Download](https://api.bintray.com/packages/arialyy/maven/Aria/images/download.svg)](https://bintray.com/arialyy/maven/Aria/_latestVersion)</br> [![Download](https://api.bintray.com/packages/arialyy/maven/Aria/images/download.svg)](https://bintray.com/arialyy/maven/Aria/_latestVersion)</br>
```java ```java
compile 'com.arialyy.aria:Aria:3.1.1' compile 'com.arialyy.aria:Aria:3.1.2'
``` ```
## 示例 ## 示例
@ -266,6 +266,7 @@ Aria.download(this).removeAllTask();
## 开发日志 ## 开发日志
+ v_3.1.2 优化代码结构
+ v_3.1.0 添加Aria配置文件,优化代码 + v_3.1.0 添加Aria配置文件,优化代码
+ v_3.0.3 修复暂停后删除任务,闪退问题,添加删除记录的api + v_3.0.3 修复暂停后删除任务,闪退问题,添加删除记录的api
+ v_3.0.2 支持30x重定向链接下载 + v_3.0.2 支持30x重定向链接下载

@ -176,7 +176,7 @@ public class DownloadModule extends BaseModule {
String action = intent.getAction(); String action = intent.getAction();
switch (action) { switch (action) {
case Aria.ACTION_POST_PRE: case Aria.ACTION_POST_PRE:
DownloadEntity entity = intent.getParcelableExtra(Aria.ENTITY); DownloadEntity entity = intent.getParcelableExtra(Aria.DOWNLOAD_ENTITY);
len = entity.getFileSize(); len = entity.getFileSize();
L.d(TAG, "download pre"); L.d(TAG, "download pre");
handler.obtainMessage(SingleTaskActivity.DOWNLOAD_PRE, len).sendToTarget(); handler.obtainMessage(SingleTaskActivity.DOWNLOAD_PRE, len).sendToTarget();

Loading…
Cancel
Save