Files
Calendar/app
Kurian Vithayathil 80dd4d9f1e feat: Calendar selection for event list widget (#1160)
* feat(widget): add calendars column and helpers to Widget model

Add nullable calendars field (String? DEFAULT NULL) to Widget entity for
per-widget calendar filtering. NULL = fallback to global, empty = show nothing.

- Widget.kt: add calendars field, isCalendarsConfigured(), getCalendarIdsAsList()
- EventsDatabase.kt: bump version 11→12, MIGRATION_11_12 adds column
- Constants.kt: add EVENT_LIST_CALENDARS intent extra key

* feat(widget): add settings icon drawable and calendar picker strings

- ic_settings_vector.xml: Material Settings gear icon (24dp)
- strings.xml: add widget_calendars, widget_calendars_summary, widget_calendars_all

* feat(widget): implement per-widget calendar filtering for event list widget

Add per-widget calendar selection to the event list widget. Each widget
instance can now filter events to specific calendars, overriding the
global display settings.

- Add overrideCalendarIds parameter to EventsHelper.getEventsSync() with
  widget-wins-completely logic (skips all global filter including
  birthday/anniversary)
- Add calendars Intent extra to WidgetService for per-instance filtering
- Add settings gear icon to widget header via direct PendingIntent
- Add calendar picker row to widget config screen with SelectCalendarsDialog
- Guard back press during re-configuration to avoid clearing widget
- Disable save button until existing config loads from Room

* chore: add Room schema 12.json

Generated by KSP during build. Captures the new nullable calendars
TEXT column on the widgets table introduced by migration 11->12.

* fix(widget): pre-check all calendars when default selection is used

* feat(widget): add 3-state calendar picker to widget config

Add calendar selection UI to the widget configuration screen with
explicit tracking of user intent to distinguish three states:

- null (never configured): falls back to global filter, shows 'All calendars'
- empty string (explicitly chose none): shows 'No calendars selected' + warning
- comma-separated IDs: shows 'N calendars selected'

Changes:
- Flatten widget_config_list.xml to ConstraintLayout
- Add calendar picker button with SelectCalendarsDialog
- Track mCalendarsExplicitlyChosen flag through config/reconfig cycle
- Fix saveConfig to preserve explicit-zero as empty string sentinel
- Fix updateCalendarPickerLabel for 3-state display
- Show warning when zero calendars explicitly selected
- Fix EventListWidgetAdapter intent parsing for null vs empty-string
- Fix MyWidgetListProvider to only set calendars extra when non-null
- Pre-check all calendars when default selection is used
- Add ic_calendar_add_vector drawable and dimension resources

* changelog: consolidate [Unreleased] entries for per-widget calendar filtering

* fix(detekt): resolve MaxLineLength, MagicNumber, and complexity warnings

* fix(widget): add contentDescription to widget header ImageButtons

Replace ImageView with ImageButton and add accessibility labels
for configure, new event, and show today actions in the event
list widget header.

* refactor(widget): replace deprecated onBackPressed with onBackPressedCompat

Remove @Deprecated onBackPressed override in WidgetListConfigureActivity
in favor of the compatibility-aware onBackPressedCompat/performDefaultBack
pattern from the commons library.

* fix: use LongSparseArray for calendar colors and reference color resource

- Replace Map<Long, Int> with LongSparseArray<Int> in
  EventsHelper for Android-idiomatic long-keyed map usage
- Use @color/dark_grey reference instead of hardcoded hex in
  debug launcher background drawable

---------

Co-authored-by: Kurian Vithayathil <1056073+kvithayathil@users.noreply.github.com>
2026-04-28 15:55:13 +05:30
..