mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-02-16 20:00:36 +01:00
optimize the way of fetching all selected items
This commit is contained in:
parent
9aaf8fb53b
commit
599ea09b6b
@ -513,15 +513,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||||||
|
|
||||||
private fun getFirstSelectedItemPath() = getSelectedFileDirItems().first().path
|
private fun getFirstSelectedItemPath() = getSelectedFileDirItems().first().path
|
||||||
|
|
||||||
private fun getSelectedFileDirItems(): ArrayList<FileDirItem> {
|
private fun getSelectedFileDirItems() = fileDirItems.filter { selectedKeys.contains(it.path.hashCode()) } as ArrayList<FileDirItem>
|
||||||
val selectedFileDirItems = ArrayList<FileDirItem>(selectedKeys.size)
|
|
||||||
selectedKeys.forEach {
|
|
||||||
getItemWithKey(it)?.apply {
|
|
||||||
selectedFileDirItems.add(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return selectedFileDirItems
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateItems(newItems: ArrayList<FileDirItem>, highlightText: String = "") {
|
fun updateItems(newItems: ArrayList<FileDirItem>, highlightText: String = "") {
|
||||||
if (newItems.hashCode() != currentItemsHash) {
|
if (newItems.hashCode() != currentItemsHash) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user