Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exclusive Selection Less Code
...
for ((index, button) in moodButtonCollection.withIndex()) {
button?.setOnClickListener({ view ->
for (button in moodButtonCollection) button?.setBackgroundColor(unselectedColor);
view.setBackgroundColor(selectedColor);
currentMood = Mood.values()[index]
})
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment