-
Notifications
You must be signed in to change notification settings - Fork 452
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.