Replace CalendarHost's single global view slot with a top-level view back stack rooted at a user-configurable default view. A lateral move (pill/drawer/widget) replaces the non-home top; a date tap drills the day view on top; a base-level BackHandler pops one level until only the home view remains, then the system exits. Widgets now carry their source view (EXTRA_SOURCE_VIEW) so a launch roots the stack in that widget's view: backing out of a day/event opened from the agenda widget returns to Agenda, and from the month widget to Month, instead of always landing on Week. Reminder taps keep the separate detail-key channel and leave the base view untouched. Add a Default view setting (Settings -> Appearance) backing the stack's home view; defaults to Week so existing users see no change. Resolves the two Codeberg reports from @devinside: - #1 [FR] Option to set default view - #2 [Bug] Widget UX improvement Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
1.3 KiB
Kotlin
30 lines
1.3 KiB
Kotlin
package de.jeanlucmakiola.calendula.ui
|
|
|
|
import de.jeanlucmakiola.calendula.ui.common.CalendarView
|
|
|
|
/**
|
|
* A navigation a home-screen widget asked the app to perform when launched.
|
|
* Parsed from the launch intent in MainActivity and consumed once by
|
|
* [CalendarHost]. Every request carries the [source] view of the widget it came
|
|
* from (the agenda widget → [CalendarView.Agenda], the month widget →
|
|
* [CalendarView.Month]) so the in-app back stack roots itself in that view:
|
|
* backing out of the opened date/event returns to the widget's own view, not the
|
|
* default home. (Reminder notifications are not widgets — they keep the separate
|
|
* detail-key channel and leave the base view untouched.)
|
|
*/
|
|
sealed interface WidgetNavRequest {
|
|
/** Open the day view anchored on [dateIso] (an ISO `yyyy-MM-dd` date), over [source]. */
|
|
data class OpenDate(val dateIso: String, val source: CalendarView) : WidgetNavRequest
|
|
|
|
/** Open one occurrence's detail (an agenda-widget event tap), over [source]. */
|
|
data class OpenEvent(
|
|
val eventId: Long,
|
|
val beginMillis: Long,
|
|
val endMillis: Long,
|
|
val source: CalendarView,
|
|
) : WidgetNavRequest
|
|
|
|
/** Open the create-event form prefilled for [dateIso] (today when null). */
|
|
data class Create(val dateIso: String?) : WidgetNavRequest
|
|
}
|