Skip to content

Instantly share code, notes, and snippets.

@colinrtwhite
Last active September 4, 2018 07:08
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 colinrtwhite/b3931a607650935da939c8d1ff667e9b to your computer and use it in GitHub Desktop.
Save colinrtwhite/b3931a607650935da939c8d1ff667e9b to your computer and use it in GitHub Desktop.
@ColorInt fun Context.getColorCompat(@ColorRes colorRes: Int): Int {
return ContextCompat.getColor(this, colorRes)
}
fun Context.getDrawableCompat(@DrawableRes drawableRes: Int): Drawable {
return AppCompatResources.getDrawable(this, drawableRes)!!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment