translate: fade camera pause/torch controls over the preview
- Commit
4ba3ff5e25613a466469dfc64d3b869462fc28ca- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-05 16:25 UTC (11 hours ago)
- Parents
ba09f94
The pause and torch buttons mounted in a cut inside the camera bottom bar. They now fade in and out together through FadeVisibility, the helper for controls drawn over content. 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
translate/src/main/java/com/vayunmathur/translate/ui/CameraOverlay.kt
diff --git a/translate/src/main/java/com/vayunmathur/translate/ui/CameraOverlay.kt b/translate/src/main/java/com/vayunmathur/translate/ui/CameraOverlay.ktindex ad5d67f52f..a92327dbb6 100644--- a/translate/src/main/java/com/vayunmathur/translate/ui/CameraOverlay.kt+++ b/translate/src/main/java/com/vayunmathur/translate/ui/CameraOverlay.kt@@ -31,6 +31,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp+import com.vayunmathur.library.ui.FadeVisibility import com.vayunmathur.library.ui.IconBack import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconFlashOff@@ -179,12 +180,14 @@ internal fun CameraOverlay( onClick = { onOpenLanguagePicker(true) }, modifier = Modifier.width(120.dp), )- if (showCaptureControls) {- IconButton(onClick = onTogglePaused) {- if (paused) IconPlay(tint = Color.White) else IconPause(tint = Color.White)- }- IconButton(onClick = onToggleTorch) {- if (torchOn) IconFlashOn(tint = Color.White) else IconFlashOff(tint = Color.White)+ FadeVisibility(visible = showCaptureControls) {+ Row {+ IconButton(onClick = onTogglePaused) {+ if (paused) IconPlay(tint = Color.White) else IconPause(tint = Color.White)+ }+ IconButton(onClick = onToggleTorch) {+ if (torchOn) IconFlashOn(tint = Color.White) else IconFlashOff(tint = Color.White)+ } } } LanguageFieldButton(