feat(month): collapse the expanded month on back (#53)
Expanding replaces the whole screen, so it is a place you can be, and every other place in the app can be backed out of. Without this, back left the Month view entirely and coming back found it still expanded. Declared deeper than CalendarHost's view-stack handler, which is what makes it take precedence while it is enabled. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package de.jeanlucmakiola.calendula.ui.month
|
package de.jeanlucmakiola.calendula.ui.month
|
||||||
|
|
||||||
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.ExperimentalSharedTransitionApi
|
import androidx.compose.animation.ExperimentalSharedTransitionApi
|
||||||
import androidx.compose.animation.SharedTransitionLayout
|
import androidx.compose.animation.SharedTransitionLayout
|
||||||
@@ -911,6 +912,11 @@ private fun SplitMonthContent(
|
|||||||
val fadeSpec = rememberCalendarFadeSpec()
|
val fadeSpec = rememberCalendarFadeSpec()
|
||||||
val reduceMotion = rememberReduceMotion()
|
val reduceMotion = rememberReduceMotion()
|
||||||
var expanded by rememberSaveable { mutableStateOf(false) }
|
var expanded by rememberSaveable { mutableStateOf(false) }
|
||||||
|
// Back collapses before it does anything else. Expanding replaces the whole
|
||||||
|
// screen, so it is a place you can be, and every other place in the app can
|
||||||
|
// be backed out of. Declared deeper than CalendarHost's view-stack handler,
|
||||||
|
// which is what makes it win while it is enabled.
|
||||||
|
BackHandler(enabled = expanded) { expanded = false }
|
||||||
// The swipe wraps the grid rather than living inside it: mid-transition
|
// The swipe wraps the grid rather than living inside it: mid-transition
|
||||||
// there are two grids, and the gesture belongs to neither. The pane is left
|
// there are two grids, and the gesture belongs to neither. The pane is left
|
||||||
// out of it — it scrolls and is full of tappable rows.
|
// out of it — it scrolls and is full of tappable rows.
|
||||||
|
|||||||
Reference in New Issue
Block a user