From c129fb347e6afb56aa693a63869b6a694894f029 Mon Sep 17 00:00:00 2001 From: Gigahawk Date: Mon, 20 Jan 2020 19:48:39 -0800 Subject: Add full path open in autofill dialog (#609) (#610) Fixes #609 --- app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 4 +++- app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt | 9 ++++++++- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preference.xml | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt index d40c0802..0b0c9459 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt @@ -92,10 +92,12 @@ class UserPreference : AppCompatActivity() { val autoFillAppsPreference = findPreference("autofill_apps") val autoFillDefaultPreference = findPreference("autofill_default") val autoFillAlwaysShowDialogPreference = findPreference("autofill_always") + val autoFillShowFullNamePreference = findPreference("autofill_full_path") autofillDependencies = listOf( autoFillAppsPreference, autoFillDefaultPreference, - autoFillAlwaysShowDialogPreference + autoFillAlwaysShowDialogPreference, + autoFillShowFullNamePreference ) // Misc preferences diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt index 5862fa91..100ce145 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt @@ -412,7 +412,14 @@ class AutofillService : AccessibilityService() { // make it optional (or make height a setting for the same effect) val itemNames = arrayOfNulls(items.size + 2) for (i in items.indices) { - itemNames[i] = items[i].name.replace(".gpg", "") + if (settings!!.getBoolean("autofill_full_path", false)) { + itemNames[i] = items[i].path.replace(".gpg", "") + .replace( + PasswordRepository.getRepositoryDirectory(applicationContext).toString() + "/", + "") + } else { + itemNames[i] = items[i].name.replace(".gpg", "") + } } itemNames[items.size] = getString(R.string.autofill_pick) itemNames[items.size + 1] = getString(R.string.autofill_pick_and_match) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c0c4c3fd..e7ffa3e9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -159,6 +159,8 @@ Automatically match by default Default to \'Automatically match\' for apps without custom settings. Otherwise, \'Never match.\' Always show dialog + Show Full Path + Show full path of matching password files Misc Clear clipboard 20 times Store consecutive numbers in the clipboard 20 times. Useful on Samsung phones that feature clipboard history. diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml index b03bfa5b..be6b49d6 100644 --- a/app/src/main/res/xml/preference.xml +++ b/app/src/main/res/xml/preference.xml @@ -118,6 +118,11 @@ android:defaultValue="false" android:key="autofill_always" android:title="@string/pref_autofill_always_title"/> + -- cgit v1.2.3