1
0
Fork 0
mirror of https://github.com/mihonapp/mihon.git synced 2025-03-06 22:45:44 +03:00

Fix clear database selection toggling (fixes )

This commit is contained in:
arkon 2022-03-26 16:12:15 -04:00
parent c06ad8b87e
commit 85be4c492d

View file

@ -88,11 +88,9 @@ class ClearDatabaseController :
when (item.itemId) {
R.id.action_select_all -> adapter.selectAll()
R.id.action_select_inverse -> {
val currentSelection = adapter.selectedPositionsAsSet
val invertedSelection = (0..adapter.itemCount)
.filterNot { currentSelection.contains(it) }
currentSelection.clear()
currentSelection.addAll(invertedSelection)
adapter.currentItems.forEachIndexed { index, _ ->
adapter.toggleSelection(index)
}
}
}
updateFab()