Class DynamicToast.Config

  • Enclosing class:
    DynamicToast

    public static class DynamicToast.Config
    extends java.lang.Object
    Configuration class to customise the DynamicToast attributes.
    • 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.Config object 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.Config object 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.Config object 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.Config object 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.Config object 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 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

        @NonNull
        public DynamicToast.Config setSuccessIcon​(@Nullable
                                                  android.graphics.drawable.Drawable successIcon)
        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

        @NonNull
        public DynamicToast.Config setWarningIcon​(@Nullable
                                                  android.graphics.drawable.Drawable warningIcon)
        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

        @NonNull
        public DynamicToast.Config setDisableIcon​(boolean disableIcon)
        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

        @NonNull
        public DynamicToast.Config setTintIcon​(boolean tintIcon)
        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

        @NonNull
        public DynamicToast.Config setIconSize​(int iconSize)
        Set the icon size.
        Parameters:
        iconSize - The icon size to be set in pixels.
        Returns:
        The DynamicToast.Config object 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 in sp.
        Returns:
        The DynamicToast.Config object 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 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

        @NonNull
        public DynamicToast.Config setToastBackground​(@Nullable
                                                      android.graphics.drawable.Drawable toastBackground)
        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.