Created
March 15, 2019 13:02
-
-
Save alz-ahm/2c8f83e13beaf8c3f8dbf4c97c71b009 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
//Without Extension | |
view1.setOnClickListener... | |
view2.setOnClickListener... | |
viewN.setOnClickListener... | |
//With Extension | |
constraintGroup.setAllOnClickListener { | |
} | |
//Extension function | |
fun Group.setAllOnClickListener(listener: (View) -> Unit) { | |
referencedIds.forEach { id -> | |
rootView.findViewById<View>(id).setOnClickListener(listener) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment