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

TimerOngoingActivityStatus

public class TimerOngoingActivityStatus
extends OngoingActivityStatus

java.lang.Object
   ↳ androidx.wear.ongoingactivity.OngoingActivityStatus
     ↳ androidx.wear.ongoingactivity.TimerOngoingActivityStatus


OngoingActivityStatus representing a timer or stopwatch.

Summary

Public constructors

TimerOngoingActivityStatus(long timeZeroMillis, boolean countDown, long pausedAtMillis, long totalDurationMillis)

Create a Status representing a timer or stopwatch.

TimerOngoingActivityStatus(long timeZeroMillis, boolean countDown, long pausedAtMillis)

Create a Status representing a timer or stopwatch.

TimerOngoingActivityStatus(long timeZeroMillis, boolean countDown)

Create a Status representing a timer or stopwatch.

TimerOngoingActivityStatus(long timeZeroMillis)

Create a Status representing stopwatch.

Public methods

boolean equals(Object o)
long getNextChangeTimeMillis(long fromTimeMillis)

See OngoingActivityStatus.getNextChangeTimeMillis(long)

long getPausedAtMillis()
CharSequence getText(Context context, long timeNowMillis)

See OngoingActivityStatus.getText(Context, long)]

long getTimeZeroMillis()
long getTotalDurationMillis()
boolean hasTotalDuration()

Determines if this timer has a total duration set.

int hashCode()
boolean isCountDown()
boolean isPaused()

Determines if this timer is paused.

Inherited methods

Public constructors

TimerOngoingActivityStatus

public TimerOngoingActivityStatus (long timeZeroMillis, 
                boolean countDown, 
                long pausedAtMillis, 
                long totalDurationMillis)

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.

TimerOngoingActivityStatus

public TimerOngoingActivityStatus (long timeZeroMillis, 
                boolean countDown, 
                long pausedAtMillis)

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.

TimerOngoingActivityStatus

public TimerOngoingActivityStatus (long timeZeroMillis, 
                boolean countDown)

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).

TimerOngoingActivityStatus

public TimerOngoingActivityStatus (long timeZeroMillis)

Create a Status representing stopwatch.

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

Public methods

equals

public boolean equals (Object o)

Parameters
o Object

Returns
boolean

getNextChangeTimeMillis

public long getNextChangeTimeMillis (long fromTimeMillis)

See OngoingActivityStatus.getNextChangeTimeMillis(long)

Parameters
fromTimeMillis long: current time, usually now as returned by SystemClock.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 will change. returns Long.MAX_VALUE if the display will never change.

getPausedAtMillis

public long getPausedAtMillis ()

Returns
long the timestamp of the time when this timer was paused. Use isPaused() to determine if this timer is paused or not.

getText

public CharSequence getText (Context context, 
                long timeNowMillis)

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

Returns
CharSequence

getTimeZeroMillis

public long getTimeZeroMillis ()

Returns
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

public long getTotalDurationMillis ()

Returns
long the total duration of this timer/stopwatch, if set. Use hasTotalDuration() to determine if this timer has a duration set.

hasTotalDuration

public boolean hasTotalDuration ()

Determines if this timer has a total duration set.

Returns
boolean true if this the total duration was set, false if not.

hashCode

public int hashCode ()

Returns
int

isCountDown

public boolean isCountDown ()

Returns
boolean false if this is a stopwatch or true if this is a timer.

isPaused

public boolean isPaused ()

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

Returns
boolean true if this timer is paused, false if it's running.