pull/737/head
Robot 4 years ago
commit e896309c9a
  1. 17
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt
  3. 26
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt
  4. 10
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt
  5. 26
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt

@ -52,16 +52,17 @@ class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
override fun registerListener(holder: ItemViewHolder, binding: ItemArrangeBookBinding) { override fun registerListener(holder: ItemViewHolder, binding: ItemArrangeBookBinding) {
binding.apply { binding.apply {
checkbox.setOnCheckedChangeListener { buttonView, isChecked -> checkbox.setOnCheckedChangeListener { buttonView, isChecked ->
getItem(holder.layoutPosition)?.let { if (buttonView.isPressed) {
if (buttonView.isPressed) { getItem(holder.layoutPosition)?.let {
if (isChecked) { if (buttonView.isPressed) {
selectedBooks.add(it) if (isChecked) {
} else { selectedBooks.add(it)
selectedBooks.remove(it) } else {
selectedBooks.remove(it)
}
callBack.upSelectCount()
} }
callBack.upSelectCount()
} }
} }
} }
root.onClick { root.onClick {

@ -177,8 +177,8 @@ class GroupSelectDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
override fun registerListener(holder: ItemViewHolder, binding: ItemGroupSelectBinding) { override fun registerListener(holder: ItemViewHolder, binding: ItemGroupSelectBinding) {
with(binding) { with(binding) {
cbGroup.setOnCheckedChangeListener { buttonView, isChecked -> cbGroup.setOnCheckedChangeListener { buttonView, isChecked ->
getItem(holder.layoutPosition)?.let { if (buttonView.isPressed) {
if (buttonView.isPressed) { getItem(holder.layoutPosition)?.let {
groupId = if (isChecked) { groupId = if (isChecked) {
groupId + it.groupId groupId + it.groupId
} else { } else {

@ -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()
} }
} }
} }

@ -101,10 +101,12 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) :
override fun registerListener(holder: ItemViewHolder, binding: ItemReplaceRuleBinding) { override fun registerListener(holder: ItemViewHolder, binding: ItemReplaceRuleBinding) {
binding.apply { binding.apply {
swtEnabled.setOnCheckedChangeListener { _, isChecked -> swtEnabled.setOnCheckedChangeListener { buttonView, isChecked ->
getItem(holder.layoutPosition)?.let { if (buttonView.isPressed) {
it.isEnabled = isChecked getItem(holder.layoutPosition)?.let {
callBack.update(it) it.isEnabled = isChecked
callBack.update(it)
}
} }
} }
ivEdit.onClick { ivEdit.onClick {

@ -98,22 +98,26 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) :
override fun registerListener(holder: ItemViewHolder, binding: ItemRssSourceBinding) { override fun registerListener(holder: ItemViewHolder, binding: ItemRssSourceBinding) {
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)
}
} }
} }
} }
cbSource.setOnCheckedChangeListener { view, checked -> cbSource.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()
} }
} }
} }

Loading…
Cancel
Save