Skip to content

Instantly share code, notes, and snippets.

@guuilp
Last active December 9, 2018 00:59
Embed
What would you like to do?
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.apply {
checkBox.isChecked = position == mCheckedPosition
checkBox.setOnClickListener {
if(position == mCheckedPosition) {
checkBox.isChecked = false
mCheckedPosition = -1
} else {
mCheckedPosition = position
notifyDataSetChanged()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment