public class BaseTimer extends java.lang.Object implements IBaseTimer, IAppActiveListener
ITimerListener that notifies when finished| Constructor and Description |
|---|
BaseTimer(java.lang.Integer totalDurationMs,
ITimerListener timerListener) |
BaseTimer(java.lang.Integer totalDurationMs,
ITimerListener timerListener,
LifecycleCache lifecycleCache) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isRunning() |
void |
kill()
Stops and cleans up
|
void |
onAppStateChanged(LifecycleEvent event) |
void |
onStep() |
boolean |
pause()
|
void |
restart(java.util.concurrent.ScheduledExecutorService timerService)
Restarts the timer to initial countdown after a
Stop |
boolean |
resume()
Resumes the timer countdown after a
Pause |
void |
start(java.util.concurrent.ScheduledExecutorService timerService)
Starts the timer countdown
|
void |
stop()
Stops the timer countdown
For timer to continue
Restart is required |
public BaseTimer(java.lang.Integer totalDurationMs,
ITimerListener timerListener,
LifecycleCache lifecycleCache)
public BaseTimer(java.lang.Integer totalDurationMs,
ITimerListener timerListener)
public void start(java.util.concurrent.ScheduledExecutorService timerService)
start in interface IBaseTimertimerService - ScheduledExecutorService to run timer on, will be shutdown when timer is stopped via Stop or Killpublic void stop()
Restart is requiredstop in interface IBaseTimerpublic boolean pause()
pause in interface IBaseTimerpublic boolean resume()
Pauseresume in interface IBaseTimerpublic void restart(java.util.concurrent.ScheduledExecutorService timerService)
Stoppublic void kill()
kill in interface IBaseTimerpublic boolean isRunning()
public void onStep()
public void onAppStateChanged(LifecycleEvent event)
onAppStateChanged in interface IAppActiveListener