From 812b92ab38fb1104780d850c470ae208a5cc3a8b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 21 Feb 2020 21:54:43 +0530 Subject: AutofillService: Speed item loading Don't make cacheable function calls in loops Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/src/main/java') 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(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", "") } -- cgit v1.2.3