fix: open existing events from external VIEW intents (Codeberg #48) #69
Reference in New Issue
Block a user
Delete Branch "fix/widget-view-event-intent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes Codeberg #48 — https://codeberg.org/jlmakiola/calendula/issues/48
(reported on v2.14.0, Pixel 7 / Android 16 / LineageOS). Follow-up to the
closed #30.
The gap
v2.14.0 added the
ACTION_INSERTfilter (#30), so the widget "+" can create anevent in Calendula. But tapping an existing event in a third-party widget
(e.g. Todo Agenda) still didn't list Calendula in the chooser — nothing handled
ACTION_VIEWoncontent://com.android.calendar/events/<id>.Fix
intent-filtermatched by the provider's item MIMEtype
vnd.android.cursor.item/event(mirrors AOSP Calendar and the siblingINSERT
dir/eventfilter). Acontent:VIEW intent carries the resolved type,so Android's matching would reject a path-only
<data>filter — the MIME matchis the reliable one.
MainActivity.viewEventKeyOrNull— parse the events URI into the existingoccurrence detail-key channel (the same one reminder taps flow through, so
RootScreen → CalendarHost → EventDetailScreenneeds no changes). Occurrencetimes ride as
EXTRA_EVENT_BEGIN_TIME/EXTRA_EVENT_END_TIMEwhen thelauncher supplies them.
EventDetailViewModel— aNO_OCCURRENCE_TIMEsentinel makesloadDetailkeep the event row's own DTSTART/DTEND when the launcher sends a bare URI (no
occurrence extras), instead of overriding to the epoch (which would render the
event at 1970 — the same hazard flagged for #34).
Testing
./gradlew assembleDebug lint testgreen locally.JVM-testable here (the project's JVM-first coverage is pure domain + mappers).
matches the widget's actual VIEW intent and that its extras behave as expected.
🤖 Generated with Claude Code