Skip to content

Commit 7f31975

Browse files
committed
update selectable item count at deleting an item
1 parent 0a023dd commit 7f31975

File tree

1 file changed

+4
-7
lines changed
  • app/src/main/kotlin/com/simplemobiletools/filemanager/adapters

1 file changed

+4
-7
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,12 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
366366
listener?.deleteFiles(files)
367367

368368
val newItems = SparseArray<View>()
369-
var curIndex = 0
370-
for (i in 0 until itemViews.size()) {
371-
if (itemViews[i] != null) {
372-
newItems.put(curIndex, itemViews[i])
373-
curIndex++
374-
}
375-
}
369+
(0 until itemViews.size())
370+
.filter { itemViews[it] != null }
371+
.forEachIndexed { curIndex, i -> newItems.put(curIndex, itemViews[i]) }
376372

377373
itemViews = newItems
374+
selectableItemCount = fileDirItems.size
378375
}
379376
}
380377

0 commit comments

Comments
 (0)