|
|
@ -49,29 +49,40 @@ class ArrangeBookAdapter(context: Context, val callBack: CallBack) : |
|
|
|
} |
|
|
|
} |
|
|
|
tv_author.text = getGroupName(item.group) |
|
|
|
tv_author.text = getGroupName(item.group) |
|
|
|
checkbox.isChecked = selectedBooks.contains(item) |
|
|
|
checkbox.isChecked = selectedBooks.contains(item) |
|
|
|
checkbox.onClick { |
|
|
|
checkbox.setOnCheckedChangeListener { buttonView, isChecked -> |
|
|
|
if (checkbox.isChecked) { |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
selectedBooks.add(item) |
|
|
|
if (buttonView.isPressed) { |
|
|
|
|
|
|
|
if (isChecked) { |
|
|
|
|
|
|
|
selectedBooks.add(it) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selectedBooks.remove(item) |
|
|
|
selectedBooks.remove(it) |
|
|
|
} |
|
|
|
} |
|
|
|
callBack.upSelectCount() |
|
|
|
callBack.upSelectCount() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
onClick { |
|
|
|
onClick { |
|
|
|
|
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
checkbox.isChecked = !checkbox.isChecked |
|
|
|
checkbox.isChecked = !checkbox.isChecked |
|
|
|
if (checkbox.isChecked) { |
|
|
|
if (checkbox.isChecked) { |
|
|
|
selectedBooks.add(item) |
|
|
|
selectedBooks.add(it) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selectedBooks.remove(item) |
|
|
|
selectedBooks.remove(it) |
|
|
|
} |
|
|
|
} |
|
|
|
callBack.upSelectCount() |
|
|
|
callBack.upSelectCount() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
tv_delete.onClick { |
|
|
|
tv_delete.onClick { |
|
|
|
callBack.deleteBook(item) |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
|
|
|
|
callBack.deleteBook(it) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
tv_group.onClick { |
|
|
|
tv_group.onClick { |
|
|
|
actionItem = item |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
callBack.selectGroup(item.group, groupRequestCode) |
|
|
|
actionItem = it |
|
|
|
|
|
|
|
callBack.selectGroup(it.group, groupRequestCode) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|