@Implements(value=android.os.Looper.class) public class ShadowLooper extends Object
Looper that enqueues posted Runnables to be run
(on this thread) later. Runnables that are scheduled to run immediately can be
triggered by calling idle().ShadowMessageQueue| Constructor and Description |
|---|
ShadowLooper() |
| Modifier and Type | Method and Description |
|---|---|
static android.os.Looper |
getMainLooper() |
org.robolectric.util.Scheduler |
getScheduler()
Returns the
Scheduler that is being used to manage the enqueued tasks. |
Thread |
getThread() |
boolean |
hasQuit() |
void |
idle()
Causes
Runnables that have been scheduled to run immediately to actually run. |
void |
idle(long intervalMillis)
Causes
Runnables that have been scheduled to run within the next intervalMillis milliseconds to
run while advancing the scheduler's clock. |
void |
idleConstantly(boolean shouldIdleConstantly) |
static void |
idleMainLooper() |
static void |
idleMainLooper(long interval) |
static void |
idleMainLooperConstantly(boolean shouldIdleConstantly) |
boolean |
isPaused() |
static void |
loop() |
static android.os.Looper |
myLooper() |
void |
pause() |
static void |
pauseLooper(android.os.Looper looper) |
static void |
pauseMainLooper() |
boolean |
post(Runnable runnable,
long delayMillis)
Deprecated.
Use a
Handler instance to post to a looper. |
boolean |
postAtFrontOfQueue(Runnable runnable)
Deprecated.
Use a
Handler instance to post to a looper. |
int |
postSyncBarrier() |
void |
quit() |
void |
removeSyncBarrier(int token) |
void |
reset()
Causes all enqueued tasks to be discarded, and pause state to be reset
|
static void |
resetThreadLoopers() |
static void |
runMainLooperOneTask() |
static void |
runMainLooperToNextTask() |
void |
runOneTask()
Causes only one of the next
Runnables that have been scheduled to run while advancing the scheduler's
clock to its start time. |
void |
runPaused(Runnable r) |
void |
runToEndOfTasks()
|
void |
runToNextTask()
Causes the next
Runnable(s) that have been scheduled to run while advancing the scheduler's clock to its
start time. |
static void |
runUiThreadTasks()
Runs any immediately runnable tasks previously queued on the UI thread,
e.g.
|
static void |
runUiThreadTasksIncludingDelayedTasks() |
boolean |
setPaused(boolean shouldPause) |
void |
unPause() |
static void |
unPauseLooper(android.os.Looper looper) |
static void |
unPauseMainLooper() |
@Resetter public static void resetThreadLoopers()
@Implementation public static android.os.Looper getMainLooper()
@Implementation public static void loop()
@Implementation public static android.os.Looper myLooper()
@Implementation public void quit()
@Implementation public Thread getThread()
@HiddenApi @Implementation public int postSyncBarrier()
@HiddenApi @Implementation public void removeSyncBarrier(int token)
public boolean hasQuit()
public static void pauseLooper(android.os.Looper looper)
public static void unPauseLooper(android.os.Looper looper)
public static void pauseMainLooper()
public static void unPauseMainLooper()
public static void idleMainLooper()
public static void idleMainLooper(long interval)
public static void idleMainLooperConstantly(boolean shouldIdleConstantly)
public static void runMainLooperOneTask()
public static void runMainLooperToNextTask()
public static void runUiThreadTasks()
Activity.runOnUiThread(Runnable) or AsyncTask.onPostExecute(Object).
Note: calling this method does not pause or un-pause the scheduler.
public static void runUiThreadTasksIncludingDelayedTasks()
public void idle()
Runnables that have been scheduled to run immediately to actually run. Does not advance the
scheduler's clock;public void idle(long intervalMillis)
Runnables that have been scheduled to run within the next intervalMillis milliseconds to
run while advancing the scheduler's clock.intervalMillis - milliseconds to advancepublic void idleConstantly(boolean shouldIdleConstantly)
public void runToEndOfTasks()
public void runToNextTask()
public void runOneTask()
@Deprecated public boolean post(Runnable runnable, long delayMillis)
Handler instance to post to a looper.runnable - the task to be rundelayMillis - how many milliseconds into the (virtual) future to run itHandler.postDelayed(Runnable,long)@Deprecated public boolean postAtFrontOfQueue(Runnable runnable)
Handler instance to post to a looper.runnable - the task to be runHandler.postAtFrontOfQueue(Runnable)public void pause()
public void unPause()
public boolean isPaused()
public boolean setPaused(boolean shouldPause)
public void reset()
public org.robolectric.util.Scheduler getScheduler()
Scheduler that is being used to manage the enqueued tasks.Scheduler that is being used to manage the enqueued tasks.public void runPaused(Runnable r)
Copyright © 2015. All rights reserved.