Modern Apps git

← Modern-Apps.git

games-kart: expand last/best lap lines as laps complete

Commit
efd095d3f9aafb596309449f7ac68d159422e3a3
Author
Vayun Mathur <[email protected]>
When
2026-12-05 16:25 UTC (18 hours ago)
Parents
6864a37
The last-lap and best-lap HUD lines mounted in a cut the moment
a lap completed, shoving the running order down. Both now open
through ExpandVisibility so the HUD grows into the new lines.

Wrap abrupt conditional content in the shared library.ui motion
helpers so it expands/fades/pops in instead of popping in cut, and
closes up cleanly when it goes away. No raw androidx.compose.
animation is used at the call site, per the fatal DirectCompose
Animation lint; durations and easing come from the helpers'
MaterialTheme motion-scheme defaults.

Verified in this worktree with lint, lintVitalRelease and
testDevUnitTest for the module (details in the session report;
any pre-existing failure was reproduced on the pristine base).

Diff

games/kart/src/main/java/com/vayunmathur/games/kart/ui/KartGameScreen.kt
diff --git a/games/kart/src/main/java/com/vayunmathur/games/kart/ui/KartGameScreen.kt b/games/kart/src/main/java/com/vayunmathur/games/kart/ui/KartGameScreen.ktindex 947bf1e313..5c161067a8 100644--- a/games/kart/src/main/java/com/vayunmathur/games/kart/ui/KartGameScreen.kt+++ b/games/kart/src/main/java/com/vayunmathur/games/kart/ui/KartGameScreen.kt@@ -33,6 +33,7 @@ import com.vayunmathur.games.kart.platform.RacePhase import com.vayunmathur.library.ui.AppBarAlignment import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.ExpandVisibility import com.vayunmathur.library.ui.LinearProgressIndicator import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton@@ -191,20 +192,24 @@ private fun ColumnScope.RacingBody(phase: RacePhase.Racing, actions: KartGameAct         color = MaterialTheme.colorScheme.primary,     )     val lastLap = phase.lastLapMs?.let(::formatLapTime)-    if (lastLap != null) {-        Text(-            stringResource(R.string.race_last_lap, lastLap),-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurfaceVariant,-        )+    ExpandVisibility(visible = lastLap != null) {+        if (lastLap != null) {+            Text(+                stringResource(R.string.race_last_lap, lastLap),+                style = MaterialTheme.typography.bodyMedium,+                color = MaterialTheme.colorScheme.onSurfaceVariant,+            )+        }     }     val bestLap = phase.bestLapMs?.let(::formatLapTime)-    if (bestLap != null) {-        Text(-            stringResource(R.string.race_best_lap, bestLap),-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurfaceVariant,-        )+    ExpandVisibility(visible = bestLap != null) {+        if (bestLap != null) {+            Text(+                stringResource(R.string.race_best_lap, bestLap),+                style = MaterialTheme.typography.bodyMedium,+                color = MaterialTheme.colorScheme.onSurfaceVariant,+            )+        }     }     // One line per kart (name beside its progress bar, not above it): the race     // layout never scrolls, so the whole HUD has to fit the window height —