From 39e3ffe5a37520694423441c709268fa50e5dc13 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 8 Sep 2019 10:40:49 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/replacerule/ReplaceRuleActivity.kt | 1 - .../io/legado/app/ui/replacerule/ReplaceRuleAdapter.kt | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) 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() {