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

@ -52,6 +52,7 @@ 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 ->
if (buttonView.isPressed) {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
if (buttonView.isPressed) { if (buttonView.isPressed) {
if (isChecked) { if (isChecked) {
@ -61,7 +62,7 @@ class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
} }
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,6 +117,7 @@ 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 ->
if (view.isPressed) {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
if (view.isPressed) { if (view.isPressed) {
it.enabled = checked it.enabled = checked
@ -124,7 +125,9 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) :
} }
} }
} }
}
cbBookSource.setOnCheckedChangeListener { view, checked -> cbBookSource.setOnCheckedChangeListener { view, checked ->
if (view.isPressed) {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
if (view.isPressed) { if (view.isPressed) {
if (checked) { if (checked) {
@ -136,6 +139,7 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) :
} }
} }
} }
}
ivEdit.onClick { ivEdit.onClick {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
callBack.edit(it) callBack.edit(it)

@ -101,12 +101,14 @@ 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 ->
if (buttonView.isPressed) {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
it.isEnabled = isChecked it.isEnabled = isChecked
callBack.update(it) callBack.update(it)
} }
} }
}
ivEdit.onClick { ivEdit.onClick {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
callBack.edit(it) callBack.edit(it)

@ -98,6 +98,7 @@ 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 ->
if (view.isPressed) {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
if (view.isPressed) { if (view.isPressed) {
it.enabled = checked it.enabled = checked
@ -105,7 +106,9 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) :
} }
} }
} }
}
cbSource.setOnCheckedChangeListener { view, checked -> cbSource.setOnCheckedChangeListener { view, checked ->
if (view.isPressed) {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
if (view.isPressed) { if (view.isPressed) {
if (checked) { if (checked) {
@ -117,6 +120,7 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) :
} }
} }
} }
}
ivEdit.onClick { ivEdit.onClick {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
callBack.edit(it) callBack.edit(it)

Loading…
Cancel
Save