diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt index aeb9f80..1ec710b 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt @@ -274,7 +274,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 @@ -403,6 +403,12 @@ internal val NAV_BAR_HEIGHT = 56.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 diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/TemplateParts.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/TemplateParts.kt index 1ba37ad..0f7b929 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/TemplateParts.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/TemplateParts.kt @@ -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) } }