TimerStatusPart

public class TimerStatusPart
extends StatusPart

java.lang.Object
   ↳ androidx.wear.ongoing.StatusPart
     ↳ androidx.wear.ongoing.TimerStatusPart


An Ongoing activity status (or part of it) representing a timer or stopwatch. Available since wear-ongoing:1.0.0

Summary

Public constructors

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

Create a Status representing a timer or stopwatch.

TimerStatusPart(long timeZeroMillis, boolean countDown, long pausedAtMillis)

Create a Status representing a timer or stopwatch.

TimerStatusPart(long timeZeroMillis, boolean countDown)

Create a Status representing a timer or stopwatch.

TimerStatusPart(long timeZeroMillis)

Create a Status representing stopwatch.

Public methods

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

See TimeDependentText.getNextChangeTimeMillis(long)

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

See TimeDependentText.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

TimerStatusPart

public TimerStatusPart (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.

TimerStatusPart

public TimerStatusPart (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.

TimerStatusPart

public TimerStatusPart (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).

TimerStatusPart

public TimerStatusPart (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 TimeDependentText.getNextChangeTimeMillis(long)

Parameters
fromTimeMillis long

Returns
long

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 TimeDependentText.getText(Context, long)]

Parameters
context Context

timeNowMillis long

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.