Skip to content

Commit

Permalink
修复WiFi迁移下载列表,在迁移后下载列表乱序的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojieonly committed Sep 25, 2024
1 parent f42d15f commit 86e0b99
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/src/main/java/com/hippo/ehviewer/download/DownloadManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ public void addDownloadLabel(List<DownloadLabel> downloadLabelList) {
}
}

public void addDownload(GalleryInfo galleryInfo, @Nullable String label,int state) {
public void addDownload(GalleryInfo galleryInfo, @Nullable String label, int state) {
if (containDownloadInfo(galleryInfo.gid)) {
// Contain
return;
Expand All @@ -563,11 +563,11 @@ public void addDownload(GalleryInfo galleryInfo, @Nullable String label,int stat

// Add to label download list
LinkedList<DownloadInfo> list = getInfoListForLabel(info.label);
if (!mLabelCountMap.containsKey(label)){
mLabelCountMap.put(label,1L);
}else {
long value = mLabelCountMap.get(label)+1L;
mLabelCountMap.put(label,value);
if (!mLabelCountMap.containsKey(label)) {
mLabelCountMap.put(label, 1L);
} else {
long value = mLabelCountMap.get(label) + 1L;
mLabelCountMap.put(label, value);
}
if (list == null) {
Log.e(TAG, "Can't find download info list with label: " + label);
Expand All @@ -589,7 +589,7 @@ public void addDownload(GalleryInfo galleryInfo, @Nullable String label,int stat
}

public void addDownload(GalleryInfo galleryInfo, @Nullable String label) {
addDownload(galleryInfo,label,DownloadInfo.STATE_NONE);
addDownload(galleryInfo, label, DownloadInfo.STATE_NONE);
}

public void addDownloadInfo(GalleryInfo galleryInfo, @Nullable String label) {
Expand All @@ -602,7 +602,9 @@ public void addDownloadInfo(GalleryInfo galleryInfo, @Nullable String label) {
DownloadInfo info = new DownloadInfo(galleryInfo);
info.label = label;
info.state = DownloadInfo.STATE_NONE;
info.time = System.currentTimeMillis();
if (info.time == 0) {
info.time = System.currentTimeMillis();
}

// Add to label download list
LinkedList<DownloadInfo> list = getInfoListForLabel(info.label);
Expand Down

0 comments on commit 86e0b99

Please sign in to comment.