Class DynamicTintUtils
java.lang.Object
com.pranavpandey.android.dynamic.support.util.DynamicTintUtils
Helper class to perform various tint operations on views.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
colorizeRippleDrawable
(View view, Drawable drawable, int background, int color, boolean borderless, boolean checkable) Colorize a ripple drawable tint according to the supplied view and color.static void
setInsetForegroundColor
(com.google.android.material.internal.ScrimInsetsFrameLayout view, int color, boolean drawBottomInset) Try to set the inset foreground color for the view.static void
setViewBackgroundTint
(View view, int background, boolean borderless) Set a view background tint according to the supplied color.static void
setViewBackgroundTint
(View view, int background, int color, boolean borderless, boolean checkable) Set a view background tint according to the supplied color.static void
setViewForegroundTint
(View view, int background, boolean borderless) Set a view background tint according to the supplied color.static void
setViewForegroundTint
(View view, int background, int color, boolean borderless, boolean checkable) Set a view foreground tint according to the supplied color.
-
Constructor Details
-
DynamicTintUtils
public DynamicTintUtils()
-
-
Method Details
-
colorizeRippleDrawable
public static void colorizeRippleDrawable(@Nullable View view, @Nullable Drawable drawable, @ColorInt int background, @ColorInt int color, boolean borderless, boolean checkable) Colorize a ripple drawable tint according to the supplied view and color.- Parameters:
view
- The view to check the background tint.drawable
- The ripple drawable to be colorized.background
- The background color to calculate the default color.color
- The tint color to be used.borderless
-true
if the view is borderless.checkable
-true
if the view is checkable.
-
setViewBackgroundTint
public static void setViewBackgroundTint(@Nullable View view, @ColorInt int background, @ColorInt int color, boolean borderless, boolean checkable) Set a view background tint according to the supplied color.- Parameters:
view
- The view to set the background tint.background
- The background color to calculate the default color.color
- The tint color to be used.borderless
-true
if the view is borderless.checkable
-true
if the view is checkable.
-
setViewBackgroundTint
public static void setViewBackgroundTint(@Nullable View view, @ColorInt int background, boolean borderless) Set a view background tint according to the supplied color.- Parameters:
view
- The view to set the background tint.background
- The background color to consider the background aware.borderless
-true
if the view is borderless.
-
setViewForegroundTint
public static void setViewForegroundTint(@Nullable View view, @ColorInt int background, @ColorInt int color, boolean borderless, boolean checkable) Set a view foreground tint according to the supplied color.- Parameters:
view
- The view to set the foreground tint.background
- The background color to consider the background aware.color
- The tint color to be used.borderless
-true
if the view is borderless.checkable
-true
if the view is checkable.
-
setViewForegroundTint
public static void setViewForegroundTint(@Nullable View view, @ColorInt int background, boolean borderless) Set a view background tint according to the supplied color.- Parameters:
view
- The view to set the foreground tint.background
- The background color to consider the background aware.borderless
-true
if the view is borderless.
-
setInsetForegroundColor
public static void setInsetForegroundColor(@Nullable com.google.android.material.internal.ScrimInsetsFrameLayout view, @ColorInt int color, boolean drawBottomInset) Try to set the inset foreground color for the view.- Parameters:
view
- The view set the inset foreground color.color
- The scrim color to be set.drawBottomInset
-true
to draw the bottom inset.
-