feat(widget): add picker preview and document NotifyWorker rollup - #234
feat(widget): add picker preview and document NotifyWorker rollup#234TimeToBuildBob wants to merge 2 commits into
Conversation
The widget picker currently shows no preview. minSdk 26 cannot rely on previewLayout (API 31+), so set both: a sample layout for modern pickers and a static PNG fallback for Android 8–11. See ActivityWatch#142.
parseCategorySeconds groups by $category[0] so a "Work" alert includes every Work subcategory. That matches DEFAULT_ALERTS and desktop aw-notify's AllLevels parent key; do not "fix" it to full-path like ActivityWatch#231. Extracted as an internal function with tests covering the rollup.
Greptile SummaryThe PR adds launcher-picker previews for the category-time widget and documents the notification worker’s intentional top-level category rollup.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or non-blocking defects identified in the changed paths. The widget metadata references valid preview resources supported by the configured SDK, the preview layout uses compatible standard views, and the parser extraction preserves the production call path and intended aggregation behavior. Important Files Changed
Reviews (1): Last reviewed commit: "docs(notify): document intentional top-l..." | Re-trigger Greptile |
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
Two items scoped out of #231 / requested on #142.
1. Widget picker preview
The widget picker currently shows no preview.
minSdkis 26, sopreviewLayout(API 31+) is not enough on its own.android:previewLayout→@layout/widget_category_time_preview(sample data: 4h 23m / Work / Media / Uncategorized)android:previewImage→ static PNG fallback for Android 8–11previewLayouttakes precedence on API 31+;previewImageis the documented fallback.Picker preview (static image, used below API 31):
Device/emulator picker verification is not in this PR — no attached device in this environment. The preview layout is the live widget layout with realistic placeholders, which is what the system picker inflates.
2. NotifyWorker top-level rollup is intentional
parseCategorySeconds()still groups by$category[0]. That is not a leftover of the widget grouping that #231 briefly changed to full-path.Alert keys (
CategoryAlert.category) are top-level names like"Work"/"YouTube"— the same shape asDEFAULT_ALERTSand as desktop aw-notify's AllLevels parent key. A "Work" alert means "notify me after 2h of Work", which must include Work > Coding, Work > Planning, etc.Nested-path alerts (
"Work > Programming") are not supported on Android; desktop AllLevels aggregation would be needed for that. Don't "fix" this to match #231.Extracted as an internal function; four unit tests pin the rollup.
Tests
./gradlew :mobile:testDebugUnitTest --tests 'net.activitywatch.android.workers.NotifyWorkerTest'— 11/11 pass.Related