Add full path open in autofill dialog (#609) (#610)

Fixes #609
This commit is contained in:
Gigahawk 2020-01-20 19:48:39 -08:00 committed by Harsh Shandilya
parent 44f0f22574
commit c129fb347e
4 changed files with 18 additions and 2 deletions

View file

@ -92,10 +92,12 @@ class UserPreference : AppCompatActivity() {
val autoFillAppsPreference = findPreference<Preference>("autofill_apps") val autoFillAppsPreference = findPreference<Preference>("autofill_apps")
val autoFillDefaultPreference = findPreference<CheckBoxPreference>("autofill_default") val autoFillDefaultPreference = findPreference<CheckBoxPreference>("autofill_default")
val autoFillAlwaysShowDialogPreference = findPreference<CheckBoxPreference>("autofill_always") val autoFillAlwaysShowDialogPreference = findPreference<CheckBoxPreference>("autofill_always")
val autoFillShowFullNamePreference = findPreference<CheckBoxPreference>("autofill_full_path")
autofillDependencies = listOf( autofillDependencies = listOf(
autoFillAppsPreference, autoFillAppsPreference,
autoFillDefaultPreference, autoFillDefaultPreference,
autoFillAlwaysShowDialogPreference autoFillAlwaysShowDialogPreference,
autoFillShowFullNamePreference
) )
// Misc preferences // Misc preferences

View file

@ -412,7 +412,14 @@ class AutofillService : AccessibilityService() {
// make it optional (or make height a setting for the same effect) // make it optional (or make height a setting for the same effect)
val itemNames = arrayOfNulls<CharSequence>(items.size + 2) val itemNames = arrayOfNulls<CharSequence>(items.size + 2)
for (i in items.indices) { 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] = getString(R.string.autofill_pick)
itemNames[items.size + 1] = getString(R.string.autofill_pick_and_match) itemNames[items.size + 1] = getString(R.string.autofill_pick_and_match)

View file

@ -159,6 +159,8 @@
<string name="pref_autofill_default_title">Automatically match by default</string> <string name="pref_autofill_default_title">Automatically match by default</string>
<string name="pref_autofill_default_hint">Default to \'Automatically match\' for apps without custom settings. Otherwise, \'Never match.\'</string> <string name="pref_autofill_default_hint">Default to \'Automatically match\' for apps without custom settings. Otherwise, \'Never match.\'</string>
<string name="pref_autofill_always_title">Always show dialog</string> <string name="pref_autofill_always_title">Always show dialog</string>
<string name="pref_autofill_full_path_title">Show Full Path</string>
<string name="pref_autofill_full_path_hint">Show full path of matching password files</string>
<string name="pref_misc_title">Misc</string> <string name="pref_misc_title">Misc</string>
<string name="pref_clear_clipboard_title">Clear clipboard 20 times</string> <string name="pref_clear_clipboard_title">Clear clipboard 20 times</string>
<string name="pref_clear_clipboard_hint">Store consecutive numbers in the clipboard 20 times. Useful on Samsung phones that feature clipboard history.</string> <string name="pref_clear_clipboard_hint">Store consecutive numbers in the clipboard 20 times. Useful on Samsung phones that feature clipboard history.</string>

View file

@ -118,6 +118,11 @@
android:defaultValue="false" android:defaultValue="false"
android:key="autofill_always" android:key="autofill_always"
android:title="@string/pref_autofill_always_title"/> android:title="@string/pref_autofill_always_title"/>
<androidx.preference.CheckBoxPreference
android:defaultValue="false"
android:key="autofill_full_path"
android:summary="@string/pref_autofill_full_path_hint"
android:title="@string/pref_autofill_full_path_title"/>
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory android:title="@string/pref_misc_title"> <androidx.preference.PreferenceCategory android:title="@string/pref_misc_title">