update selectable item count at deleting an item

This commit is contained in:
tibbi 2017-11-19 18:24:43 +01:00
parent 0a023dd0fa
commit 7f31975053
1 changed files with 4 additions and 7 deletions

View File

@ -366,15 +366,12 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
listener?.deleteFiles(files)
val newItems = SparseArray<View>()
var curIndex = 0
for (i in 0 until itemViews.size()) {
if (itemViews[i] != null) {
newItems.put(curIndex, itemViews[i])
curIndex++
}
}
(0 until itemViews.size())
.filter { itemViews[it] != null }
.forEachIndexed { curIndex, i -> newItems.put(curIndex, itemViews[i]) }
itemViews = newItems
selectableItemCount = fileDirItems.size
}
}