Skip to content

Instantly share code, notes, and snippets.

@guuilp
Last active December 9, 2018 00:59
Show Gist options
  • Save guuilp/1400e30ba066edcf29c138745a245859 to your computer and use it in GitHub Desktop.
Save guuilp/1400e30ba066edcf29c138745a245859 to your computer and use it in GitHub Desktop.
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