|
|
@ -17,7 +17,7 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) : |
|
|
|
SimpleRecyclerAdapter<ReplaceRule>(context, R.layout.item_replace_rule), |
|
|
|
SimpleRecyclerAdapter<ReplaceRule>(context, R.layout.item_replace_rule), |
|
|
|
ItemTouchCallback.OnItemTouchCallbackListener { |
|
|
|
ItemTouchCallback.OnItemTouchCallbackListener { |
|
|
|
|
|
|
|
|
|
|
|
val selectedIds = linkedSetOf<Long>() |
|
|
|
private val selectedIds = linkedSetOf<Long>() |
|
|
|
|
|
|
|
|
|
|
|
fun selectAll() { |
|
|
|
fun selectAll() { |
|
|
|
getItems().forEach { |
|
|
|
getItems().forEach { |
|
|
@ -37,6 +37,16 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) : |
|
|
|
notifyItemRangeChanged(0, itemCount, 1) |
|
|
|
notifyItemRangeChanged(0, itemCount, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getSelectionIds(): LinkedHashSet<Long> { |
|
|
|
|
|
|
|
val selection = linkedSetOf<Long>() |
|
|
|
|
|
|
|
getItems().map { |
|
|
|
|
|
|
|
if (selectedIds.contains(it.id)) { |
|
|
|
|
|
|
|
selection.add(it.id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return selection |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun convert(holder: ItemViewHolder, item: ReplaceRule, payloads: MutableList<Any>) { |
|
|
|
override fun convert(holder: ItemViewHolder, item: ReplaceRule, payloads: MutableList<Any>) { |
|
|
|
with(holder.itemView) { |
|
|
|
with(holder.itemView) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|