queue: do not scroll to next-up range

Do not scroll to the current index + 1 (i.e the next up range) when the
index signifigantly changees.

RecyclerView quirks result in a mix of next-up and next-up + playing
item scrolling, just unify it under the latter.
This commit is contained in:
OxygenCobalt 2022-08-09 09:11:17 -06:00
parent 83d1e4eae4
commit deffe065d5
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -18,7 +18,6 @@
package org.oxycblt.auxio.playback.queue
import androidx.lifecycle.ViewModel
import kotlin.math.min
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import org.oxycblt.auxio.music.MusicParent
@ -88,7 +87,7 @@ class QueueViewModel : ViewModel(), PlaybackStateManager.Callback {
override fun onIndexMoved(index: Int) {
replaceQueue = null
scrollTo = min(index + 1, playbackManager.queue.lastIndex)
scrollTo = index
_index.value = index
}
@ -100,14 +99,14 @@ class QueueViewModel : ViewModel(), PlaybackStateManager.Callback {
override fun onQueueReworked(index: Int, queue: List<Song>) {
replaceQueue = true
scrollTo = min(index + 1, playbackManager.queue.lastIndex)
scrollTo = index
_queue.value = playbackManager.queue.toMutableList()
_index.value = index
}
override fun onNewPlayback(index: Int, queue: List<Song>, parent: MusicParent?) {
replaceQueue = true
scrollTo = min(index + 1, playbackManager.queue.lastIndex)
scrollTo = index
_queue.value = playbackManager.queue.toMutableList()
_index.value = index
}