Class DynamicToast
- java.lang.Object
-
- com.pranavpandey.android.dynamic.toasts.DynamicToast
-
public class DynamicToast extends java.lang.ObjectHelper class to display themedToastwith icon and text.If no color is supplied, it will display default toast based on the vanilla Android.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDynamicToast.ConfigConfiguration class to customise theDynamicToastattributes.
-
Constructor Summary
Constructors Constructor Description DynamicToast()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text)Make a standard toast that just contains a text view.static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text, int duration)Make a standard toast that just contains a text view.static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text, android.graphics.drawable.Drawable icon)Make a error toast with icon and the text.static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text, android.graphics.drawable.Drawable icon, int duration)Make a themed toast with icon and the text.static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text, android.graphics.drawable.Drawable icon, java.lang.Integer tintColor, java.lang.Integer backgroundColor)Make a themed toast with text, icon, background and the tint color.static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text, android.graphics.drawable.Drawable icon, java.lang.Integer tintColor, java.lang.Integer backgroundColor, int duration)Make a themed toast with text, icon, background and the tint color.static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text, java.lang.Integer tintColor, java.lang.Integer backgroundColor)Make a themed toast with icon and the text.static android.widget.Toastmake(android.content.Context context, java.lang.CharSequence text, java.lang.Integer tintColor, java.lang.Integer backgroundColor, int duration)Make a themed toast with text, background and the tint color.static android.widget.ToastmakeError(android.content.Context context, java.lang.CharSequence text)Make a error toast with icon and the text.static android.widget.ToastmakeError(android.content.Context context, java.lang.CharSequence text, int duration)Make a error toast with icon and the text.static android.widget.ToastmakeSuccess(android.content.Context context, java.lang.CharSequence text)Make a success toast with icon and the text.static android.widget.ToastmakeSuccess(android.content.Context context, java.lang.CharSequence text, int duration)Make a success toast with icon and the text.static android.widget.ToastmakeWarning(android.content.Context context, java.lang.CharSequence text)Make a warning toast with icon and the text.static android.widget.ToastmakeWarning(android.content.Context context, java.lang.CharSequence text, int duration)Make a warning toast with icon and the text.
-
-
-
Method Detail
-
make
@NonNull public static android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text)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 android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.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
@NonNull public static android.widget.Toast makeError(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text)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 android.widget.Toast makeError(@NonNull android.content.Context context, @Nullable java.lang.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
@NonNull public static android.widget.Toast makeSuccess(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text)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 android.widget.Toast makeSuccess(@NonNull android.content.Context context, @Nullable java.lang.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
@NonNull public static android.widget.Toast makeWarning(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text)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 android.widget.Toast makeWarning(@NonNull android.content.Context context, @Nullable java.lang.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 android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text, @Nullable android.graphics.drawable.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 android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text, @Nullable android.graphics.drawable.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 android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text, @Nullable @ColorInt java.lang.Integer tintColor, @Nullable @ColorInt java.lang.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 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 android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text, @Nullable @ColorInt java.lang.Integer tintColor, @Nullable @ColorInt java.lang.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 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 android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text, @Nullable android.graphics.drawable.Drawable icon, @Nullable @ColorInt java.lang.Integer tintColor, @Nullable @ColorInt java.lang.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 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 android.widget.Toast make(@NonNull android.content.Context context, @Nullable java.lang.CharSequence text, @Nullable android.graphics.drawable.Drawable icon, @Nullable @ColorInt java.lang.Integer tintColor, @Nullable @ColorInt java.lang.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 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.
-
-