public enum TimeDifferenceStyle extends Enum


The styling used for showing a time different by ComplicationText#TimeDifferenceBuilder.

Summary

Enum Values

SHORT_DUAL_UNIT

Style for time differences shown in a short alpha-numeric style, with up to two significant units included.

SHORT_SINGLE_UNIT

Style for time differences shown in a short alpha-numeric style, with only the most significant unit included.

SHORT_WORDS_SINGLE_UNIT

Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included, that should fit within the character limit for a short text field.

STOPWATCH

Style for time differences shown in a numeric fashion like a timer.

WORDS_SINGLE_UNIT

Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included.

Public methods

final @NonNull TimeDifferenceStyle

Returns the enum constant of this type with the specified name.

final @NonNull TimeDifferenceStyle[]

Returns an array containing the constants of this enum type, in the order they're declared.

Enum Values

SHORT_DUAL_UNIT

TimeDifferenceStyle TimeDifferenceStyle.SHORT_DUAL_UNIT

Style for time differences shown in a short alpha-numeric style, with up to two significant units included.

For time difference t:

If t < 1 hour, the value will be shown as a number of minutes, such as 2m for 2 minutes. Seconds are not displayed.

If 1 hour <= t < 1 day, the value will be shown as hours and minutes, such as 4h 2m for 4 hours and 2 minutes.

If 1 day <= t < 10 days, the value will be shown as days and hours, such as 3d 4h for 3 days 4 hours.

If 10 days <= t, the value will be shown as a number of days, such as 13d for 13 days.

The characters used will be localised to match the default locale. If the representation of the time difference with two units would be too long in the default locale, just a single unit may be shown instead.

SHORT_SINGLE_UNIT

TimeDifferenceStyle TimeDifferenceStyle.SHORT_SINGLE_UNIT

Style for time differences shown in a short alpha-numeric style, with only the most significant unit included.

For time difference t:

If t < 1 hour, the value will be shown as a number of minutes, such as 2m for 2 minutes . Seconds are not displayed.

If 1 hour <= t < 1 day, the value will be shown as a number of hours, such as 4h for 4 hours.

If 1 days <= t, the value will be shown as a number of days, such as 13d for 13 days.

The characters used will be localised to match the default locale.

SHORT_WORDS_SINGLE_UNIT

TimeDifferenceStyle TimeDifferenceStyle.SHORT_WORDS_SINGLE_UNIT

Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included, that should fit within the character limit for a short text field.

The output will be the same as for WORDS_SINGLE_UNIT, except that if the text does not fit into the seven character limit then a shorter form will be used instead, e.g. 1356d instead of 1356 days.

STOPWATCH

TimeDifferenceStyle TimeDifferenceStyle.STOPWATCH

Style for time differences shown in a numeric fashion like a timer.

For time difference t:

If t < 1 hour, the value will be shown as minutes and seconds, such as 02:35 for 2 minutes and 35 seconds.

If 1 hour <= t < 1 day, the value will be shown as hours and minutes, such as 4:02 for 4 hours and 2 minutes, or as 12:02 for 12 hours and 2 minutes.

If 1 day <= t < 10 days, the value will be shown as days and hours, such as 3d 4h for 3 days 4 hours.

If 10 days <= t, the value will be shown as just days, such as 13d for 13 days.

The characters used will be localised to match the default locale.

WORDS_SINGLE_UNIT

TimeDifferenceStyle TimeDifferenceStyle.WORDS_SINGLE_UNIT

Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included.

For time difference t:

If t < 1 hour, the value will be shown as a number of minutes, such as 1 min for 1 minute or 2 mins for 2 minutes. Seconds are not displayed.

If 1 hour <= t < 1 day, the value will be shown as a number of hours, such as 1 hour for 1 hour or 4 hours for 4 hours.

If 1 days <= t, the value will be shown as a number of days, such as 1 day for 1 day or 13 days for 13 days.

The words used will be localised to match the default locale.

Public methods

valueOf

Added in 1.0.0
public final @NonNull TimeDifferenceStyle valueOf(@NonNull String value)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Throws
kotlin.IllegalArgumentException

if this enum type has no constant with the specified name

values

Added in 1.0.0
public final @NonNull TimeDifferenceStyle[] values()

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.