ComplicationText
interface ComplicationText
androidx.wear.complications.data.ComplicationText |
The text within a complication.
This text may change over time and this interface provides both a way to determine the current text to show with getTextAt but also a way to know whether the text needs to be re-rendered, by means of returnsSameText, getNextChangeTime, and isAlwaysEmpty.
Summary
Public methods | |
---|---|
abstract WireComplicationText |
Converts this value to WireComplicationText object used for serialization. |
abstract Long |
getNextChangeTime(fromDateTimeMillis: Long) Returns the next time after fromDateTimeMillis at which the text may change. |
abstract CharSequence |
Returns the text that should be displayed for the given timestamp. |
abstract Boolean | |
abstract Boolean |
returnsSameText(firstDateTimeMillis: Long, secondDateTimeMillis: Long) Returns true if the result of getTextAt will be the same for both firstDateTimeMillis and secondDateTimeMillis. |
Public methods
asWireComplicationText
abstract fun asWireComplicationText(): WireComplicationText
Converts this value to WireComplicationText object used for serialization.
getNextChangeTime
abstract fun getNextChangeTime(fromDateTimeMillis: Long): Long
Returns the next time after fromDateTimeMillis at which the text may change.
getTextAt
abstract fun getTextAt(
resources: Resources,
dateTimeMillis: Long
): CharSequence
Returns the text that should be displayed for the given timestamp.
Parameters | |
---|---|
resources: Resources | Resources from the current context |
dateTimeMillis: Long | milliseconds since epoch, e.g. from System.currentTimeMillis |
isAlwaysEmpty
abstract fun isAlwaysEmpty(): Boolean
returnsSameText
abstract fun returnsSameText(
firstDateTimeMillis: Long,
secondDateTimeMillis: Long
): Boolean
Returns true if the result of getTextAt will be the same for both firstDateTimeMillis and secondDateTimeMillis.