AutofillService: Speed item loading
Don't make cacheable function calls in loops Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
9787489bc5
commit
812b92ab38
1 changed files with 4 additions and 4 deletions
|
@ -412,12 +412,12 @@ class AutofillService : AccessibilityService(), CoroutineScope by CoroutineScope
|
||||||
// populate the dialog items, always with pick + pick and match. Could
|
// populate the dialog items, always with pick + pick and match. Could
|
||||||
// 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)
|
||||||
|
val passwordDirectory = PasswordRepository.getRepositoryDirectory(applicationContext).toString()
|
||||||
|
val autofillFullPath = settings!!.getBoolean("autofill_full_path", false)
|
||||||
for (i in items.indices) {
|
for (i in items.indices) {
|
||||||
if (settings!!.getBoolean("autofill_full_path", false)) {
|
if (autofillFullPath) {
|
||||||
itemNames[i] = items[i].path.replace(".gpg", "")
|
itemNames[i] = items[i].path.replace(".gpg", "")
|
||||||
.replace(
|
.replace("$passwordDirectory/", "")
|
||||||
PasswordRepository.getRepositoryDirectory(applicationContext).toString() + "/",
|
|
||||||
"")
|
|
||||||
} else {
|
} else {
|
||||||
itemNames[i] = items[i].name.replace(".gpg", "")
|
itemNames[i] = items[i].name.replace(".gpg", "")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue