Fix DownloadService.startRangeDownload(IntList)
This commit is contained in:
1 parent
41590fcdeb
commit
efdb488781
1 file changed
+23
-5
@@ -299,7 +299,9 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (info.state != DownloadInfo.STATE_WAIT) {
|
||||
if (info.state == DownloadInfo.STATE_NONE ||
|
||||
info.state == DownloadInfo.STATE_FAILED ||
|
||||
info.state == DownloadInfo.STATE_FINISH) {
|
||||
update = true;
|
||||
// Set state DownloadInfo.STATE_WAIT
|
||||
info.state = DownloadInfo.STATE_WAIT;
|
||||
@@ -323,6 +325,7 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
void startAllDownload() {
|
||||
boolean update = false;
|
||||
// Start all STATE_NONE and STATE_FAILED item
|
||||
// TODO keep order in wait list
|
||||
SparseArray<DownloadInfo> allInfoMap = mAllInfoMap;
|
||||
List<DownloadInfo> waitList = mWaitList;
|
||||
for (int i = 0, n = allInfoMap.size(); i < n; i++) {
|
||||
@@ -873,7 +876,7 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
}
|
||||
}
|
||||
|
||||
private static Comparator<DownloadInfo> sDateAscComparator = new Comparator<DownloadInfo>() {
|
||||
private static final Comparator<DownloadInfo> sDateAscComparator = new Comparator<DownloadInfo>() {
|
||||
@Override
|
||||
public int compare(DownloadInfo lhs, DownloadInfo rhs) {
|
||||
return lhs.date - rhs.date > 0 ? 1 : -1;
|
||||
@@ -882,15 +885,30 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
|
||||
public interface DownloadInfoListener {
|
||||
|
||||
void onAdd(DownloadInfo info, List<DownloadInfo> list, int position);
|
||||
/**
|
||||
* Add the special info to the special position
|
||||
*/
|
||||
void onAdd(@NonNull DownloadInfo info, @NonNull List<DownloadInfo> list, int position);
|
||||
|
||||
void onUpdate(DownloadInfo info, List<DownloadInfo> list);
|
||||
/**
|
||||
* The special info is changed
|
||||
*/
|
||||
void onUpdate(@NonNull DownloadInfo info, @NonNull List<DownloadInfo> list);
|
||||
|
||||
/**
|
||||
* Maybe all data is changed, but size is the same
|
||||
*/
|
||||
void onUpdateAll();
|
||||
|
||||
/**
|
||||
* Maybe all data is changed, maybe size is changed
|
||||
*/
|
||||
void onReload();
|
||||
|
||||
void onRemove(DownloadInfo info, List<DownloadInfo> list, int position);
|
||||
/**
|
||||
* Remove the special info from the special position
|
||||
*/
|
||||
void onRemove(@NonNull DownloadInfo info, @NonNull List<DownloadInfo> list, int position);
|
||||
|
||||
void onUpdateLabels();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user