Class DynamicToast.Config
java.lang.Object
com.pranavpandey.android.dynamic.toasts.DynamicToast.Config
- Enclosing class:
- DynamicToast
Configuration class to customise the
DynamicToast
attributes.-
Method Summary
Modifier and TypeMethodDescriptionvoid
apply()
Apply customisations.static DynamicToast.Config
Get instance to access public methods.void
reset()
Reset customisations.setDefaultBackgroundColor
(Integer defaultBackgroundColor) Set the default background color.setDefaultTintColor
(Integer defaultTintColor) Set the default tint color.setDisableIcon
(boolean disableIcon) Set the icon visibility.setErrorBackgroundColor
(Integer errorBackgroundColor) Set the error background color.setErrorIcon
(Drawable errorIcon) Set the error icon.setIconSize
(int iconSize) Set the icon size.setSuccessBackgroundColor
(Integer successBackgroundColor) Set the success background color.setSuccessIcon
(Drawable successIcon) Set the success icon.setTextSize
(int textSize) Set the text size.setTextTypeface
(Typeface textTypeface) Set the text typeface.setTintIcon
(boolean tintIcon) Set whether to tint the icon.setToastBackground
(Drawable toastBackground) Set the toast background.setWarningBackgroundColor
(Integer warningBackgroundColor) Set the warning background color.setWarningIcon
(Drawable warningIcon) Set the warning icon.
-
Method Details
-
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 Integer defaultBackgroundColor) Set the default background color.- Parameters:
defaultBackgroundColor
- The background color to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setDefaultTintColor
@NonNull public DynamicToast.Config setDefaultTintColor(@Nullable @ColorInt Integer defaultTintColor) Set the default tint color.- Parameters:
defaultTintColor
- The tint color to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setErrorBackgroundColor
@NonNull public DynamicToast.Config setErrorBackgroundColor(@Nullable @ColorInt Integer errorBackgroundColor) Set the error background color.- Parameters:
errorBackgroundColor
- The error background color to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setSuccessBackgroundColor
@NonNull public DynamicToast.Config setSuccessBackgroundColor(@Nullable @ColorInt Integer successBackgroundColor) Set the success background color.- Parameters:
successBackgroundColor
- The success background color to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setWarningBackgroundColor
@NonNull public DynamicToast.Config setWarningBackgroundColor(@Nullable @ColorInt Integer warningBackgroundColor) Set the warning background color.- Parameters:
warningBackgroundColor
- The warning background color to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setErrorIcon
Set the error icon.Pass
null
to use the default icon.- Parameters:
errorIcon
- The error icon to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setSuccessIcon
Set the success icon.Pass
null
to use the default icon.- Parameters:
successIcon
- The success icon to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setWarningIcon
Set the warning icon.Pass
null
to use the default icon.- Parameters:
warningIcon
- The warning icon to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setDisableIcon
Set the icon visibility.- Parameters:
disableIcon
-true
to disable icon for all the toasts.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setTintIcon
Set whether to tint the icon.- Parameters:
tintIcon
-true
to tint icon for all the toasts.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setIconSize
Set the icon size.- Parameters:
iconSize
- The icon size to be set inpixels
.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setTextSize
Set the text size.- Parameters:
textSize
- The text size to be set insp
.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setTextTypeface
Set the text typeface.Pass
null
to use the default typeface.- Parameters:
textTypeface
- The text typeface to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
setToastBackground
Set the toast background.Pass
null
to use the default background.- Parameters:
toastBackground
- The toast background to be set.- Returns:
- The
DynamicToast.Config
object to allow for chaining of calls to set methods.
-
apply
public void apply()Apply customisations. -
reset
public void reset()Reset customisations.
-