ComplicationText

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 methods

abstract @NonNull Instant
getNextChangeTime(Instant afterInstant)

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

abstract @NonNull CharSequence
getTextAt(Resources resources, Instant instant)

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

abstract boolean
abstract boolean
returnsSameText(Instant firstInstant, Instant secondInstant)

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

Public methods

getNextChangeTime

abstract @NonNull Instant getNextChangeTime(Instant afterInstant)

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

getTextAt

abstract @NonNull CharSequence getTextAt(Resources resources, Instant instant)

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

abstract boolean isAlwaysEmpty()

returnsSameText

abstract boolean returnsSameText(Instant firstInstant, Instant secondInstant)

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