TimeDifferenceComplicationText


Note: As of July 10, 2024, watch faces must use the Watch Face Format in order to be installed on new watches that launch with Wear OS 5 pre-installed. Learn more about the user-facing changes in this Help Center article.

Additionally, starting in early 2025 (specific date to be announced during Q4 2024), all new watch faces published on Google Play must use the Watch Face Format.

class TimeDifferenceComplicationText : ComplicationText


A ComplicationText that represents a time difference.

Summary

Nested types

Builder for ComplicationText representing a time difference.

Public functions

open operator Boolean
equals(other: Any?)
TimeUnit?

Gets the smallest unit that may be shown in the time difference text.

open Instant
getNextChangeTime(afterInstant: Instant)

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

open CharSequence
getTextAt(resources: Resources, instant: Instant)

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

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

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

open String

Public functions

equals

open operator fun equals(other: Any?): Boolean

getMinimumTimeUnit

Added in 1.0.0
fun getMinimumTimeUnit(): TimeUnit?

Gets the smallest unit that may be shown in the time difference text. If specified, units smaller than this minimum will not be included.

getNextChangeTime

Added in 1.3.0-alpha03
open fun getNextChangeTime(afterInstant: Instant): Instant

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

getTextAt

Added in 1.3.0-alpha03
open 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

hashCode

open fun hashCode(): Int

isAlwaysEmpty

Added in 1.3.0-alpha03
open fun isAlwaysEmpty(): Boolean

returnsSameText

Added in 1.3.0-alpha03
open fun returnsSameText(firstInstant: Instant, secondInstant: Instant): Boolean

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

toString

open fun toString(): String