From 599ea09b6b8c30617ea4b52bc97b6eb230769551 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 14 Oct 2018 21:57:01 +0200 Subject: [PATCH] optimize the way of fetching all selected items --- .../filemanager/adapters/ItemsAdapter.kt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt index ff917450..c3dc26c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt @@ -513,15 +513,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList { - val selectedFileDirItems = ArrayList(selectedKeys.size) - selectedKeys.forEach { - getItemWithKey(it)?.apply { - selectedFileDirItems.add(this) - } - } - return selectedFileDirItems - } + private fun getSelectedFileDirItems() = fileDirItems.filter { selectedKeys.contains(it.path.hashCode()) } as ArrayList fun updateItems(newItems: ArrayList, highlightText: String = "") { if (newItems.hashCode() != currentItemsHash) {