diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt index 40adfd95d..b043f4af7 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt @@ -102,7 +102,6 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi } replaceRuleLiveData?.observe(this, Observer { val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), it)) - adapter.selectedIds.clear() adapter.setItemsNoNotify(it) diffResult.dispatchUpdatesTo(adapter) }) diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleAdapter.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleAdapter.kt index e32b509ef..00af7e1ac 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleAdapter.kt @@ -20,13 +20,10 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) : val selectedIds = linkedSetOf() fun selectAll() { - if (selectedIds.size == itemCount) { - selectedIds.clear() - notifyItemRangeChanged(0, itemCount, 1) - } else { - getItems().forEach { selectedIds.add(it.id) } - notifyItemRangeChanged(0, itemCount, 1) + getItems().forEach { + selectedIds.add(it.id) } + notifyItemRangeChanged(0, itemCount, 1) } fun revertSelection() {