Class DynamicToast
Toast with icon and text.
If no color is supplied, it will display default toast based on the vanilla Android.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguration class to customise theDynamicToastattributes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Toastmake(Context context, CharSequence text) Make a standard toast that just contains a text view.static Toastmake(Context context, CharSequence text, int duration) Make a standard toast that just contains a text view.static Toastmake(Context context, CharSequence text, Drawable icon) Make a error toast with icon and the text.static Toastmake(Context context, CharSequence text, Drawable icon, int duration) Make a themed toast with icon and the text.static ToastMake a themed toast with text, icon, background and the tint color.static Toastmake(Context context, CharSequence text, Drawable icon, Integer tintColor, Integer backgroundColor, int duration) Make a themed toast with text, icon, background and the tint color.static Toastmake(Context context, CharSequence text, Integer tintColor, Integer backgroundColor) Make a themed toast with icon and the text.static Toastmake(Context context, CharSequence text, Integer tintColor, Integer backgroundColor, int duration) Make a themed toast with text, background and the tint color.static ToastmakeError(Context context, CharSequence text) Make a error toast with icon and the text.static ToastmakeError(Context context, CharSequence text, int duration) Make a error toast with icon and the text.static ToastmakeSuccess(Context context, CharSequence text) Make a success toast with icon and the text.static ToastmakeSuccess(Context context, CharSequence text, int duration) Make a success toast with icon and the text.static ToastmakeWarning(Context context, CharSequence text) Make a warning toast with icon and the text.static ToastmakeWarning(Context context, CharSequence text, int duration) Make a warning toast with icon and the text.
-
Constructor Details
-
DynamicToast
public DynamicToast()
-
-
Method Details
-
make
Make a standard toast that just contains a text view.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
make
@NonNull public static Toast make(@NonNull Context context, @Nullable CharSequence text, int duration) Make a standard toast that just contains a text view.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.duration- The duration for the toast, eitherToast.LENGTH_SHORTorToast.LENGTH_LONG.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
makeError
Make a error toast with icon and the text.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
makeError
@NonNull public static Toast makeError(@NonNull Context context, @Nullable CharSequence text, int duration) Make a error toast with icon and the text.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.duration- The duration for the toast, eitherToast.LENGTH_SHORTorToast.LENGTH_LONG.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
makeSuccess
Make a success toast with icon and the text.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
makeSuccess
@NonNull public static Toast makeSuccess(@NonNull Context context, @Nullable CharSequence text, int duration) Make a success toast with icon and the text.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.duration- The duration for the toast, eitherToast.LENGTH_SHORTorToast.LENGTH_LONG.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
makeWarning
Make a warning toast with icon and the text.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
makeWarning
@NonNull public static Toast makeWarning(@NonNull Context context, @Nullable CharSequence text, int duration) Make a warning toast with icon and the text.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.duration- The duration for the toast, eitherToast.LENGTH_SHORTorToast.LENGTH_LONG.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
make
@NonNull public static Toast make(@NonNull Context context, @Nullable CharSequence text, @Nullable Drawable icon) Make a error toast with icon and the text.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.icon- The toast icon to show.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
make
@NonNull public static Toast make(@NonNull Context context, @Nullable CharSequence text, @Nullable Drawable icon, int duration) Make a themed toast with icon and the text.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.icon- The toast icon to show.duration- The duration for the toast, eitherToast.LENGTH_SHORTorToast.LENGTH_LONG.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
make
@NonNull public static Toast make(@NonNull Context context, @Nullable CharSequence text, @Nullable @ColorInt Integer tintColor, @Nullable @ColorInt Integer backgroundColor) Make a themed toast with icon and the text.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.tintColor- The toast tint color based on the toast background.It will automatically check for the contrast to provide the best visibility.
backgroundColor- The toast background color.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
make
@NonNull public static Toast make(@NonNull Context context, @Nullable CharSequence text, @Nullable @ColorInt Integer tintColor, @Nullable @ColorInt Integer backgroundColor, int duration) Make a themed toast with text, background and the tint color.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.tintColor- The toast tint color based on the toast background.It will automatically check for the contrast to provide the best visibility.
backgroundColor- The toast background color.duration- The duration for the toast, eitherToast.LENGTH_SHORTorToast.LENGTH_LONG.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
make
@NonNull public static Toast make(@NonNull Context context, @Nullable CharSequence text, @Nullable Drawable icon, @Nullable @ColorInt Integer tintColor, @Nullable @ColorInt Integer backgroundColor) Make a themed toast with text, icon, background and the tint color.The toast duration will be
Toast.LENGTH_SHORT.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.icon- The toast icon to show.tintColor- The toast tint color based on the toast background.It will automatically check for the contrast to provide the best visibility.
backgroundColor- The toast background color.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-
make
@NonNull public static Toast make(@NonNull Context context, @Nullable CharSequence text, @Nullable Drawable icon, @Nullable @ColorInt Integer tintColor, @Nullable @ColorInt Integer backgroundColor, int duration) Make a themed toast with text, icon, background and the tint color.- Parameters:
context- The context to use.text- The text to show. Can be formatted text.icon- The toast icon to show.tintColor- The toast tint color based on the toast background.It will automatically check for the contrast to provide the best visibility.
backgroundColor- The toast background color.duration- The duration for the toast, eitherToast.LENGTH_SHORTorToast.LENGTH_LONG.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()to display the toast.
-