Skip to content

Add per-widget list selector with chevron dropdown#15

Merged
pgarr merged 3 commits into
masterfrom
widget-list-selector
May 24, 2026
Merged

Add per-widget list selector with chevron dropdown#15
pgarr merged 3 commits into
masterfrom
widget-list-selector

Conversation

@pgarr
Copy link
Copy Markdown
Owner

@pgarr pgarr commented May 24, 2026

Summary

  • Widget header now shows a chevron icon (▾) next to the list title
  • Tapping the chevron opens a dialog listing all available lists to choose from
  • Selection is saved per widget instance in SharedPreferences (widget_prefs file, key selected_list_<widgetId>) — survives reboots
  • Falls back to the most recently created list when no selection is saved or the saved list was deleted (stale pref auto-cleared)
  • Prefs are cleaned up when a widget instance is removed (onDeleted)
  • Multiple widget instances are fully independent

New files

  • WidgetPrefs.kt — SharedPreferences helper
  • WidgetListSelectActivity.kt — dialog Activity for the list picker
  • widget_chevron_down.xml — Lucide-style chevron drawable

Modified files

  • WidgetDbHelper.kt — added getAllLists(), getListById(), resolveList()
  • NoteListWidget.kt — uses resolveList, wires chevron PendingIntent, handles onDeleted
  • NoteListWidgetService.kt / NoteListRemoteViewsFactory.kt — pass widgetId instead of listId to factory
  • widget_note_list.xml — header row now has title + chevron ImageView
  • AndroidManifest.xml + styles.xml — register new Activity with dialog theme

🤖 Generated with Claude Code

pgarr and others added 3 commits May 24, 2026 20:51
- Add chevron icon to widget header; tapping it opens a dialog picker
  showing all available lists
- Selection is persisted per widget instance in SharedPreferences
  (key: "selected_list_<widgetId>" in "widget_prefs")
- Falls back to the latest list when no selection is saved or the saved
  list has been deleted; clears stale prefs automatically
- Cleans up prefs when a widget instance is removed (onDeleted)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pgarr pgarr merged commit d38504d into master May 24, 2026
2 checks passed
@pgarr pgarr deleted the widget-list-selector branch May 24, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant