url添加Timestamp逻辑修改

This commit is contained in:
huangzhuanghua
2016-09-28 18:47:14 +08:00
parent 6546b580e9
commit 09a0eabc48
30 changed files with 181 additions and 179 deletions

View File

@ -190,7 +190,10 @@ public class DownloadManager {
if (downloadEntity != null) {
String url = downloadEntity.getUrl();
checkDownloadEntryRecordValidate(url);
if (!isFileCompleted(url) && !isTaskDownloading(url)) {
if (isFileCompleted(url)) {
downloadEntity.setStatus(DownloadStatus.done);
DataChanger.getInstance().notifyDataChanged(downloadEntity);
} else if (!isTaskDownloading(url)) {
context.startService(getIntent(downloadEntity, DownloadStatus.add));
}
}
@ -263,7 +266,10 @@ public class DownloadManager {
add(entry);
} else {
if (entry != null) {
if (!isFileCompleted(url) && !isTaskDownloading(url)) {
if (isFileCompleted(url)) {
entry.setStatus(DownloadStatus.done);
DataChanger.getInstance().notifyDataChanged(entry);
} else if (!isTaskDownloading(url)) {
context.startService(getIntent(entry, DownloadStatus.resume));
}
}
@ -290,6 +296,7 @@ public class DownloadManager {
Utils.log(DownloadManager.class.getSimpleName(), "cancle==>file and record were deleted!");
}
if (entry != null) {
entry.setStatus(DownloadStatus.cancel);
context.startService(getIntent(entry, DownloadStatus.cancel));
Utils.log(DownloadManager.class.getSimpleName(), "cancel");
}