fix(ui): the portrait bottom bar follows the sidebar labels setting (#2558)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-13 07:31:18 -05:00
1 parent 83de0e7f8c
commit c57cc33125
2 files changed
+19 -1

No files matched your search

@@ -105,13 +105,16 @@ internal fun BottomBar(
val bounds = remember { androidx.compose.runtime.mutableStateMapOf<String, androidx.compose.ui.geometry.Rect>() }
val tint = androidx.compose.runtime.rememberUpdatedState(LocalPalette.current.signal)
val content = remember { arrayOfNulls<LayoutCoordinates>(1) }
val barContext = LocalContext.current
remember { RailLabels.load(barContext) }
val iconOnly = !RailLabels.shown
Row(modifier.fillMaxWidth().background(MaterialTheme.colorScheme.surface), verticalAlignment = Alignment.CenterVertically) {
BoxWithConstraints(Modifier.weight(1f)) {
val itemWidth = (maxWidth / keys.size).coerceIn(56.dp, 88.dp)
Box(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).onPlaced { content[0] = it }) {
if (shown in keys) ChipGlide(keys.indexOf(shown), bounds[shown], tint, GlideAxis.Horizontal, corner = 14.dp, fill = 0.14f, outline = 0f)
Row(Modifier.selectableGroup().padding(vertical = 4.dp), horizontalArrangement = Arrangement.Center) {
NavigationItems(s, shown, compact = true, iconOnly = false, height = 56.dp, width = itemWidth,
NavigationItems(s, shown, compact = true, iconOnly = iconOnly, height = if (iconOnly) 48.dp else 56.dp, width = itemWidth,
place = { key -> Modifier.onGloballyPositioned { item -> content[0]?.let { bounds[key] = it.localBoundingBoxOf(item) }; Hops.railBounds[key] = item.boundsInRoot() } },
onSelect = onSelect, onFocusSelect = onFocusSelect)
}
@@ -93,6 +93,21 @@ class PortraitLayoutTest {
compose.onNodeWithContentDescription("Resume Steam").assertIsDisplayed()
}
@Test fun bottomBarFollowsSidebarLabelsSetting() {
val context = org.robolectric.RuntimeEnvironment.getApplication()
RailLabels.set(context, false)
compose.setContent {
DroidDeckTheme { BottomBar(state, "steam", {}, {}, actions, Modifier.size(480.dp, 64.dp)) }
}
compose.mainClock.advanceTimeBy(1_000)
compose.onNodeWithText("Library").assertDoesNotExist()
compose.onNodeWithContentDescription("Library").assertIsDisplayed()
compose.runOnIdle { RailLabels.set(context, true) }
androidx.compose.runtime.snapshots.Snapshot.sendApplyNotifications()
compose.mainClock.advanceTimeBy(1_000)
compose.onNodeWithText("Library").assertIsDisplayed()
}
@Test fun compactHeaderKeepsAllActionsReachable() {
compose.setContent {
DroidDeckTheme {