85 lines
2.5 KiB
Markdown
85 lines
2.5 KiB
Markdown
# 15. App Shortcuts & Widgets
|
|
|
|
meta:
|
|
id: android-production-15
|
|
feature: android-production
|
|
priority: P2
|
|
depends_on: []
|
|
tags: [native-features, widgets, production]
|
|
|
|
objective:
|
|
- Implement app shortcuts and home screen widgets to improve user engagement and accessibility
|
|
|
|
deliverables:
|
|
- Dynamic and static app shortcuts
|
|
- Home screen widget (threat score)
|
|
- Widget configuration
|
|
- Shortcut deep linking
|
|
|
|
steps:
|
|
1. Implement app shortcuts:
|
|
- Static shortcuts in shortcuts.xml:
|
|
- "View Dashboard" → opens dashboard
|
|
- "Check Alerts" → opens alerts
|
|
- "Run Scan" → starts DarkWatch scan
|
|
- Dynamic shortcuts:
|
|
- "Recent Alert" → opens latest alert
|
|
- "Quick Check" → runs quick threat assessment
|
|
2. Create home screen widget:
|
|
- GlanceAppWidget for modern Compose widgets
|
|
- Or traditional AppWidgetProvider
|
|
- Sizes: 2x1 (threat score), 3x2 (score + alerts)
|
|
- Update every 30 minutes (widget limit)
|
|
3. Design widget UI:
|
|
- Match app design system
|
|
- Show threat score with color coding
|
|
- Show number of unread alerts
|
|
- Show last update time
|
|
- Support dark/light themes
|
|
4. Implement widget updates:
|
|
- Update on app data refresh
|
|
- Schedule periodic updates
|
|
- Handle widget configuration changes
|
|
5. Add deep linking:
|
|
- Tap widget → open dashboard
|
|
- Tap alert count → open alerts list
|
|
- Tap threat score → open dashboard
|
|
6. Add preview:
|
|
- Widget preview image for picker
|
|
- Description for accessibility
|
|
7. Test:
|
|
- Add widget to home screen
|
|
- Verify updates work
|
|
- Test shortcuts
|
|
|
|
tests:
|
|
- Unit: Test widget provider
|
|
- Integration: Test shortcut deep links
|
|
- UI: Test widget rendering
|
|
|
|
acceptance_criteria:
|
|
- 3+ app shortcuts defined
|
|
- Static shortcuts working
|
|
- Dynamic shortcuts updated based on user activity
|
|
- Home screen widget showing threat score
|
|
- Widget updates every 30 minutes
|
|
- Widget supports dark and light themes
|
|
- Deep links from shortcuts and widgets work
|
|
- Widget preview in picker
|
|
- No crashes when widget data missing
|
|
- Widgets work on Android 8+ (API 26+)
|
|
|
|
validation:
|
|
- Long press app icon → shortcuts visible
|
|
- Tap shortcut → correct screen opens
|
|
- Add widget to home screen → threat score displayed
|
|
- Receive new alert → widget updates
|
|
- Tap widget → dashboard opens
|
|
- Check widget in dark mode → colors correct
|
|
|
|
notes:
|
|
- App shortcuts are great for power users
|
|
- Widgets use RemoteViews (limited UI capabilities)
|
|
- Glance is modern but requires additional dependency
|
|
- Test on different launchers (Pixel, Samsung, Nova)
|