TimeDifferenceComplicationText


public final class TimeDifferenceComplicationText implements ComplicationText


A ComplicationText that represents a time difference.

Summary

Nested types

Builder for ComplicationText representing a time difference.

Public methods

boolean
equals(Object other)
final TimeUnit

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

@NonNull Instant

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

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

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

int
boolean
boolean
returnsSameText(
    @NonNull Instant firstInstant,
    @NonNull Instant secondInstant
)

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

@NonNull String

Public methods

equals

public boolean equals(Object other)

getMinimumTimeUnit

Added in 1.0.0
public final TimeUnit getMinimumTimeUnit()

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-alpha04
public @NonNull Instant getNextChangeTime(@NonNull Instant afterInstant)

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

getTextAt

Added in 1.3.0-alpha04
public @NonNull CharSequence getTextAt(@NonNull Resources resources, @NonNull Instant instant)

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

Parameters
@NonNull Resources resources

Resources from the current context

@NonNull Instant instant

The Instant at which to sample the text

hashCode

public int hashCode()

isAlwaysEmpty

Added in 1.3.0-alpha04
public boolean isAlwaysEmpty()

returnsSameText

Added in 1.3.0-alpha04
public boolean returnsSameText(
    @NonNull Instant firstInstant,
    @NonNull Instant secondInstant
)

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

toString

public @NonNull String toString()