Merge Wrap map buttons into a second column on short screens (#136)

This commit is contained in:
Seb3thehacker committed 2026-11-29 16:03:28 -08:00
commit c7c059762c
2 files changed
+15 -3

No files matched your search

@@ -290,7 +290,7 @@ fun CarUi() {
// Home never leaves the composition; other screens cover it. Dropping it
// would tear down the map's surface, and coming back would then show black
// while the nav app redrew on a new one.
CompositionLocalProvider(LocalNavBarInset provides homeInset) { CarHome() }
CompositionLocalProvider(LocalNavBarInset provides homeInset, LocalNavBarRow provides NAV_BAR_HEIGHT) { CarHome() }
}
// The keyboard takes the nav bar's row instead of squeezing in above it -
// nothing on the nav bar is useful mid-type, and the screen is too small to
@@ -430,6 +430,12 @@ internal val SHORT_SCREEN_HEIGHT = 420.dp
*/
internal val LocalNavBarInset = androidx.compose.runtime.compositionLocalOf { 0.dp }
/**
* The floating nav bar's row over Home, whether it shows right now or not: what stays clear so
* nothing jumps as it slides in and out. Zero on screens that keep a row for the bar themselves.
*/
internal val LocalNavBarRow = androidx.compose.runtime.compositionLocalOf { 0.dp }
/**
* A single blocking screen, shown once per install before anything else the car screen can show -
* Home included. The phone's own setup guide carries the same warning, but a driver who plugs in
@@ -277,6 +277,9 @@ internal fun RightEdgeControls(
)
Column(
modifier
// Clear of the nav bar's row even while it's hidden, so the buttons don't jump or
// wrap differently each time it slides in or out.
.padding(bottom = maxOf(0.dp, LocalNavBarRow.current - LocalNavBarInset.current))
.alpha(alpha)
.focusRequester(knobFocus)
.focusGroup()
@@ -317,10 +320,13 @@ internal fun RightEdgeControls(
}
}
if (mapActions.isNotEmpty() && !(folded && open)) {
Column(
// Wraps into a second column on a short screen: a 1280x480 SOOEMAKA had the last
// buttons under the nav bar, out of reach.
androidx.compose.foundation.layout.FlowColumn(
mapActionsModifier,
horizontalAlignment = alignment,
verticalArrangement = Arrangement.spacedBy(8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
itemHorizontalAlignment = alignment,
) {
mapActions.forEach { ActionButton(it) }
}