Package com.jeovanimartinez.androidutils.extensions.context

Functions

Link copied to clipboard
fun Context.getColorCompat(@ColorRes id: Int): Int

Get a color from the resources based on their ID using ResourcesCompat.getColor()

Link copied to clipboard
fun Context.getDrawableCompat(@DrawableRes id: Int): Drawable?

Get a Drawable from the resources based on their ID using AppCompatResources.getDrawable()

Link copied to clipboard
fun Context.getFontCompat(@FontRes id: Int): Typeface?

Get a font from the resources based on their ID using ResourcesCompat.getFont()

Link copied to clipboard
fun Context.longToast(@StringRes message: Int)

Show a long toast with the indicated message (the message must be the string resource ID)

fun Context.longToast(message: String)

Show a long toast with the indicated message (the message must be a String)

Link copied to clipboard
fun Context.shortToast(@StringRes message: Int)

Show a short toast with the indicated message (the message must be the string resource ID)

fun Context.shortToast(message: String)

Show a short toast with the indicated message (the message must be a String)

Link copied to clipboard
fun Context.typeAsDrawable(@DrawableOrDrawableRes drawableOrDrawableRes: Any?): Drawable?

Parses the received data type drawableOrDrawableRes and always returns a Drawable.

Link copied to clipboard
fun Context.typeAsString(@StringOrStringRes stringOrStringRes: Any): String

Parses the received data type stringOrStringRes and always returns a String.