PausableTimer

Timer that manages delayed Runnables which can have their delays paused and resumed.

Constructors

Link copied to clipboard
constructor(looper: Looper)

Constructs a timer which will run on the provided Looper.

constructor()

Constructs a timer which will run on the main Looper.

Functions

Link copied to clipboard
fun cancel(runnable: Runnable)

Cancels the timer associated with the provided Runnable if it exists.

Link copied to clipboard
fun cancelAll()

Clears all submitted timers.

Link copied to clipboard
fun isRunning(runnable: Runnable): Boolean

Returns whether the timer for the provided Runnable is currently running or not.

Link copied to clipboard
fun pause(runnable: Runnable)

Pauses the timer associated with the provided Runnable if it's running.

Link copied to clipboard
fun remainingTime(runnable: Runnable): Long

Returns the remaining time for the provided Runnable.

Link copied to clipboard
fun resume(runnable: Runnable)

Resumes the timer associated with the provided Runnable if it was paused.

Link copied to clipboard
fun start(runnable: Runnable, delay: Long)

Starts a timer which will execute the provided Runnable after the provided delay. If the provided Runnable is already associated with a timer, the timer will be reset with the updated delay.