Last active
December 18, 2016 23:59
-
-
Save AOrobator/73b77d06bcfa77f109a43d7d14dec347 to your computer and use it in GitHub Desktop.
Implementing App Shortcuts - Enabling/Disabling Shortcuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TargetApi(N_MR1) | |
override fun onOptionsItemSelected(item: MenuItem): Boolean { | |
when (item.itemId) { | |
R.id.enable_shortcut -> shortcutAction { | |
it.enableShortcuts(listOf(constellation.name)) | |
alertUser(R.string.shortcut_enabled) | |
} | |
R.id.disable_shortcut -> shortcutAction { | |
it.disableShortcuts(listOf(constellation.name)) | |
alertUser(R.string.shortcut_disabled) | |
} | |
android.R.id.home -> finish() | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment