TimeDependentText


interface TimeDependentText

Known direct subclasses
Status.Part

Abstract class to represent An Ongoing activity status or part of it.

Status

Base class to represent the status of an Ongoing Activity and render it.

Known indirect subclasses
Status.StopwatchPart

An Ongoing activity status (or part of it) representing a stopwatch

Status.TextPart

An Ongoing activity status (or part of it) representing a plain, static text.

Status.TimerOrStopwatchPart

Base class for TimerPart and StopwatchPart, defines the getters but can't be created directly, create one of those instead.

Status.TimerPart

An Ongoing activity status (or part of it) representing a timer.


Represents the status or a part of the status of an ongoing activity. Its content may change with time (for example, if the status contains a timer)

Summary

Public functions

Long
getNextChangeTimeMillis(fromTimeMillis: Long)

Returns the timestamp of the next time when the display may be different from the one at the specified time.

CharSequence
getText(context: Context, timeNowMillis: Long)

Returns a textual representation of the ongoing activity status or a part of it at the given time represented as milliseconds timestamp For forward compatibility, the best way to display this is on a android.widget.TextView

Public functions

getNextChangeTimeMillis

Added in 1.0.0
fun getNextChangeTimeMillis(fromTimeMillis: Long): Long

Returns the timestamp of the next time when the display may be different from the one at the specified time.

Parameters
fromTimeMillis: Long

current time, usually now as returned by elapsedRealtime. In most cases getText and getNextChangeTimeMillis should be called with the exact same timestamp, so changes are not missed.

Returns
Long

the first point in time after fromTimeMillis when the displayed value of this status may change. returns Long.MAX_VALUE if the display will never change.

getText

Added in 1.0.0
fun getText(context: Context, timeNowMillis: Long): CharSequence

Returns a textual representation of the ongoing activity status or a part of it at the given time represented as milliseconds timestamp For forward compatibility, the best way to display this is on a android.widget.TextView

Parameters
context: Context

may be used for internationalization. Only used while this method executed.

timeNowMillis: Long

the timestamp of the time we want to display, usually now, as returned by elapsedRealtime.