public class LooperDelegatingScheduler extends Scheduler
LooperMode.Mode.PAUSED.
All API calls will delegate to ShadowLooper.
Scheduler.IdleState| Constructor | Description |
|---|---|
LooperDelegatingScheduler(Looper looper) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
advanceBy(long interval) |
Run all runnables that are scheduled to run in the next time interval.
|
boolean |
advanceBy(long amount,
TimeUnit unit) |
Run all runnables that are scheduled to run in the next time interval.
|
boolean |
advanceTo(long endTime) |
Run all runnables that are scheduled before the endTime.
|
boolean |
advanceToLastPostedRunnable() |
Run all runnables in the queue, and any additional runnables they schedule that are scheduled
before the latest scheduled runnable currently in the queue.
|
boolean |
advanceToNextPostedRunnable() |
Run the next runnable in the queue.
|
boolean |
areAnyRunnable() |
Determine if any enqueued runnables are enqueued before the current time.
|
long |
getCurrentTime() |
Get the current time (as seen by the scheduler), in milliseconds.
|
Scheduler.IdleState |
getIdleState() |
Retrieves the current idling state of this
Scheduler. |
Duration |
getLastScheduledTaskTime() |
|
Duration |
getNextScheduledTaskTime() |
|
void |
idleConstantly(boolean shouldIdleConstantly) |
Deprecated.
|
boolean |
isPaused() |
Determine if the scheduler is paused.
|
void |
pause() |
Pause the scheduler.
|
void |
post(Runnable runnable) |
Add a runnable to the queue.
|
void |
postAtFrontOfQueue(Runnable runnable) |
Add a runnable to the head of the queue.
|
void |
postDelayed(Runnable runnable,
long delayMillis) |
Add a runnable to the queue to be run after a delay.
|
void |
postDelayed(Runnable runnable,
long delay,
TimeUnit unit) |
Add a runnable to the queue to be run after a delay.
|
void |
remove(Runnable runnable) |
Remove a runnable from the queue.
|
void |
reset() |
Reset the internal state of the Scheduler.
|
boolean |
runOneTask() |
Run the next runnable in the queue.
|
void |
setIdleState(Scheduler.IdleState idleState) |
Sets the current idling state of this
Scheduler. |
int |
size() |
Return the number of enqueued runnables.
|
void |
unPause() |
Un-pause the scheduler.
|
public LooperDelegatingScheduler(Looper looper)
public Scheduler.IdleState getIdleState()
SchedulerScheduler.getIdleState in class SchedulerScheduler.Scheduler.setIdleState(IdleState),
Scheduler.isPaused()public void setIdleState(Scheduler.IdleState idleState)
SchedulerScheduler. If transitioning to the Scheduler.IdleState.UNPAUSED state any tasks scheduled to be run at or before the current time will be
run, and if transitioning to the Scheduler.IdleState.CONSTANT_IDLE state all scheduled tasks will
be run and the clock advanced to the time of the last runnable.setIdleState in class ScheduleridleState - The new idle state of this Scheduler.Scheduler.setIdleState(IdleState),
Scheduler.isPaused()public long getCurrentTime()
SchedulergetCurrentTime in class Schedulerpublic void pause()
SchedulersetIdleState(PAUSED).pause in class SchedulerScheduler.unPause(),
Scheduler.setIdleState(IdleState)public void unPause()
SchedulersetIdleState(UNPAUSED).unPause in class SchedulerScheduler.pause(),
Scheduler.setIdleState(IdleState)public boolean isPaused()
Schedulerpublic void post(Runnable runnable)
Schedulerpublic void postDelayed(Runnable runnable, long delayMillis)
SchedulerpostDelayed in class Schedulerrunnable - Runnable to add.delayMillis - Delay in millis.public void postDelayed(Runnable runnable, long delay, TimeUnit unit)
SchedulerpostDelayed in class Schedulerpublic void postAtFrontOfQueue(Runnable runnable)
SchedulerpostAtFrontOfQueue in class Schedulerrunnable - Runnable to add.public void remove(Runnable runnable)
Schedulerpublic boolean advanceToLastPostedRunnable()
ScheduleradvanceToLastPostedRunnable in class Schedulerpublic boolean advanceToNextPostedRunnable()
ScheduleradvanceToNextPostedRunnable in class Schedulerpublic boolean advanceBy(long interval)
Schedulerpublic boolean advanceBy(long amount,
TimeUnit unit)
Schedulerpublic boolean advanceTo(long endTime)
Schedulerpublic boolean runOneTask()
SchedulerrunOneTask in class Schedulerpublic boolean areAnyRunnable()
SchedulerareAnyRunnable in class Schedulerpublic void reset()
Schedulerpublic int size()
Schedulerpublic Duration getNextScheduledTaskTime()
getNextScheduledTaskTime in class Schedulerpublic Duration getLastScheduledTaskTime()
getLastScheduledTaskTime in class Scheduler@Deprecated public void idleConstantly(boolean shouldIdleConstantly)
ScheduleridleConstantly in class SchedulershouldIdleConstantly - If true the idle state will be set to Scheduler.IdleState.CONSTANT_IDLE, otherwise it will be set to Scheduler.IdleState.UNPAUSED.