public static interface SleepTimer.OnStateChangeListener
当启动或者取消睡眠定时器时,该监听器会被调用。
| 限定符和类型 | 方法和说明 |
|---|---|
void |
onTimerEnd()
当睡眠定时器正常终止或者被取消时会调用该方法。
|
void |
onTimerStart(long time,
long startTime,
SleepTimer.TimeoutAction action)
当启动睡眠定时器时会调用该方法。
|
void onTimerStart(long time,
long startTime,
SleepTimer.TimeoutAction action)
使用当前的 System.currentTimeMillis() 减去 startTime 即可知道睡眠定时器已经走过的时间。
time - 睡眠定时器的定时时间startTime - 睡眠定时器的启动时间。使用当前的 SystemClock.elapsedRealtime()
减去 startTime 即可知道睡眠定时器已经走过的时间。action - 定时器的的时间到时要执行的操作。SleepTimer.startSleepTimer(long, TimeoutAction)void onTimerEnd()