From 544631da04c38ef734f34ceed31071a551876929 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 21 Nov 2020 00:20:11 +0530 Subject: App shortcut fixes (#1213) --- app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt | 5 +++-- app/src/main/res/drawable/ic_lock_open_24px.xml | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/ic_lock_open_24px.xml (limited to 'app/src/main') diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt index 66778e73..b0f8602c 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt @@ -453,13 +453,15 @@ class PasswordStore : BaseGitActivity() { // Needs an action to be a shortcut intent authDecryptIntent.action = LaunchActivity.ACTION_DECRYPT_PASS + startActivity(decryptIntent) + // Adds shortcut if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { val shortcutManager: ShortcutManager = getSystemService() ?: return val shortcut = Builder(this, item.fullPathToParent) .setShortLabel(item.toString()) .setLongLabel(item.fullPathToParent + item.toString()) - .setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher)) + .setIcon(Icon.createWithResource(this, R.drawable.ic_lock_open_24px)) .setIntent(authDecryptIntent) .build() val shortcuts = shortcutManager.dynamicShortcuts @@ -471,7 +473,6 @@ class PasswordStore : BaseGitActivity() { shortcutManager.addDynamicShortcuts(listOf(shortcut)) } } - startActivity(decryptIntent) } private fun validateState(): Boolean { diff --git a/app/src/main/res/drawable/ic_lock_open_24px.xml b/app/src/main/res/drawable/ic_lock_open_24px.xml new file mode 100644 index 00000000..441bf88b --- /dev/null +++ b/app/src/main/res/drawable/ic_lock_open_24px.xml @@ -0,0 +1,14 @@ + + + + + -- cgit v1.2.3