Skip to content

Add Shortcut option#567

Open
dev-a wants to merge 1 commit intoTrackerControl:masterfrom
dev-a:master
Open

Add Shortcut option#567
dev-a wants to merge 1 commit intoTrackerControl:masterfrom
dev-a:master

Conversation

@dev-a
Copy link
Copy Markdown

@dev-a dev-a commented Apr 7, 2026

Summary

Adds app shortcuts to quickly enable or disable protection directly from the launcher, improving user accessibility and control.

Changes

  • AndroidManifest.xml
    • Added android.app.shortcuts metadata pointing to res/xml/shortcuts.xml
    • Declared new ActivityShortcut (translucent, no history, excluded from recents)
    • Added ReceiverShortcut broadcast receiver for handling shortcut actions
  • ActivityShortcut.java
    • New activity handling launcher shortcut intents (SHORTCUT_ON / SHORTCUT_OFF)
    • Sends corresponding broadcast to toggle protection
    • Displays a toast confirmation to the user
  • ReceiverShortcut.java
    • New broadcast receiver handling shortcut actions
    • Supports explicit ON/OFF actions and fallback toggle based on current state
    • Sends broadcast to WidgetAdmin and shows user feedback via toast
  • res/xml/shortcuts.xml
    • Defined two launcher shortcuts:
      • "Protection ON"
      • "Protection OFF"
    • Both trigger ActivityShortcut with appropriate actions
  • strings.xml
    • Added shortcut_on and shortcut_off string

Behaviour

  • Two new app shortcuts appear in the launcher (long press on app icon)
  • Users can directly enable or disable protection without opening the app
  • A toast message confirms the action ("Protection ON" / "Protection OFF")
  • If triggered via broadcast without explicit state, the receiver toggles based on current status

Testing

  • Verified both shortcuts appear in launcher menu
  • Tested "Protection ON" shortcut → correctly enables protection
  • Tested "Protection OFF" shortcut → correctly disables protection
  • Verified toast messages are displayed correctly
  • Tested fallback toggle behaviour via broadcast
  • Confirmed no crashes when shortcuts are triggered repeatedly

@dev-a
Copy link
Copy Markdown
Author

dev-a commented Apr 7, 2026

image

see also : #486

@kasnder
Copy link
Copy Markdown
Member

kasnder commented Apr 17, 2026

Thanks for the commit. I'm hesitant to merge because it's quite a bit of new code.

@dev-a
Copy link
Copy Markdown
Author

dev-a commented Apr 17, 2026

Thanks for the commit. I'm hesitant to merge because it's quite a bit of new code.

No worries, it's your project, it's just a suggestion (which is helpful to me, lol).

You don't have to include it right away either, and keep it on hand.

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.

2 participants