interface 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 companion properties

ComplicationText
ComplicationText

For use when the real data isn't available yet, this ComplicationText should be rendered as a placeholder.

Public functions

Instant
getNextChangeTime(afterInstant: Instant)

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

CharSequence
getTextAt(resources: Resources, instant: Instant)

Returns the text that should be displayed for the given timestamp.

Boolean
Boolean
returnsSameText(firstInstant: Instant, secondInstant: Instant)

Returns true if the result of getTextAt will be the same for both firstInstant and secondInstant.

Public companion properties

EMPTY

val EMPTY: ComplicationText

PLACEHOLDER

val PLACEHOLDER: ComplicationText

For use when the real data isn't available yet, this ComplicationText should be rendered as a placeholder. It is suggested that it should be rendered with a light grey box.

Note a placeholder may only be used in the context of NoDataComplicationData.placeholder.

Public functions

getNextChangeTime

Added in 1.0.0
fun getNextChangeTime(afterInstant: Instant): Instant

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

getTextAt

Added in 1.0.0
fun getTextAt(resources: Resources, instant: Instant): CharSequence

Returns the text that should be displayed for the given timestamp.

Parameters
resources: Resources

Resources from the current context

instant: Instant

The Instant at which to sample the text

isAlwaysEmpty

Added in 1.0.0
fun isAlwaysEmpty(): Boolean

returnsSameText

Added in 1.0.0
fun returnsSameText(firstInstant: Instant, secondInstant: Instant): Boolean

Returns true if the result of getTextAt will be the same for both firstInstant and secondInstant.