Map apps keep their speedometer clear of the nav bar and the map buttons

This commit is contained in:
Seb3thehacker committed 2026-11-06 12:04:28 -08:00
1 parent 2d3de20682
commit bc22691f81
2 files changed
+14 -3

No files matched your search

@@ -145,13 +145,18 @@ private fun AppSurface(
val cardsAtEnd = LocalCardsAtEnd.current
val cardEdge = cardEdge
val measuredStable = bounds?.takeIf { width > 0 && height > 0 }?.let { cover?.visibleWithin(it, width, height, skip = cardEdge) }
LaunchedEffect(template, size, measured, measuredStable, cardsAtEnd) {
// A little room above whatever ends the map at the bottom (the nav bar, or the screen's edge):
// apps draw their own corner pieces (Waze's speedometer) right on the area's bottom edge,
// which left them sitting flush on the bar.
val bottomGap = with(androidx.compose.ui.platform.LocalDensity.current) { MAP_BOTTOM_GAP.roundToPx() }
LaunchedEffect(template, size, measured, measuredStable, cardsAtEnd, bottomGap) {
if (width > 0 && height > 0) {
val visible = visibleAreaFor(template, width, height, measured, cardsAtEnd)
fun android.graphics.Rect.clearOfBar() = if (isEmpty) this else android.graphics.Rect(left, top, right, maxOf(top, bottom - bottomGap))
val visible = visibleAreaFor(template, width, height, measured, cardsAtEnd).clearOfBar()
// Waze seems to centre its car in the stable area rather than the visible one, so it
// gets the cards taken out of that too. Test: see whether its car moves out from under them.
val stable = if (!isContentTemplate(template) && connection.appPackage != "com.waze") {
visibleAreaFor(template, width, height, measuredStable, cardsAtEnd)
visibleAreaFor(template, width, height, measuredStable, cardsAtEnd).clearOfBar()
} else {
visible
}
@@ -284,6 +289,9 @@ private fun ChromeBar(
}
}
/** How far above the bottom of the map the area an app may draw in stops. */
private val MAP_BOTTOM_GAP = 12.dp
/** Height of [ChromeBar]; the template's own chrome starts below it. */
private val CHROME_BAR = 44.dp
@@ -540,6 +540,9 @@ private fun MapPaneLayout(
if (pan) null else actionStrip,
mapActionStrip,
Modifier.align(if (atEnd) Alignment.TopStart else Alignment.TopEnd).padding(12.dp),
// Counted as covering the map, as in navigation, or Waze's speedometer slid under
// them and off the screen's edge whenever a card was up.
mapActionsModifier = Modifier.covers("pane-buttons", buttonEdge),
alignment = if (atEnd) Alignment.Start else Alignment.End,
)
}