This commit is contained in:
@ -133,17 +133,19 @@ public class DownloadTask extends AbsTask<DownloadTaskEntity, DownloadEntity> {
|
|||||||
*/
|
*/
|
||||||
@Override public void cancel() {
|
@Override public void cancel() {
|
||||||
if (!mEntity.isDownloadComplete()) {
|
if (!mEntity.isDownloadComplete()) {
|
||||||
|
if (!mUtil.isDownloading()) {
|
||||||
|
if (mOutHandler != null) {
|
||||||
|
mOutHandler.obtainMessage(DownloadSchedulers.CANCEL, this).sendToTarget();
|
||||||
|
}
|
||||||
|
//发送取消下载的广播
|
||||||
|
Intent intent = CommonUtil.createIntent(mContext.getPackageName(), Aria.ACTION_CANCEL);
|
||||||
|
intent.putExtra(Aria.DOWNLOAD_ENTITY, mEntity);
|
||||||
|
mContext.sendBroadcast(intent);
|
||||||
|
}
|
||||||
mUtil.cancelDownload();
|
mUtil.cancelDownload();
|
||||||
mUtil.delConfigFile();
|
mUtil.delConfigFile();
|
||||||
mUtil.delTempFile();
|
mUtil.delTempFile();
|
||||||
mEntity.deleteData();
|
mEntity.deleteData();
|
||||||
if (mOutHandler != null) {
|
|
||||||
mOutHandler.obtainMessage(DownloadSchedulers.CANCEL, this).sendToTarget();
|
|
||||||
}
|
|
||||||
//发送取消下载的广播
|
|
||||||
Intent intent = CommonUtil.createIntent(mContext.getPackageName(), Aria.ACTION_CANCEL);
|
|
||||||
intent.putExtra(Aria.DOWNLOAD_ENTITY, mEntity);
|
|
||||||
mContext.sendBroadcast(intent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ Aria怎样使用?
|
|||||||
## 下载
|
## 下载
|
||||||
[](https://bintray.com/arialyy/maven/Aria/_latestVersion)</br>
|
[](https://bintray.com/arialyy/maven/Aria/_latestVersion)</br>
|
||||||
```java
|
```java
|
||||||
compile 'com.arialyy.aria:Aria:3.1.5'
|
compile 'com.arialyy.aria:Aria:3.1.6'
|
||||||
```
|
```
|
||||||
|
|
||||||
## 示例
|
## 示例
|
||||||
@ -277,6 +277,7 @@ Aria.download(this).load(DOWNLOAD_URL).setDownloadPath(PATH).setHighestPriority(
|
|||||||
|
|
||||||
|
|
||||||
## 开发日志
|
## 开发日志
|
||||||
|
+ v_3.1.6 [取消任务时onTaskCancel回调两次的bug](https://github.com/AriaLyy/Aria/issues/33)
|
||||||
+ v_3.1.5 优化代码结构,增加优先下载任务功能。
|
+ v_3.1.5 优化代码结构,增加优先下载任务功能。
|
||||||
+ v_3.1.4 修复快速切换,暂停、恢复功能时,概率性出现的重新下载问题,添加onPre()回调,onPre()用于请求地址之前执行界面UI更新操作。
|
+ v_3.1.4 修复快速切换,暂停、恢复功能时,概率性出现的重新下载问题,添加onPre()回调,onPre()用于请求地址之前执行界面UI更新操作。
|
||||||
+ v_3.1.0 添加Aria配置文件,优化代码
|
+ v_3.1.0 添加Aria配置文件,优化代码
|
||||||
|
@ -241,6 +241,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
|||||||
@Override public void onTaskCancel(DownloadTask task) {
|
@Override public void onTaskCancel(DownloadTask task) {
|
||||||
if (task.getKey().equals(DOWNLOAD_URL)) {
|
if (task.getKey().equals(DOWNLOAD_URL)) {
|
||||||
mUpdateHandler.sendEmptyMessage(DOWNLOAD_CANCEL);
|
mUpdateHandler.sendEmptyMessage(DOWNLOAD_CANCEL);
|
||||||
|
L.d(TAG, "task__cancel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user