pull/32/head
kunfei 5 years ago
parent b9aab12513
commit 39e3ffe5a3
  1. 1
      app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt
  2. 9
      app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleAdapter.kt

@ -102,7 +102,6 @@ class ReplaceRuleActivity : VMBaseActivity<ReplaceRuleViewModel>(R.layout.activi
}
replaceRuleLiveData?.observe(this, Observer {
val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), it))
adapter.selectedIds.clear()
adapter.setItemsNoNotify(it)
diffResult.dispatchUpdatesTo(adapter)
})

@ -20,13 +20,10 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) :
val selectedIds = linkedSetOf<Long>()
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() {

Loading…
Cancel
Save