45 lines
1.6 KiB
Java
45 lines
1.6 KiB
Java
package com.ubt.jimu.base.download;
|
|
|
|
import com.liulishuo.filedownloader.BaseDownloadTask;
|
|
import com.liulishuo.filedownloader.FileDownloadListener;
|
|
import com.liulishuo.filedownloader.FileDownloadQueueSet;
|
|
import com.liulishuo.filedownloader.FileDownloader;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DownloadTask {
|
|
private FileDownloadListener fileDownloadListener;
|
|
private FileDownloadQueueSet queueSet;
|
|
|
|
public DownloadTask(List<DownloadInfo> list, IJimuFileDownloadListener iJimuFileDownloadListener) {
|
|
this(list, false, iJimuFileDownloadListener);
|
|
}
|
|
|
|
public void pause() {
|
|
if (this.queueSet != null) {
|
|
FileDownloader.e().a(this.fileDownloadListener);
|
|
}
|
|
}
|
|
|
|
public void start() {
|
|
this.queueSet.a();
|
|
}
|
|
|
|
public DownloadTask(List<DownloadInfo> list, boolean z, IJimuFileDownloadListener iJimuFileDownloadListener) {
|
|
ArrayList arrayList = new ArrayList();
|
|
for (DownloadInfo downloadInfo : list) {
|
|
BaseDownloadTask a = FileDownloader.e().a(downloadInfo.getUrl());
|
|
a.a(downloadInfo.getSavePath(), false);
|
|
a.a(Integer.valueOf(downloadInfo.getType()));
|
|
a.a(z);
|
|
a.c(3);
|
|
a.a("Accept-Encoding", "identity");
|
|
arrayList.add(a);
|
|
}
|
|
this.fileDownloadListener = new MyFileDownloadListener(arrayList.size(), iJimuFileDownloadListener);
|
|
this.queueSet = new FileDownloadQueueSet(this.fileDownloadListener);
|
|
this.queueSet.a(arrayList);
|
|
}
|
|
}
|