From 85be4c492d851a1419edd33c910f6b2614de38dd Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 26 Mar 2022 16:12:15 -0400 Subject: [PATCH] Fix clear database selection toggling (fixes #6807) --- .../ui/setting/database/ClearDatabaseController.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/database/ClearDatabaseController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/database/ClearDatabaseController.kt index 6bcfc6e575..a47075667a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/database/ClearDatabaseController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/database/ClearDatabaseController.kt @@ -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()