DownloadEntry修改为DownloadEntity
This commit is contained in:
@ -15,7 +15,7 @@ import java.util.Map.Entry;
|
||||
|
||||
public class DownloadTask implements DownloadListener {
|
||||
|
||||
private DownloadEntry entry;
|
||||
private DownloadEntity entry;
|
||||
private Handler handler;
|
||||
private Context context;
|
||||
private DownloadThread downloadThread;
|
||||
@ -28,14 +28,14 @@ public class DownloadTask implements DownloadListener {
|
||||
private long lastTime;
|
||||
private long intervalDownloadedSize;
|
||||
|
||||
public DownloadTask(Handler handler, final DownloadEntry entry,
|
||||
public DownloadTask(Handler handler, final DownloadEntity entry,
|
||||
Context context) {
|
||||
|
||||
this.entry = entry;
|
||||
this.handler = handler;
|
||||
|
||||
this.context = context;
|
||||
DownloadEntry historyEntry = DownloadDao.getInstance(context).get(
|
||||
DownloadEntity historyEntry = DownloadDao.getInstance(context).get(
|
||||
entry.getUrl());
|
||||
if (historyEntry != null && historyEntry.getSize() != 0) {
|
||||
// 历史下载任务,初始化数据
|
||||
@ -53,10 +53,10 @@ public class DownloadTask implements DownloadListener {
|
||||
|
||||
public void start() {
|
||||
// 从下载历史里获取过去下载的进度信息
|
||||
DownloadEntry downloadEntry = DownloadDao.getInstance(context).get(entry.getUrl());
|
||||
DownloadEntity downloadEntity = DownloadDao.getInstance(context).get(entry.getUrl());
|
||||
|
||||
if (downloadEntry != null) {
|
||||
entry = downloadEntry;
|
||||
if (downloadEntity != null) {
|
||||
entry = downloadEntity;
|
||||
entry.setStatus(DownloadStatus.downloading);
|
||||
Utils.log(DownloadTask.class.getSimpleName(),
|
||||
"start==>" + "load from history:" + entry.getUrl()
|
||||
@ -150,7 +150,7 @@ public class DownloadTask implements DownloadListener {
|
||||
}
|
||||
iterator.remove();
|
||||
}
|
||||
for (Entry<String, DownloadEntry> entry : DataChanger.getInstance()
|
||||
for (Entry<String, DownloadEntity> entry : DataChanger.getInstance()
|
||||
.getDownloadEntries().entrySet()) {
|
||||
DataChanger.getInstance().pauseDownloadEntries(entry.getKey());
|
||||
DownloadDao.getInstance(context).newOrUpdate(entry.getValue());
|
||||
|
||||
Reference in New Issue
Block a user