From 41ebf1405b5bb878dab101de33eb7df43055b81d Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 22 Jul 2026 21:11:32 -0400 Subject: [PATCH] =?UTF-8?q?fix(player):=20open=20Android=20queue=20scrolle?= =?UTF-8?q?d=20to=20now-playing=20track=20=E2=80=94=20#1929?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QueueList used a plain LazyColumn with no hoisted state, so the queue always opened at the top and the current track could be off-screen. Seed a rememberLazyListState with the current index (coerced into bounds) so the list renders already positioned on the now-playing row — no post-layout scroll flash. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../com/fabledsword/minstrel/player/ui/QueueScreen.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/fabledsword/minstrel/player/ui/QueueScreen.kt b/android/app/src/main/java/com/fabledsword/minstrel/player/ui/QueueScreen.kt index 683c430e..38d1b365 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/player/ui/QueueScreen.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/player/ui/QueueScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon @@ -86,7 +87,14 @@ private fun QueueList( onJumpTo: (Int) -> Unit, onToggleLike: (String) -> Unit, ) { - LazyColumn(modifier = Modifier.fillMaxSize()) { + // Open scrolled to the now-playing track so it's in view immediately. + // Seeding the initial index (rather than animating post-layout) avoids a + // flash of the list top; it's captured once per entry, so the view stays + // put as the track later auto-advances — matching "show me where I am now." + val listState = rememberLazyListState( + initialFirstVisibleItemIndex = currentIndex.coerceIn(0, tracks.lastIndex), + ) + LazyColumn(state = listState, modifier = Modifier.fillMaxSize()) { itemsIndexed(items = tracks, key = { _, track -> track.id }) { index, track -> QueueRow( track = track,