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) {
|
||||
if (downloadFile.isWorkDone) {
|
||||
val saved = downloadFile.isSaved
|
||||
val newLeftImageType =
|
||||
if (downloadFile.isSaved) ImageType.Pin else ImageType.Downloaded
|
||||
if (saved) ImageType.Pin else ImageType.Downloaded
|
||||
|
||||
if (leftImageType != newLeftImageType) {
|
||||
leftImage = if (downloadFile.isSaved) {
|
||||
imageHelper.pinImage
|
||||
} else {
|
||||
imageHelper.downloadedImage
|
||||
}
|
||||
leftImage = if (saved) imageHelper.pinImage else imageHelper.downloadedImage
|
||||
leftImageType = newLeftImageType
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -381,9 +381,8 @@ class Downloader(
|
|||
@Synchronized
|
||||
fun downloadBackground(songs: List<MusicDirectory.Entry>, save: Boolean) {
|
||||
|
||||
// Because of the priority handling we add the songs in the reverse order they
|
||||
// were requested, then it is correct in the end.
|
||||
for (song in songs.asReversed()) {
|
||||
// By using the counter we ensure that the songs are added in the correct order
|
||||
for (song in songs) {
|
||||
val file = song.getDownloadFile()
|
||||
file.shouldSave = save
|
||||
file.priority = backgroundPriorityCounter++
|
||||
|
|
Loading…
Reference in New Issue