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

Feature/termux controls provider #55

Merged

Conversation

dkramer95
Copy link
Contributor

Implements #54 Device Control Widgets
(This is only for Android 11+)
I have only tested on Google Pixel 5

Screen Shot 2021-08-29 at 1 38 43 PM

Execution will exhibit same behavior as current home screen widgets. (i.e. any file placed in .shortcuts/tasks will run in background, all others in foreground.

  • Exception: If script runs any ui action (ex: termux-dialog, termux-toast) it will not be visible until user exits the Device Control view.

Error handling if script was removed / changed:

  • Widget will show "Not found". Tapping on it will display this error dialog:

Screen Shot 2021-08-29 at 1 40 18 PM
and tapping "Open App" will display error in Termux window:
Screen Shot 2021-08-29 at 1 41 21 PM

    * Add reactivex/reactivestreams dependencies (required)
    * Add TermuxWidgetControlsProviderService
    * Add error handling for missing shortcut files
    * Route intent through TermuxWidgetControlExecutorReceiver instead
@dkramer95 dkramer95 marked this pull request as ready for review August 29, 2021 18:51
Copy link
Member

@agnostic-apollo agnostic-apollo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private Intent addShortcutFileExtrasToIntent(File file, Intent intent)

Its returning an Intent but its never used. You are passing the intent as parameter which will automatically get updated, so no need to return.

private void addShortcutFile(File dir, List<File> shortcutFiles, int depth)

Why are you not using dir.listFiles(TermuxWidgetService.SHORTCUT_FILES_FILTER)? Wouldn't shortcut icons and hidden files be included currently?

Apart from that, good coding! I don't see any other issues related to new changes. I can't test this cause my Android 11 avd is not showing the 3 dots for me to add the device control in power menu, it seems android revision is old, probably that's the reason.

Also note that in Android 12 device controls have been removed from power menu. Check https://www.reddit.com/r/Android/comments/nx9pd1/android_12_device_controls_removed_from_the_power. No response from google in https://issuetracker.google.com/issues/190662102.

@dkramer95
Copy link
Contributor Author

Its returning an Intent but its never used. You are passing the intent as parameter which will automatically get updated, so no need to return.

Updated!

Why are you not using dir.listFiles(TermuxWidgetService.SHORTCUT_FILES_FILTER)? Wouldn't shortcut icons and hidden files be included currently?

Fixed.. Somehow I didn't see that was there :)

Also note that in Android 12 device controls have been removed from power menu.

This would be a very niche feature then. Hopefully at the very least, Google will allow an option to re-enable it. 🤞

Copy link
Member

@agnostic-apollo agnostic-apollo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing, will merge.

@agnostic-apollo agnostic-apollo merged commit 8c034da into termux:master Sep 2, 2021
@termux termux deleted a comment from Berat7171 Nov 10, 2022
@termux termux deleted a comment from Berat7171 Nov 10, 2022
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