diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2020-02-21 21:54:43 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2020-02-21 23:01:54 +0530 |
commit | 812b92ab38fb1104780d850c470ae208a5cc3a8b (patch) | |
tree | cae3caaa5045bb475c97b0a3a075441aa050f6b4 /app/src/main | |
parent | 9787489bc5b7e7bb10ab92e257d31fef50fe9255 (diff) |
AutofillService: Speed item loading
Don't make cacheable function calls in loops
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt | 8 |
1 files changed, 4 insertions, 4 deletions
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 0634cdfe..22e49919 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt @@ -412,12 +412,12 @@ class AutofillService : AccessibilityService(), CoroutineScope by CoroutineScope // populate the dialog items, always with pick + pick and match. Could // make it optional (or make height a setting for the same effect) val itemNames = arrayOfNulls<CharSequence>(items.size + 2) + val passwordDirectory = PasswordRepository.getRepositoryDirectory(applicationContext).toString() + val autofillFullPath = settings!!.getBoolean("autofill_full_path", false) for (i in items.indices) { - if (settings!!.getBoolean("autofill_full_path", false)) { + if (autofillFullPath) { itemNames[i] = items[i].path.replace(".gpg", "") - .replace( - PasswordRepository.getRepositoryDirectory(applicationContext).toString() + "/", - "") + .replace("$passwordDirectory/", "") } else { itemNames[i] = items[i].name.replace(".gpg", "") } |