This commit is contained in:
huangzhuanghua
2016-05-25 14:36:47 +08:00
parent 547f27f19b
commit 8a5a099151
2 changed files with 6 additions and 14 deletions

View File

@ -53,8 +53,7 @@ public class DownloadTask implements DownloadListener {
public void start() {
// 从下载历史里获取过去下载的进度信息
DownloadEntry downloadEntry = null;
downloadEntry = DownloadDao.getInstance(context).get(entry.getUrl());
DownloadEntry downloadEntry = DownloadDao.getInstance(context).get(entry.getUrl());
if (downloadEntry != null) {
entry = downloadEntry;
@ -68,7 +67,6 @@ public class DownloadTask implements DownloadListener {
} else {
Trace.getInstance().debug(DownloadTask.class.getSimpleName(),
"start==>" + "First log into history!");
}
downloadThread = new DownloadThread(context, this.entry, this);
@ -144,7 +142,7 @@ public class DownloadTask implements DownloadListener {
|| status == DownloadStatus.neterror) {
HashMap<String, DownloadTask> map = DataChanger.getInstance().getDownloadingTasks();
Iterator<String> iterator = map.keySet().iterator();
String key = null;
String key;
while (iterator.hasNext()) {
key = iterator.next();
DownloadTask task = map.get(key);
@ -173,13 +171,11 @@ public class DownloadTask implements DownloadListener {
}
public void cancel() {
downloadThread.cancle();
downloadThread.setStatus(DownloadStatus.cancel);
}
public void pause() {
downloadThread.pause();
downloadThread.setStatus(DownloadStatus.pause);
}
// check download progress