From 7a2dbf65d92d9525c633cfe8ae8c018b4eaa3b8b Mon Sep 17 00:00:00 2001 From: tzugen Date: Sun, 14 Nov 2021 23:31:01 +0100 Subject: [PATCH] Fix jumping downloads in Download view --- .../org/moire/ultrasonic/adapters/TrackViewHolder.kt | 10 ++++------ .../kotlin/org/moire/ultrasonic/service/Downloader.kt | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/adapters/TrackViewHolder.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/adapters/TrackViewHolder.kt index 7b8356ec..a7547b46 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/adapters/TrackViewHolder.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/adapters/TrackViewHolder.kt @@ -219,17 +219,15 @@ class TrackViewHolder(val view: View, var adapter: MultiTypeDiffAdapter, 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++