public class DrawableHelper
extends java.lang.Object
Drawable
helper class.Modifier and Type | Field and Description |
---|---|
private int |
mColor |
private android.content.Context |
mContext |
private android.graphics.drawable.Drawable |
mDrawable |
private android.graphics.drawable.Drawable |
mWrappedDrawable |
Modifier | Constructor and Description |
---|---|
private |
DrawableHelper(android.content.Context context) |
Modifier and Type | Method and Description |
---|---|
void |
applyTo(android.widget.CheckBox checkBox) |
void |
applyTo(android.widget.ImageView imageView) |
void |
applyTo(android.view.MenuItem menuItem) |
void |
applyToBackground(android.view.View view) |
void |
applyToDrawableLeft(android.widget.CheckBox checkBox) |
android.graphics.drawable.Drawable |
get() |
static void |
setImageViewEnabled(android.widget.ImageView view,
boolean enabled)
Set the enabled state appearance of an ImageView
|
DrawableHelper |
tint() |
static void |
tintAccentColor(android.content.Context context,
java.util.List<android.widget.ImageView> imageList)
Tint a List of ImageViews with the accent color
|
static void |
tintAccentColor(android.widget.ImageView imageView)
Tint an ImageView with the accent color
|
private static void |
tintColor(int color,
java.util.List<android.widget.ImageView> imageList)
Tint a List of ImageViews with a color
|
static void |
tintPrimaryColor(android.content.Context context,
java.util.List<android.widget.ImageView> imageList)
Tint a List of ImageViews with the primary color
|
static void |
tintPrimaryColor(android.widget.ImageView imageView,
boolean reverse)
Tint an ImageView with the primary color
|
DrawableHelper |
withColor(int colorRes) |
static DrawableHelper |
withContext(android.content.Context context) |
DrawableHelper |
withDrawable(android.graphics.drawable.Drawable drawable) |
DrawableHelper |
withDrawable(int drawableRes) |
@NonNull private final android.content.Context mContext
private int mColor
private android.graphics.drawable.Drawable mDrawable
private android.graphics.drawable.Drawable mWrappedDrawable
public static void setImageViewEnabled(@NonNull android.widget.ImageView view, boolean enabled)
view
- The viewenabled
- The statepublic static void tintAccentColor(@NonNull android.widget.ImageView imageView)
imageView
- The listpublic static void tintPrimaryColor(@NonNull android.widget.ImageView imageView, boolean reverse)
imageView
- The listreverse
- If true, reverse the colorpublic static void tintAccentColor(@NonNull android.content.Context context, @NonNull java.util.List<android.widget.ImageView> imageList)
context
- A ContextimageList
- The listpublic static void tintPrimaryColor(@NonNull android.content.Context context, @NonNull java.util.List<android.widget.ImageView> imageList)
context
- A ContextimageList
- The listprivate static void tintColor(int color, @NonNull java.util.List<android.widget.ImageView> imageList)
color
- A color resource idimageList
- The listpublic static DrawableHelper withContext(@NonNull android.content.Context context)
public DrawableHelper withDrawable(@DrawableRes int drawableRes)
public DrawableHelper withDrawable(@NonNull android.graphics.drawable.Drawable drawable)
public DrawableHelper withColor(@ColorRes int colorRes)
public DrawableHelper tint()
public void applyToBackground(@NonNull android.view.View view)
public void applyTo(@NonNull android.widget.ImageView imageView)
public void applyTo(@NonNull android.view.MenuItem menuItem)
public void applyTo(@NonNull android.widget.CheckBox checkBox)
public void applyToDrawableLeft(@NonNull android.widget.CheckBox checkBox)
public android.graphics.drawable.Drawable get()