feat(intent): create events from external ACTION_INSERT launches (#30)
Register an intent-filter for ACTION_INSERT on the events dir mime type (vnd.android.cursor.dir/event), the way the AOSP calendar accepts one, so other apps and widgets (e.g. the Todo Agenda widget) can launch Calendula to create a new event. MainActivity.insertFormOrNull parses the standard CalendarContract extras (EXTRA_EVENT_BEGIN_TIME/END_TIME/ALL_DAY, Events.TITLE/DESCRIPTION/ EVENT_LOCATION/RRULE) into a prefilled EventForm via the pure, unit-tested buildInsertEventForm — omitted fields fall back to the same defaults the in-app "new event" uses (next full hour, +1h). The form is routed through the existing single-event prefill channel (RootScreen → CalendarHost → the create form for review), with calendarId left null so it resolves to the last-used / first-writable calendar. No new permission is needed (WRITE_CALENDAR is already held), and the user still explicitly saves. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -112,6 +112,17 @@
|
||||
<data android:mimeType="text/calendar" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Let another app or widget (e.g. the Todo Agenda widget) launch us
|
||||
to create a new event, the way the AOSP calendar accepts it:
|
||||
ACTION_INSERT on the events dir mime type, carrying the new
|
||||
event's fields as CalendarContract extras
|
||||
(MainActivity.insertFormOrNull, issue #30). -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.INSERT" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="vnd.android.cursor.dir/event" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Launcher long-press shortcuts (e.g. "New event"). -->
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
|
||||
Reference in New Issue
Block a user