diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/views/CurrentPlaylistView.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/views/CurrentPlaylistView.kt index eab9fd2..dd30360 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/views/CurrentPlaylistView.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/views/CurrentPlaylistView.kt @@ -59,6 +59,7 @@ import it.vfsfitvnm.vimusic.utils.rememberMediaItemIndex import it.vfsfitvnm.vimusic.utils.rememberShouldBePlaying import it.vfsfitvnm.vimusic.utils.rememberWindows import it.vfsfitvnm.vimusic.utils.shuffleQueue +import kotlinx.coroutines.launch @ExperimentalFoundationApi @ExperimentalAnimationApi @@ -251,7 +252,13 @@ fun CurrentPlaylistView( colorFilter = ColorFilter.tint(colorPalette.text), modifier = Modifier .padding(end = 2.dp) - .clickable(onClick = binder.player::shuffleQueue) + .clickable { + reorderingState.coroutineScope.launch { + reorderingState.lazyListState.animateScrollToItem(0) + }.invokeOnCompletion { + binder.player.shuffleQueue() + } + } .align(Alignment.CenterEnd) .padding(all = 8.dp) .size(20.dp) diff --git a/compose-reordering/src/main/kotlin/it/vfsfitvnm/reordering/ReorderingState.kt b/compose-reordering/src/main/kotlin/it/vfsfitvnm/reordering/ReorderingState.kt index 23c4a6b..67d6208 100644 --- a/compose-reordering/src/main/kotlin/it/vfsfitvnm/reordering/ReorderingState.kt +++ b/compose-reordering/src/main/kotlin/it/vfsfitvnm/reordering/ReorderingState.kt @@ -28,7 +28,7 @@ import kotlinx.coroutines.withContext @Stable class ReorderingState( val lazyListState: LazyListState, - internal val coroutineScope: CoroutineScope, + val coroutineScope: CoroutineScope, private val lastIndex: Int, internal val onDragStart: () -> Unit, internal val onDragEnd: (Int, Int) -> Unit,