Fix chapter list selection uninverting (closes #3014)

This commit is contained in:
arkon 2020-05-01 19:49:33 -04:00
parent fc7a040509
commit 33d2b0984f
2 changed files with 5 additions and 3 deletions

View File

@ -139,6 +139,7 @@ class ChaptersController :
val coordinates = binding.fab.getCoordinates() val coordinates = binding.fab.getCoordinates()
binding.revealView.hideRevealEffect(coordinates.x, coordinates.y, 1920) binding.revealView.hideRevealEffect(coordinates.x, coordinates.y, 1920)
} }
super.onActivityResumed(activity) super.onActivityResumed(activity)
} }
@ -457,9 +458,13 @@ class ChaptersController :
private fun selectInverse() { private fun selectInverse() {
val adapter = adapter ?: return val adapter = adapter ?: return
selectedItems.clear()
for (i in 0..adapter.itemCount) { for (i in 0..adapter.itemCount) {
adapter.toggleSelection(i) adapter.toggleSelection(i)
} }
selectedItems.addAll(adapter.selectedPositions.mapNotNull { adapter.getItem(it) })
actionMode?.invalidate() actionMode?.invalidate()
adapter.notifyDataSetChanged() adapter.notifyDataSetChanged()
} }

View File

@ -265,9 +265,6 @@ class UpdatesController :
presenter.deleteChapters(chaptersToDelete) presenter.deleteChapters(chaptersToDelete)
} }
/**
* Destory [ActionMode] if it's shown
*/
private fun destroyActionModeIfNeeded() { private fun destroyActionModeIfNeeded() {
actionMode?.finish() actionMode?.finish()
} }