|
|
@ -117,22 +117,26 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) : |
|
|
|
override fun registerListener(holder: ItemViewHolder, binding: ItemBookSourceBinding) { |
|
|
|
override fun registerListener(holder: ItemViewHolder, binding: ItemBookSourceBinding) { |
|
|
|
binding.apply { |
|
|
|
binding.apply { |
|
|
|
swtEnabled.setOnCheckedChangeListener { view, checked -> |
|
|
|
swtEnabled.setOnCheckedChangeListener { view, checked -> |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
if (view.isPressed) { |
|
|
|
if (view.isPressed) { |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
it.enabled = checked |
|
|
|
if (view.isPressed) { |
|
|
|
callBack.update(it) |
|
|
|
it.enabled = checked |
|
|
|
|
|
|
|
callBack.update(it) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
cbBookSource.setOnCheckedChangeListener { view, checked -> |
|
|
|
cbBookSource.setOnCheckedChangeListener { view, checked -> |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
if (view.isPressed) { |
|
|
|
if (view.isPressed) { |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
if (checked) { |
|
|
|
if (view.isPressed) { |
|
|
|
selected.add(it) |
|
|
|
if (checked) { |
|
|
|
} else { |
|
|
|
selected.add(it) |
|
|
|
selected.remove(it) |
|
|
|
} else { |
|
|
|
|
|
|
|
selected.remove(it) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
callBack.upCountView() |
|
|
|
} |
|
|
|
} |
|
|
|
callBack.upCountView() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|