Skip to content

Instantly share code, notes, and snippets.

@StylingAndroid
Created April 19, 2019 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StylingAndroid/33c902cb26a565ccbd1546f703b14a37 to your computer and use it in GitHub Desktop.
Save StylingAndroid/33c902cb26a565ccbd1546f703b14a37 to your computer and use it in GitHub Desktop.
fun main() {
val classThree = ClassThree()
val color3 = classThree.obtainColor(context, R.color.my_color, ContextCompat::getColor)
}
class ClassThree {
fun obtainColor(context: Context, colorRes: Int, colorLookup: (Context, Int) -> Int) = colorLookup(context, colorRes)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment