From 60acdbeae3a03b467b097031ca97757861b41dd1 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Fri, 25 Sep 2026 07:53:41 +0000 Subject: [PATCH] theme the pull-to-refresh indicator from the artwork and stop the library reflow on search - the indicator now uses the artwork primary and player surface instead of the default onSurfaceVariant - keep the tab bar height in the list inset while searching so the content does not expand for a frame before the keyboard lands --- .../com/subtracks/ui/library/LibraryScreen.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/subtracks/ui/library/LibraryScreen.kt b/app/src/main/kotlin/com/subtracks/ui/library/LibraryScreen.kt index a63086da..1b2323dd 100644 --- a/app/src/main/kotlin/com/subtracks/ui/library/LibraryScreen.kt +++ b/app/src/main/kotlin/com/subtracks/ui/library/LibraryScreen.kt @@ -54,6 +54,8 @@ import androidx.compose.material3.TextField import androidx.compose.material3.TextFieldDefaults import androidx.compose.material3.minimumInteractiveComponentSize import androidx.compose.material3.pulltorefresh.PullToRefreshBox +import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults +import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -309,7 +311,7 @@ fun LibraryScreen( var tabBarHeightPx by remember { mutableFloatStateOf(0f) } val tabBarHeight = with(density) { tabBarHeightPx.toDp() } val listTopInset = statusBarTop - val listBottomInset = if (searchActive) SEARCH_BAR_CLEARANCE else tabBarHeight + FAB_CLEARANCE + val listBottomInset = tabBarHeight + if (searchActive) SEARCH_BAR_CLEARANCE else FAB_CLEARANCE val headerColor = artwork?.let(::playerSurfaceColor) ?: MaterialTheme.colorScheme.background Box( @@ -324,9 +326,20 @@ fun LibraryScreen( ) { page -> val pageTab = LibraryTab.entries[page] val resetKey = resetKeys[pageTab] + val pullToRefreshState = rememberPullToRefreshState() PullToRefreshBox( isRefreshing = syncing, onRefresh = onSync, + state = pullToRefreshState, + indicator = { + PullToRefreshDefaults.Indicator( + state = pullToRefreshState, + isRefreshing = syncing, + modifier = Modifier.align(Alignment.TopCenter), + containerColor = headerColor, + color = artwork?.scheme?.primary ?: MaterialTheme.colorScheme.primary, + ) + }, modifier = Modifier.fillMaxSize(), ) { when (pageTab) {