Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Implement support for Android Dynamic Shortcuts #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tturner
Copy link
Contributor

@tturner tturner commented Jun 11, 2023

This is an updated version of the pull request #48 to try to make it more likely to be merged.

The hard work was done by @gergely-sallai Gergely Sallai in their fork. I have tweaked it as follows:

  • update to compile against the current master branch
  • made a small cosmetic change to the alignment of the UI component
  • squashed into a single commit for simplicity

I hope this is the right way to get this merged and that I haven't broken any github etiquette!

Original pull request information reproduced below:

Added support for Android Dynamic Shortcuts. Dynamic Shortcuts is a standard Android feature that is supported by most of the launchers.

How does this work for users?
Now users can request the app to add shortcuts to their favourite tunnels. When the user enables this for a specific tunnel, 2 dynamic shortcuts are created, one to UP the tunnel, other is to DOWN it.

Additionally this functionality enables users to use certain automation apps to automatically toggle tunnels. For example the built-in Bixby Routines on Samsung devices. (This was my original motivation for adding this feature, but I was trying to incorporate it in a way that could benefit all users.)

What changes were made to previous components to support this?
TunnelToggleActivity is now more broadly used. Previously it seemed to be only called from TileService in certain situations.
A new button has been added next to the tunnel toggle switch for each tunnel item.
Added androidx shortcuts library
Limitations and possible points for future improvement
To my best knowledge all of these -- expect the first point -- were there previous to my PR, and I can help to sort these out if needed.

Tooltip popup for the "add shortcuts" button is only available for devices running API 26 and up. This could be solved generally via TooltipCompat, but I didn't want to complicate the code because of this. As doing this with the compat lib can not be done purely from XML..
TunnelToggleActivity can be shown briefly when a tunnel is toggled, and it can look weird. This could possibly be solved by adding some design to the activity and showing it a bit longer in a controlled manner, maybe with some animation.
There may be some misconfigurations around material colors, it caused me some rendering differences on certain OS version with the button colors. I believe this could be solved with a refactor to support Material You (M3) and its dynamic colors, and fall back to a default on older versions. I do not know what is the intended design language of the app, so I didn't dare to refactor it just yet. :)

This work was done by Gergely Sallai in their fork.
I have tweaked it as follows:
- update to compile against the current master branch
- made a small cosmetic change to the alignment of the UI component
- squashed into a single commit for simplicity

Signed-off-by: Tom Turner <433367+tturner@users.noreply.github.com>
@MoLanShao

This comment was marked as off-topic.

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.

3 participants