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:
parent
83d1e4eae4
commit
deffe065d5
1 changed files with 3 additions and 4 deletions
|
@ -18,7 +18,6 @@
|
||||||
package org.oxycblt.auxio.playback.queue
|
package org.oxycblt.auxio.playback.queue
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import kotlin.math.min
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import org.oxycblt.auxio.music.MusicParent
|
import org.oxycblt.auxio.music.MusicParent
|
||||||
|
@ -88,7 +87,7 @@ class QueueViewModel : ViewModel(), PlaybackStateManager.Callback {
|
||||||
|
|
||||||
override fun onIndexMoved(index: Int) {
|
override fun onIndexMoved(index: Int) {
|
||||||
replaceQueue = null
|
replaceQueue = null
|
||||||
scrollTo = min(index + 1, playbackManager.queue.lastIndex)
|
scrollTo = index
|
||||||
_index.value = index
|
_index.value = index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,14 +99,14 @@ class QueueViewModel : ViewModel(), PlaybackStateManager.Callback {
|
||||||
|
|
||||||
override fun onQueueReworked(index: Int, queue: List<Song>) {
|
override fun onQueueReworked(index: Int, queue: List<Song>) {
|
||||||
replaceQueue = true
|
replaceQueue = true
|
||||||
scrollTo = min(index + 1, playbackManager.queue.lastIndex)
|
scrollTo = index
|
||||||
_queue.value = playbackManager.queue.toMutableList()
|
_queue.value = playbackManager.queue.toMutableList()
|
||||||
_index.value = index
|
_index.value = index
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewPlayback(index: Int, queue: List<Song>, parent: MusicParent?) {
|
override fun onNewPlayback(index: Int, queue: List<Song>, parent: MusicParent?) {
|
||||||
replaceQueue = true
|
replaceQueue = true
|
||||||
scrollTo = min(index + 1, playbackManager.queue.lastIndex)
|
scrollTo = index
|
||||||
_queue.value = playbackManager.queue.toMutableList()
|
_queue.value = playbackManager.queue.toMutableList()
|
||||||
_index.value = index
|
_index.value = index
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue