public class Utils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
FULL_ALPHA |
static int |
MONDAY_BEFORE_JULIAN_EPOCH |
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 |
getDaysInMonth(int month,
int year) |
static int |
getJulianMondayFromWeeksSinceEpoch(int week)
Takes a number of weeks since the epoch and calculates the Julian day of
the Monday for that week.
|
static ObjectAnimator |
getPulseAnimator(View labelToAnimate,
float decreaseRatio,
float increaseRatio)
Render an animator to pulsate a view in place.
|
static int |
getWeeksSinceEpochFromJulianDay(int julianDay,
int firstDayOfWeek)
Returns the week since
Time.EPOCH_JULIAN_DAY (Jan 1, 1970)
adjusted for first day of week. |
static boolean |
isJellybeanOrLater() |
static void |
tryAccessibilityAnnounce(View view,
CharSequence text)
Try to speak the specified text, for accessibility.
|
public static final int MONDAY_BEFORE_JULIAN_EPOCH
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(View view, CharSequence text)
text
- Text to announce.public static int getDaysInMonth(int month, int year)
public static int getJulianMondayFromWeeksSinceEpoch(int week)
Time.EPOCH_JULIAN_DAY
is considered week 0. It returns the Julian day for the Monday
week
weeks after the Monday of the week containing the epoch.week
- Number of weeks since the epochpublic static int getWeeksSinceEpochFromJulianDay(int julianDay, int firstDayOfWeek)
Time.EPOCH_JULIAN_DAY
(Jan 1, 1970)
adjusted for first day of week.
This takes a julian day and the week start day and calculates which
week since Time.EPOCH_JULIAN_DAY
that day occurs in, starting
at 0. *Do not* use this to compute the ISO week number for the year.julianDay
- The julian day to calculate the week number forfirstDayOfWeek
- Which week day is the first day of the week,
see Time.SUNDAY
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio)
labelToAnimate
- the view to pulsate.