public class Utils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
FULL_ALPHA |
static int |
PULSE_ANIMATOR_DURATION |
static int |
SELECTED_ALPHA |
static int |
SELECTED_ALPHA_THEME_DARK |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
darkenColor(int color) |
static int |
dpToPx(float dp,
android.content.res.Resources resources)
Convert Dp to Pixel
|
static int |
getAccentColorFromThemeIfAvailable(android.content.Context context)
Gets the colorAccent from the current context, if possible/available
|
static android.animation.ObjectAnimator |
getPulseAnimator(android.view.View labelToAnimate,
float decreaseRatio,
float increaseRatio)
Render an animator to pulsate a view in place.
|
static boolean |
isDarkTheme(android.content.Context context,
boolean current)
Gets dialog type (Light/Dark) from current theme
|
static boolean |
isJellybeanOrLater() |
static java.util.Calendar |
trimToMidnight(java.util.Calendar calendar)
Trims off all time information, effectively setting it to midnight
Makes it easier to compare at just the day level
|
static void |
tryAccessibilityAnnounce(android.view.View view,
java.lang.CharSequence text)
Try to speak the specified text, for accessibility.
|
public static final int PULSE_ANIMATOR_DURATION
public static final int SELECTED_ALPHA
public static final int SELECTED_ALPHA_THEME_DARK
public static final int FULL_ALPHA
public static boolean isJellybeanOrLater()
public static void tryAccessibilityAnnounce(android.view.View view,
java.lang.CharSequence text)
text - Text to announce.public static android.animation.ObjectAnimator getPulseAnimator(android.view.View labelToAnimate,
float decreaseRatio,
float increaseRatio)
labelToAnimate - the view to pulsate.public static int dpToPx(float dp,
android.content.res.Resources resources)
public static int darkenColor(int color)
public static int getAccentColorFromThemeIfAvailable(android.content.Context context)
context - The context to use as reference for the colorpublic static boolean isDarkTheme(android.content.Context context,
boolean current)
context - The context to use as reference for the booleancurrent - Default value to return if cannot resolve the attributepublic static java.util.Calendar trimToMidnight(java.util.Calendar calendar)
calendar - The Calendar object to trim