astronomy: crossfade rise/set results in the detail card
- Commit
1bb6514d2a132f656b6250efb8fe98322bfbf186- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-05 16:25 UTC (11 hours ago)
- Parents
af52efb
The rise/transit/set card swapped 'calculating' for the computed times (or never-rises/circumpolar) in a cut. SwappedContent now dissolves one state into the other inside the same card, which is the same-spot content swap that helper exists for. 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
astronomy/src/main/java/com/vayunmathur/astronomy/ui/ObjectDetailScreen.kt
diff --git a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/ObjectDetailScreen.kt b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/ObjectDetailScreen.ktindex 8afcaed4ab..6aebe0a88a 100644--- a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/ObjectDetailScreen.kt+++ b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/ObjectDetailScreen.kt@@ -23,6 +23,7 @@ import com.vayunmathur.library.ui.Card import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.Surface+import com.vayunmathur.library.ui.SwappedContent import com.vayunmathur.library.ui.Text import com.vayunmathur.library.util.NavBackStack import kotlinx.datetime.TimeZone@@ -98,32 +99,35 @@ fun ObjectDetailScreen( Card(Modifier.fillMaxWidth()) { Column(Modifier.padding(12.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { Text(stringResource(R.string.rise_transit_set), style = MaterialTheme.typography.titleSmall)- val rs = riseSet- if (rs == null) {- Text(stringResource(R.string.calculating))- } else if (rs.isNeverUp) {- Text(stringResource(R.string.never_rises_at_this_location))- } else if (rs.isCircumpolar) {- Text(stringResource(R.string.circumpolar_never_sets))- } else {- Text(- stringResource(- R.string.rise_1,- rs.riseJd?.let { formatJdInZone(it, timeZone) } ?: "—",- ),- )- Text(- stringResource(- R.string.transit_1,- rs.transitJd?.let { formatJdInZone(it, timeZone) } ?: "—",- ),- )- Text(- stringResource(- R.string.set_1,- rs.setJd?.let { formatJdInZone(it, timeZone) } ?: "—",- ),- )+ SwappedContent(state = riseSet) { rs ->+ Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {+ if (rs == null) {+ Text(stringResource(R.string.calculating))+ } else if (rs.isNeverUp) {+ Text(stringResource(R.string.never_rises_at_this_location))+ } else if (rs.isCircumpolar) {+ Text(stringResource(R.string.circumpolar_never_sets))+ } else {+ Text(+ stringResource(+ R.string.rise_1,+ rs.riseJd?.let { formatJdInZone(it, timeZone) } ?: "—",+ ),+ )+ Text(+ stringResource(+ R.string.transit_1,+ rs.transitJd?.let { formatJdInZone(it, timeZone) } ?: "—",+ ),+ )+ Text(+ stringResource(+ R.string.set_1,+ rs.setJd?.let { formatJdInZone(it, timeZone) } ?: "—",+ ),+ )+ }+ } } } }