This commit is contained in:
AriaLyy
2017-06-09 20:45:29 +08:00
parent 07b3954585
commit b95ab29466
3 changed files with 12 additions and 8 deletions

View File

@ -133,17 +133,19 @@ public class DownloadTask extends AbsTask<DownloadTaskEntity, DownloadEntity> {
*/
@Override public void cancel() {
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.delConfigFile();
mUtil.delTempFile();
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);
}
}