Google is committed to advancing racial equity for Black communities. See how.

TimerOngoingActivityStatus

open class TimerOngoingActivityStatus : OngoingActivityStatus
kotlin.Any
   ↳ androidx.wear.ongoingactivity.OngoingActivityStatus
   ↳ androidx.wear.ongoingactivity.TimerOngoingActivityStatus

OngoingActivityStatus representing a timer or stopwatch.

Summary

Public constructors
<init>(timeZeroMillis: Long, countDown: Boolean, pausedAtMillis: Long, totalDurationMillis: Long)

Create a Status representing a timer or stopwatch.

<init>(timeZeroMillis: Long, countDown: Boolean, pausedAtMillis: Long)

Create a Status representing a timer or stopwatch.

<init>(timeZeroMillis: Long, countDown: Boolean)

Create a Status representing a timer or stopwatch.

<init>(timeZeroMillis: Long)

Create a Status representing stopwatch.

Public methods
open Boolean
equals(other: Any?)

open Long
getNextChangeTimeMillis(fromTimeMillis: Long)

See OngoingActivityStatus#getNextChangeTimeMillis(long)

open Long

open CharSequence
getText(@NonNull context: Context, timeNowMillis: Long)

See OngoingActivityStatus#getText(Context, long)]

open Long

open Long

open Boolean

Determines if this timer has a total duration set.

open Int

open Boolean

open Boolean

Determines if this timer is paused.

Public constructors

<init>

TimerOngoingActivityStatus(
    timeZeroMillis: Long,
    countDown: Boolean,
    pausedAtMillis: Long,
    totalDurationMillis: Long)

Create a Status representing a timer or stopwatch.

Parameters
timeZeroMillis Long: timestamp of the time at which this Timer should display 0, will be in the past for a stopwatch and usually in the future for timers.
countDown Boolean: indicates if this is a stopwatch (when false or timer (when true).
pausedAtMillis Long: timestamp of the time when this timer was paused. Or -1L if this timer is running.
totalDurationMillis Long: total duration of this timer/stopwatch, useful to display as a progress bar or similar.

<init>

TimerOngoingActivityStatus(
    timeZeroMillis: Long,
    countDown: Boolean,
    pausedAtMillis: Long)

Create a Status representing a timer or stopwatch.

Parameters
timeZeroMillis Long: timestamp of the time at which this Timer should display 0, will be in the past for a stopwatch and usually in the future for timers.
countDown Boolean: indicates if this is a stopwatch (when false) or timer (when true).
pausedAtMillis Long: timestamp of the time when this timer was paused. Or -1L if this timer is running.

<init>

TimerOngoingActivityStatus(
    timeZeroMillis: Long,
    countDown: Boolean)

Create a Status representing a timer or stopwatch.

Parameters
timeZeroMillis Long: timestamp of the time at which this Timer should display 0, will be in the past for a stopwatch and usually in the future for timers.
countDown Boolean: indicates if this is a stopwatch (when false) or timer (when true).

<init>

TimerOngoingActivityStatus(timeZeroMillis: Long)

Create a Status representing stopwatch.

Parameters
timeZeroMillis Long: timestamp of the time at which this Stopwatch started.

Public methods

equals

open fun equals(other: Any?): Boolean

getNextChangeTimeMillis

open fun getNextChangeTimeMillis(fromTimeMillis: Long): Long

See OngoingActivityStatus#getNextChangeTimeMillis(long)

Parameters
fromTimeMillis Long: current time, usually now as returned by android.os.SystemClock#elapsedRealtime(). In most cases getText and getNextChangeTimeMillis should be called with the exact same timestamp, so changes are not missed.
Return
Long the first point in time after fromTimeMillis when the displayed value of this status will change. returns Long.MAX_VALUE if the display will never change.

getPausedAtMillis

open fun getPausedAtMillis(): Long
Return
Long the timestamp of the time when this timer was paused. Use TimerOngoingActivityStatus#isPaused() to determine if this timer is paused or not.

getText

@NonNull open fun getText(
    @NonNull context: Context,
    timeNowMillis: Long
): CharSequence

See OngoingActivityStatus#getText(Context, long)]

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 android.os.SystemClock#elapsedRealtime().

getTimeZeroMillis

open fun getTimeZeroMillis(): Long
Return
Long the time at which this Timer will display 0, will be in the past for a stopwatch and usually in the future for timers.

getTotalDurationMillis

open fun getTotalDurationMillis(): Long
Return
Long the total duration of this timer/stopwatch, if set. Use TimerOngoingActivityStatus#hasTotalDuration() to determine if this timer has a duration set.

hasTotalDuration

open fun hasTotalDuration(): Boolean

Determines if this timer has a total duration set.

Return
Boolean true if this the total duration was set, false if not.

hashCode

open fun hashCode(): Int

isCountDown

open fun isCountDown(): Boolean
Return
Boolean false if this is a stopwatch or true if this is a timer.

isPaused

open fun isPaused(): Boolean

Determines if this timer is paused. i.e. the display representation will not change over time.

Return
Boolean true if this timer is paused, false if it's running.