From efd7518fc3544e25f0f32208bda150b91d3effaa Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Fri, 25 Sep 2026 04:55:37 +0000 Subject: [PATCH] merge the settings into the tab bar and add a status bar scrim --- .../com/subtracks/ui/library/LibraryScreen.kt | 130 +++++++++--------- 1 file changed, 66 insertions(+), 64 deletions(-) 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 1bea4603..6469d4d0 100644 --- a/app/src/main/kotlin/com/subtracks/ui/library/LibraryScreen.kt +++ b/app/src/main/kotlin/com/subtracks/ui/library/LibraryScreen.kt @@ -84,6 +84,7 @@ import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.Size +import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.ClipOp import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Path @@ -388,6 +389,19 @@ fun LibraryScreen( } } + Spacer( + modifier = + Modifier + .align(Alignment.TopStart) + .fillMaxWidth() + .height(statusBarTop + 8.dp) + .background( + Brush.verticalGradient( + listOf(Color.Black.copy(alpha = 0.55f), Color.Transparent), + ), + ), + ) + Column( modifier = Modifier @@ -670,76 +684,64 @@ private fun LibraryTabs( val indicatorColor = artwork?.scheme?.primary ?: MaterialTheme.colorScheme.onBackground Box(Modifier.fillMaxWidth()) { - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(4.dp), + Box( + modifier = + Modifier + .fillMaxWidth() + .background(headerColor) + .padding(6.dp), ) { Box( modifier = - Modifier - .clip(RoundedCornerShape(topEnd = 8.dp, bottomEnd = 8.dp)) - .background(headerColor) - .padding(6.dp), - ) { - Box( - modifier = - Modifier.drawBehind { - if (current != null && indicatorLeft != null && indicatorRight != null) { - drawRoundRect( - color = indicatorColor, - topLeft = Offset(indicatorLeft, current.top), - size = Size(indicatorRight - indicatorLeft, current.height), - cornerRadius = CornerRadius(8.dp.toPx()), - ) - } - }, - ) { - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(4.dp), - ) { - LibraryTab.entries.forEachIndexed { index, tab -> - TabButton( - tab = tab, - artwork = artwork, - progress = - when (index) { - page -> 1f - transition - page + (if (fraction >= 0f) 1 else -1) -> transition - else -> 0f - }, - indicatorLeft = indicatorLeft, - indicatorRight = indicatorRight, - onClick = { onTabSelected(tab) }, - modifier = - Modifier.onGloballyPositioned { coordinates -> - bounds[index] = coordinates.boundsInParent() - }, + Modifier.drawBehind { + if (current != null && indicatorLeft != null && indicatorRight != null) { + drawRoundRect( + color = indicatorColor, + topLeft = Offset(indicatorLeft, current.top), + size = Size(indicatorRight - indicatorLeft, current.height), + cornerRadius = CornerRadius(8.dp.toPx()), ) } - } - } - } - Spacer(Modifier.weight(1f)) - if (syncing) { - CircularProgressIndicator( - modifier = Modifier.padding(end = 4.dp).size(20.dp), - strokeWidth = 2.dp, - ) - } - Box( - modifier = - Modifier - .clip(RoundedCornerShape(topStart = 8.dp, bottomStart = 8.dp)) - .background(headerColor), + }, ) { - IconButton(onClick = onOpenSettings) { - Icon( - imageVector = Icons.Rounded.Settings, - contentDescription = "Settings", - tint = MaterialTheme.colorScheme.onBackground, - ) + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(4.dp), + ) { + LibraryTab.entries.forEachIndexed { index, tab -> + TabButton( + tab = tab, + artwork = artwork, + progress = + when (index) { + page -> 1f - transition + page + (if (fraction >= 0f) 1 else -1) -> transition + else -> 0f + }, + indicatorLeft = indicatorLeft, + indicatorRight = indicatorRight, + onClick = { onTabSelected(tab) }, + modifier = + Modifier.onGloballyPositioned { coordinates -> + bounds[index] = coordinates.boundsInParent() + }, + ) + } + Spacer(Modifier.weight(1f)) + if (syncing) { + CircularProgressIndicator( + modifier = Modifier.padding(end = 4.dp).size(20.dp), + strokeWidth = 2.dp, + ) + } + IconButton(onClick = onOpenSettings) { + Icon( + imageVector = Icons.Rounded.Settings, + contentDescription = "Settings", + tint = MaterialTheme.colorScheme.onBackground, + ) + } } } }