Class DynamicHintUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Snackbar
getSnackbar
(View view, CharSequence text) Make a themed snackbar with text and action.static Snackbar
getSnackbar
(View view, CharSequence text, int duration) Make a themed snackbar with text and action.static Snackbar
getSnackbar
(View view, CharSequence text, int backgroundColor, int tintColor, int duration) Make a themed snackbar with text and action.static Snackbar
getSnackbar
(View view, CharSequence text, int backgroundColor, int tintColor, int duration, boolean backgroundAware) Make a themed snackbar with text and action.static Toast
getToast
(Context context, CharSequence text, Drawable icon) Make a themed snackbar with text and action.
-
Constructor Details
-
DynamicHintUtils
public DynamicHintUtils()
-
-
Method Details
-
getToast
@NonNull public static Toast getToast(@NonNull Context context, @Nullable CharSequence text, @Nullable Drawable icon) Make a themed snackbar with text and action. Background will be accent color from the theme and it will automatically use its tint color for the text and icon to provide the best visibility.- 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.
-
getSnackbar
Make a themed snackbar with text and action.The background of the snackbar will be of primary color from the theme and it will automatically use its tint color for the text and action to provide the best visibility.
- Parameters:
view
- The view to show the snackbar.text
- The text to show. Can be formatted text.- Returns:
- The snackbar with the supplied parameters.
Use
Snackbar.show()
to display the snackbar.
-
getSnackbar
@NonNull public static Snackbar getSnackbar(@NonNull View view, @NonNull CharSequence text, int duration) Make a themed snackbar with text and action.The background of the snackbar will be of primary color from the theme and it will automatically use its tint color for the text and action to provide the best visibility.
- Parameters:
view
- The view to show the snackbar.text
- The text to show. Can be formatted text.duration
- The duration of the snackbar.Can be
BaseTransientBottomBar.LENGTH_SHORT
,BaseTransientBottomBar.LENGTH_LONG
orBaseTransientBottomBar.LENGTH_INDEFINITE
.- Returns:
- The snackbar with the supplied parameters.
Use
Snackbar.show()
to display the snackbar.
-
getSnackbar
@NonNull public static Snackbar getSnackbar(@NonNull View view, @NonNull CharSequence text, @ColorInt int backgroundColor, @ColorInt int tintColor, int duration) Make a themed snackbar with text and action.- Parameters:
view
- The view to show the snackbar.text
- The text to show. Can be formatted text.backgroundColor
- The snackbar background color.tintColor
- The snackbar tint color based on the background. It will automatically check for the contrast to provide bes visibility.duration
- The duration of the snackbar.Can be
BaseTransientBottomBar.LENGTH_SHORT
,BaseTransientBottomBar.LENGTH_LONG
orBaseTransientBottomBar.LENGTH_INDEFINITE
.- Returns:
- The snackbar with the supplied parameters.
Use
Snackbar.show()
to display the snackbar.
-
getSnackbar
@NonNull public static Snackbar getSnackbar(@NonNull View view, @NonNull CharSequence text, @ColorInt int backgroundColor, @ColorInt int tintColor, int duration, boolean backgroundAware) Make a themed snackbar with text and action.- Parameters:
view
- The view to show the snackbar.text
- The text to show. Can be formatted text.backgroundColor
- The snackbar background color.tintColor
- The snackbar tint color based on the background. It will automatically check for the contrast to provide bes visibility.duration
- The duration of the snackbar.Can be
BaseTransientBottomBar.LENGTH_SHORT
,BaseTransientBottomBar.LENGTH_LONG
orBaseTransientBottomBar.LENGTH_INDEFINITE
.backgroundAware
-true
to consider background aware for the tint color.- Returns:
- The snackbar with the supplied parameters.
Use
Snackbar.show()
to display the snackbar.
-