optimize the way of fetching all selected items

This commit is contained in:
tibbi 2018-10-14 21:57:01 +02:00
parent 9aaf8fb53b
commit 599ea09b6b
1 changed files with 1 additions and 9 deletions

View File

@ -513,15 +513,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
private fun getFirstSelectedItemPath() = getSelectedFileDirItems().first().path
private fun getSelectedFileDirItems(): ArrayList<FileDirItem> {
val selectedFileDirItems = ArrayList<FileDirItem>(selectedKeys.size)
selectedKeys.forEach {
getItemWithKey(it)?.apply {
selectedFileDirItems.add(this)
}
}
return selectedFileDirItems
}
private fun getSelectedFileDirItems() = fileDirItems.filter { selectedKeys.contains(it.path.hashCode()) } as ArrayList<FileDirItem>
fun updateItems(newItems: ArrayList<FileDirItem>, highlightText: String = "") {
if (newItems.hashCode() != currentItemsHash) {