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

Add the ability to add an app shortcut to open chuck from the launcher icon #49

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

Conversation

degill
Copy link

@degill degill commented May 25, 2017

This commit adds the ability to add an app shortcut to the clients' launcher icon on android devices running android 7.0 and above. With that app shortcut the Chuck UI can be accessed. This can be useful if no notification is desired but there still need to be a simple way to enter chuck.

@degill degill changed the title Add the ability to add app shortcuts to open chuck Add the ability to add app shortcut to open chuck May 25, 2017
@degill degill changed the title Add the ability to add app shortcut to open chuck Add the ability to add an app shortcut to open chuck from the launcher icon May 25, 2017
Copy link

@olivierperez olivierperez left a comment

Choose a reason for hiding this comment

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

You should maybe add a method to remove the shortcut too.

final String id = context.getPackageName() + ".chuck_ui";
final ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
final ShortcutInfo shortcut = new ShortcutInfo.Builder(context, id).setShortLabel("Chuck")
.setLongLabel("Open Chuck UI")

Choose a reason for hiding this comment

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

The label should be retrieved from the resources, or maybe given by paramters to let de developer choose the wording.

* It can be used if you want to remove this shortcut later on.
*/
@TargetApi(Build.VERSION_CODES.N_MR1)
@SuppressWarnings("WeakerAccess")

Choose a reason for hiding this comment

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

I'm not fan of this SuppressWarnings

Copy link
Author

Choose a reason for hiding this comment

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

This function is obviously not called from within the library, thus there will be a warning that its access can be weaker, but apps need access to it so it must be public -> Get rid of the warning.

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