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
Modifier and TypeClassDescriptionstatic class
Configuration class to customise theDynamicToast
attributes. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Toast
make
(Context context, CharSequence text) Make a standard toast that just contains a text view.static Toast
make
(Context context, CharSequence text, int duration) Make a standard toast that just contains a text view.static Toast
make
(Context context, CharSequence text, Drawable icon) Make a error toast with icon and the text.static Toast
make
(Context context, CharSequence text, Drawable icon, int duration) Make a themed toast with icon and the text.static Toast
Make a themed toast with text, icon, background and the tint color.static Toast
make
(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 Toast
make
(Context context, CharSequence text, Integer tintColor, Integer backgroundColor) Make a themed toast with icon and the text.static Toast
make
(Context context, CharSequence text, Integer tintColor, Integer backgroundColor, int duration) Make a themed toast with text, background and the tint color.static Toast
makeError
(Context context, CharSequence text) Make a error toast with icon and the text.static Toast
makeError
(Context context, CharSequence text, int duration) Make a error toast with icon and the text.static Toast
makeSuccess
(Context context, CharSequence text) Make a success toast with icon and the text.static Toast
makeSuccess
(Context context, CharSequence text, int duration) Make a success toast with icon and the text.static Toast
makeWarning
(Context context, CharSequence text) Make a warning toast with icon and the text.static Toast
makeWarning
(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_SHORT
orToast.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_SHORT
orToast.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_SHORT
orToast.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_SHORT
orToast.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_SHORT
orToast.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_SHORT
orToast.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_SHORT
orToast.LENGTH_LONG
.- Returns:
- The toast with the supplied parameters.
Use
Toast.show()
to display the toast.
-