public class ResourceUtil
extends java.lang.Object
| Constructor and Description |
|---|
ResourceUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
getColor(android.content.Context context,
int colorRes)
Retrieves the color specified with the
colorRes. |
static android.content.res.ColorStateList |
getColorStateList(android.content.Context context,
int colorRes)
Retrieves the ColorStateList specified with the
colorRes. |
static android.graphics.drawable.Drawable |
getDrawable(android.content.Context context,
int drawableResourceId)
Retrieves the drawable specified with the
resourceId. |
static int |
getResolvedResourceId(android.content.Context context,
int attr)
Resolves the reference to an attribute, returning the root resource id.
|
static android.graphics.drawable.Drawable |
tint(android.content.Context context,
android.graphics.drawable.Drawable drawable,
int colorRes)
Retrieves the drawable specified with the
drawable using the
colorRes to correctly tint it before returning the Drawable
object. |
static android.graphics.drawable.Drawable |
tint(android.content.Context context,
int drawableRes,
int colorRes)
Retrieves the drawable specified with the
drawableRes using the
colorRes to correctly tint it before returning the Drawable
object. |
static android.graphics.drawable.Drawable |
tintList(android.content.Context context,
android.graphics.drawable.Drawable drawable,
int tintListRes)
Retrieves the drawable specified with the
drawable using the
tintListRes to correctly tint it before returning the Drawable
object. |
static android.graphics.drawable.Drawable |
tintList(android.content.Context context,
int drawableRes,
int tintListRes)
Retrieves the drawable specified with the
drawableRes using the
tintListRes to correctly tint it before returning the Drawable
object. |
public static android.graphics.drawable.Drawable tint(android.content.Context context,
int drawableRes,
int colorRes)
drawableRes using the
colorRes to correctly tint it before returning the Drawable
object.context - The context to use for retrieving the drawabledrawableRes - The resource id for the drawable to retrievecolorRes - The resource id for the color to use for tintingpublic static android.graphics.drawable.Drawable tint(android.content.Context context,
android.graphics.drawable.Drawable drawable,
int colorRes)
drawable using the
colorRes to correctly tint it before returning the Drawable
object.context - The context to use for retrieving the drawabledrawable - The Drawable to tintcolorRes - The resource id for the color to use for tintingpublic static android.graphics.drawable.Drawable tintList(android.content.Context context,
int drawableRes,
int tintListRes)
drawableRes using the
tintListRes to correctly tint it before returning the Drawable
object.context - The context to use for retrieving the drawabledrawableRes - The resource id for the drawable to retrievetintListRes - The resource id for the ColorStateList to use for tintingpublic static android.graphics.drawable.Drawable tintList(android.content.Context context,
android.graphics.drawable.Drawable drawable,
int tintListRes)
drawable using the
tintListRes to correctly tint it before returning the Drawable
object.context - The context to use for retrieving the drawabledrawable - The Drawable to tinttintListRes - The resource id for the ColorStateList to use for tintingpublic static android.graphics.drawable.Drawable getDrawable(android.content.Context context,
int drawableResourceId)
resourceId. This
is a helper method to deal with the API differences for retrieving drawablescontext - The context to use when retrieving the drawabledrawableResourceId - The id for the drawable to retrieveresourceIdpublic static int getResolvedResourceId(android.content.Context context,
int attr)
context - The context to use when determining the root idattr - The attribute to resolvepublic static int getColor(android.content.Context context,
int colorRes)
colorRes. This
is a helper method to deal with the API differences for retrieving colors.context - The context to use when retrieving the colorcolorRes - The id for the color to retrievecolorRespublic static android.content.res.ColorStateList getColorStateList(android.content.Context context,
int colorRes)
colorRes. This
is a helper method to deal with the API differences for retrieving colors.context - The context to use when retrieving the colorcolorRes - The id for the ColorStateList to retrievecolorRes