Class DynamicToast.Config
- java.lang.Object
-
- com.pranavpandey.android.dynamic.toasts.DynamicToast.Config
-
- Enclosing class:
- DynamicToast
public static class DynamicToast.Config extends java.lang.ObjectConfiguration class to customise theDynamicToastattributes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply()Apply customisations.static DynamicToast.ConfiggetInstance()Get instance to access public methods.voidreset()Reset customisations.DynamicToast.ConfigsetDefaultBackgroundColor(java.lang.Integer defaultBackgroundColor)Set the default background color.DynamicToast.ConfigsetDefaultTintColor(java.lang.Integer defaultTintColor)Set the default tint color.DynamicToast.ConfigsetDisableIcon(boolean disableIcon)Set the icon visibility.DynamicToast.ConfigsetErrorBackgroundColor(java.lang.Integer errorBackgroundColor)Set the error background color.DynamicToast.ConfigsetErrorIcon(android.graphics.drawable.Drawable errorIcon)Set the error icon.DynamicToast.ConfigsetIconSize(int iconSize)Set the icon size.DynamicToast.ConfigsetSuccessBackgroundColor(java.lang.Integer successBackgroundColor)Set the success background color.DynamicToast.ConfigsetSuccessIcon(android.graphics.drawable.Drawable successIcon)Set the success icon.DynamicToast.ConfigsetTextSize(int textSize)Set the text size.DynamicToast.ConfigsetTextTypeface(android.graphics.Typeface textTypeface)Set the text typeface.DynamicToast.ConfigsetTintIcon(boolean tintIcon)Set whether to tint the icon.DynamicToast.ConfigsetToastBackground(android.graphics.drawable.Drawable toastBackground)Set the toast background.DynamicToast.ConfigsetWarningBackgroundColor(java.lang.Integer warningBackgroundColor)Set the warning background color.DynamicToast.ConfigsetWarningIcon(android.graphics.drawable.Drawable warningIcon)Set the warning icon.
-
-
-
Method Detail
-
getInstance
@NonNull public static DynamicToast.Config getInstance()
Get instance to access public methods. Must be called before accessing methods.- Returns:
- The singleton instance of this class.
-
setDefaultBackgroundColor
@NonNull public DynamicToast.Config setDefaultBackgroundColor(@Nullable @ColorInt java.lang.Integer defaultBackgroundColor)
Set the default background color.- Parameters:
defaultBackgroundColor- The background color to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setDefaultTintColor
@NonNull public DynamicToast.Config setDefaultTintColor(@Nullable @ColorInt java.lang.Integer defaultTintColor)
Set the default tint color.- Parameters:
defaultTintColor- The tint color to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setErrorBackgroundColor
@NonNull public DynamicToast.Config setErrorBackgroundColor(@Nullable @ColorInt java.lang.Integer errorBackgroundColor)
Set the error background color.- Parameters:
errorBackgroundColor- The error background color to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setSuccessBackgroundColor
@NonNull public DynamicToast.Config setSuccessBackgroundColor(@Nullable @ColorInt java.lang.Integer successBackgroundColor)
Set the success background color.- Parameters:
successBackgroundColor- The success background color to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setWarningBackgroundColor
@NonNull public DynamicToast.Config setWarningBackgroundColor(@Nullable @ColorInt java.lang.Integer warningBackgroundColor)
Set the warning background color.- Parameters:
warningBackgroundColor- The warning background color to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setErrorIcon
@NonNull public DynamicToast.Config setErrorIcon(@Nullable android.graphics.drawable.Drawable errorIcon)
Set the error icon.Pass
nullto use the default icon.- Parameters:
errorIcon- The error icon to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setSuccessIcon
@NonNull public DynamicToast.Config setSuccessIcon(@Nullable android.graphics.drawable.Drawable successIcon)
Set the success icon.Pass
nullto use the default icon.- Parameters:
successIcon- The success icon to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setWarningIcon
@NonNull public DynamicToast.Config setWarningIcon(@Nullable android.graphics.drawable.Drawable warningIcon)
Set the warning icon.Pass
nullto use the default icon.- Parameters:
warningIcon- The warning icon to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setDisableIcon
@NonNull public DynamicToast.Config setDisableIcon(boolean disableIcon)
Set the icon visibility.- Parameters:
disableIcon-trueto disable icon for all the toasts.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setTintIcon
@NonNull public DynamicToast.Config setTintIcon(boolean tintIcon)
Set whether to tint the icon.- Parameters:
tintIcon-trueto tint icon for all the toasts.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setIconSize
@NonNull public DynamicToast.Config setIconSize(int iconSize)
Set the icon size.- Parameters:
iconSize- The icon size to be set inpixels.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setTextSize
@NonNull public DynamicToast.Config setTextSize(int textSize)
Set the text size.- Parameters:
textSize- The text size to be set insp.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setTextTypeface
@NonNull public DynamicToast.Config setTextTypeface(@Nullable android.graphics.Typeface textTypeface)
Set the text typeface.Pass
nullto use the default typeface.- Parameters:
textTypeface- The text typeface to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
setToastBackground
@NonNull public DynamicToast.Config setToastBackground(@Nullable android.graphics.drawable.Drawable toastBackground)
Set the toast background.Pass
nullto use the default background.- Parameters:
toastBackground- The toast background to be set.- Returns:
- The
DynamicToast.Configobject to allow for chaining of calls to set methods.
-
apply
public void apply()
Apply customisations.
-
reset
public void reset()
Reset customisations.
-
-