Package com.pubmatic.sdk.common.utility
Class POBCountdownTimer
-
- All Implemented Interfaces:
public abstract class POBCountdownTimerSchedule a countdown until a time in the future, with regular notifications on intervals along the way.
Example of showing a 30 second countdown in a text field:
The calls to onTick are synchronized to this object so that one call to onTick won't ever occur before the previous callback is complete. This is only relevant when the implementation of onTick takes an amount of time to execute that is significant compared to the countdown interval.new POBCountdownTimer(30, 1) {
-
-
Constructor Summary
Constructors Constructor Description POBCountdownTimer(long secondsInFuture, long countDownIntervalInSeconds, Looper looper)
-
Method Summary
Modifier and Type Method Description final voidcancel()Cancel the countdown. final synchronized POBCountdownTimerstart()Start the countdown. longpause()Pause the countdown. longresume()Resume the countdown. abstract voidonTick(long secondsUntilFinished)Callback fired on regular interval. abstract voidonFinish()Callback fired when the time is up. -
-
Constructor Detail
-
POBCountdownTimer
POBCountdownTimer(long secondsInFuture, long countDownIntervalInSeconds, Looper looper)
- Parameters:
secondsInFuture- The number of seconds in the future from the call to start until the countdown is done and onFinish is called.countDownIntervalInSeconds- The interval in seconds along the way to receive onTick callbacks.looper- the instance of looper, to provide callbacks on provided looper
-
-
Method Detail
-
cancel
final void cancel()
Cancel the countdown.
Do not call it from inside CountDownTimer threads
-
start
final synchronized POBCountdownTimer start()
Start the countdown.
-
pause
long pause()
Pause the countdown.
-
resume
long resume()
Resume the countdown.
-
onTick
abstract void onTick(long secondsUntilFinished)
Callback fired on regular interval.
- Parameters:
secondsUntilFinished- The amount of time until finished.
-
onFinish
abstract void onFinish()
Callback fired when the time is up.
-
-
-
-