TimeFormatComplicationText

public final class TimeFormatComplicationText
extends Object implements TimeDependentText

java.lang.Object
   ↳ com.google.wear.services.complications.TimeFormatComplicationText


Class to generate string representations of dates/times according to a specified format.

Note: The preferred way to define dynamic data for complication text is to use a DynamicComplicationText. That will be the only supported way to create this type of ComplicationText in the future.

Summary

Nested classes

class TimeFormatComplicationText.Builder

Builder for TimeFormatComplicationText

Constants

int STYLE_DEFAULT

Style where the formatted date/time should be shown unchanged.

int STYLE_LOWER_CASE

Style where the formatted date/time should be shown in lower case.

int STYLE_UPPER_CASE

Style where the formatted date/time should be capitalized.

Public constructors

TimeFormatComplicationText(CharSequence surroundingText, String format, int style, TimeZone timeZone)

Public methods

boolean equals(Object o)

SimpleDateFormat getFormat()
String getFormatString()
long getNextChangeTimeMillis(long fromTime)

Returns the next time after fromTime at which the text may change.

long getPrecisionMillis()
int getStyle()

Returns the time format style to be used when formatting the text.

CharSequence getSurroundingText()
TimeZone getTimeZone()
int hashCode()

boolean returnsSameTextAt(long firstDateTimeMillis, long secondDateTimeMillis)

Returns true if the result of the calculation of the current text will be the same for both firstDateTimeMillis and secondDateTimeMillis.

String toString()

Inherited methods

Constants

STYLE_DEFAULT

Added in API level 36
public static final int STYLE_DEFAULT

Style where the formatted date/time should be shown unchanged.

Constant Value: 1 (0x00000001)

STYLE_LOWER_CASE

Added in API level 36
public static final int STYLE_LOWER_CASE

Style where the formatted date/time should be shown in lower case.

Constant Value: 3 (0x00000003)

STYLE_UPPER_CASE

Added in API level 36
public static final int STYLE_UPPER_CASE

Style where the formatted date/time should be capitalized.

Constant Value: 2 (0x00000002)

Public constructors

TimeFormatComplicationText

Added in API level 36
public TimeFormatComplicationText (CharSequence surroundingText, 
                String format, 
                int style, 
                TimeZone timeZone)

Parameters
surroundingText CharSequence

format String

style int: Value is one of the following:
timeZone TimeZone

Public methods

equals

Added in API level 36
public boolean equals (Object o)

Parameters
o Object

Returns
boolean

getFormat

Added in API level 36
public SimpleDateFormat getFormat ()

Returns
SimpleDateFormat

getFormatString

Added in API level 36
public String getFormatString ()

Returns
String

getNextChangeTimeMillis

Added in API level 36
public long getNextChangeTimeMillis (long fromTime)

Returns the next time after fromTime at which the text may change.

Parameters
fromTime long

Returns
long

getPrecisionMillis

Added in API level 36
public long getPrecisionMillis ()

Returns
long The time precision in milliseconds derived from the date and time format.

getStyle

Added in API level 36
public int getStyle ()

Returns the time format style to be used when formatting the text.

Returns
int Value is one of the following:

getSurroundingText

Added in API level 36
public CharSequence getSurroundingText ()

Returns
CharSequence

getTimeZone

Added in API level 36
public TimeZone getTimeZone ()

Returns
TimeZone

hashCode

Added in API level 36
public int hashCode ()

Returns
int

returnsSameTextAt

Added in API level 36
public boolean returnsSameTextAt (long firstDateTimeMillis, 
                long secondDateTimeMillis)

Returns true if the result of the calculation of the current text will be the same for both firstDateTimeMillis and secondDateTimeMillis.

Parameters
firstDateTimeMillis long

secondDateTimeMillis long

Returns
boolean

toString

Added in API level 36
public String toString ()

Returns
String