Last active
December 9, 2018 00:59
-
-
Save guuilp/1400e30ba066edcf29c138745a245859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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