Fix jumping downloads in Download view
This commit is contained in:
parent
19d014709f
commit
7a2dbf65d9
|
@ -219,17 +219,15 @@ class TrackViewHolder(val view: View, var adapter: MultiTypeDiffAdapter<Identifi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun updateDownloadStatus(downloadFile: DownloadFile) {
|
fun updateDownloadStatus(downloadFile: DownloadFile) {
|
||||||
if (downloadFile.isWorkDone) {
|
if (downloadFile.isWorkDone) {
|
||||||
|
val saved = downloadFile.isSaved
|
||||||
val newLeftImageType =
|
val newLeftImageType =
|
||||||
if (downloadFile.isSaved) ImageType.Pin else ImageType.Downloaded
|
if (saved) ImageType.Pin else ImageType.Downloaded
|
||||||
|
|
||||||
if (leftImageType != newLeftImageType) {
|
if (leftImageType != newLeftImageType) {
|
||||||
leftImage = if (downloadFile.isSaved) {
|
leftImage = if (saved) imageHelper.pinImage else imageHelper.downloadedImage
|
||||||
imageHelper.pinImage
|
|
||||||
} else {
|
|
||||||
imageHelper.downloadedImage
|
|
||||||
}
|
|
||||||
leftImageType = newLeftImageType
|
leftImageType = newLeftImageType
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -381,9 +381,8 @@ class Downloader(
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun downloadBackground(songs: List<MusicDirectory.Entry>, save: Boolean) {
|
fun downloadBackground(songs: List<MusicDirectory.Entry>, save: Boolean) {
|
||||||
|
|
||||||
// Because of the priority handling we add the songs in the reverse order they
|
// By using the counter we ensure that the songs are added in the correct order
|
||||||
// were requested, then it is correct in the end.
|
for (song in songs) {
|
||||||
for (song in songs.asReversed()) {
|
|
||||||
val file = song.getDownloadFile()
|
val file = song.getDownloadFile()
|
||||||
file.shouldSave = save
|
file.shouldSave = save
|
||||||
file.priority = backgroundPriorityCounter++
|
file.priority = backgroundPriorityCounter++
|
||||||
|
|
Loading…
Reference in New Issue