diff --git a/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueViewModel.kt b/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueViewModel.kt index 2141a47bd..5c5e5d8d3 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueViewModel.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueViewModel.kt @@ -24,7 +24,6 @@ import org.oxycblt.auxio.music.MusicParent import org.oxycblt.auxio.music.Song import org.oxycblt.auxio.playback.state.PlaybackStateManager import org.oxycblt.auxio.playback.state.Queue -import org.oxycblt.auxio.util.logD /** * A [ViewModel] that manages the current queue state and allows navigation through the queue. diff --git a/app/src/main/java/org/oxycblt/auxio/playback/state/Queue.kt b/app/src/main/java/org/oxycblt/auxio/playback/state/Queue.kt index 0c1551b9c..333d5e189 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/state/Queue.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/state/Queue.kt @@ -170,6 +170,7 @@ class Queue { * mutated. */ fun move(src: Int, dst: Int): ChangeResult { + if (shuffledMapping.isNotEmpty()) { // Move songs only in the shuffled mapping. There is no sane analogous form of // this for the ordered mapping. @@ -179,19 +180,16 @@ class Queue { orderedMapping.add(dst, orderedMapping.removeAt(src)) } + // TODO: I really need to figure out how to get non-swap moves working. return when (index) { - // Moving the currently playing song. src -> { index = dst ChangeResult.INDEX } - // Index was ahead of moved song but not ahead of it's destination position. - // This makes it functionally a removal, so update the index to preserve consistency. - in (src + 1)..dst -> { - index -= 1 + dst -> { + index = src ChangeResult.INDEX } - // Nothing to do. else -> ChangeResult.MAPPING } }