本文整理了Java中org.robolectric.util.Scheduler.runOrQueueRunnable()
方法的一些代码示例,展示了Scheduler.runOrQueueRunnable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.runOrQueueRunnable()
方法的具体详情如下:
包路径:org.robolectric.util.Scheduler
类名称:Scheduler
方法名:runOrQueueRunnable
暂无
代码示例来源:origin: robolectric/robolectric
/**
* Add a runnable to the queue to be run after a delay.
*/
public synchronized void postDelayed(Runnable runnable, long delay, TimeUnit unit) {
long delayMillis = unit.toMillis(delay);
if ((idleState != CONSTANT_IDLE && (isPaused() || delayMillis > 0)) || Thread.currentThread() != associatedThread) {
runnables.add(new ScheduledRunnable(runnable, currentTime + delayMillis));
} else {
runOrQueueRunnable(runnable, currentTime + delayMillis);
}
}
代码示例来源:origin: robolectric/robolectric
/**
* Add a runnable to the head of the queue.
*
* @param runnable Runnable to add.
*/
public synchronized void postAtFrontOfQueue(Runnable runnable) {
if (isPaused() || Thread.currentThread() != associatedThread) {
final long timeDisambiguator;
if (runnables.isEmpty()) {
timeDisambiguator = nextTimeDisambiguator++;
} else {
timeDisambiguator = runnables.peek().timeDisambiguator - 1;
}
runnables.add(new ScheduledRunnable(runnable, 0, timeDisambiguator));
} else {
runOrQueueRunnable(runnable, currentTime);
}
}
代码示例来源:origin: org.robolectric/utils
/**
* Add a runnable to the queue to be run after a delay.
*/
public synchronized void postDelayed(Runnable runnable, long delay, TimeUnit unit) {
long delayMillis = unit.toMillis(delay);
if ((idleState != CONSTANT_IDLE && (isPaused() || delayMillis > 0)) || Thread.currentThread() != associatedThread) {
runnables.add(new ScheduledRunnable(runnable, currentTime + delayMillis));
} else {
runOrQueueRunnable(runnable, currentTime + delayMillis);
}
}
代码示例来源:origin: org.robolectric/robolectric-utils
/**
* Add a runnable to the queue to be run after a delay.
*/
public synchronized void postDelayed(Runnable runnable, long delay, TimeUnit unit) {
long delayMillis = unit.toMillis(delay);
if ((idleState != CONSTANT_IDLE && (isPaused() || delayMillis > 0)) || Thread.currentThread() != associatedThread) {
queueRunnableAndSort(runnable, currentTime + delayMillis);
} else {
runOrQueueRunnable(runnable, currentTime + delayMillis);
}
}
代码示例来源:origin: org.robolectric/robolectric-utils
/**
* Add a runnable to the head of the queue.
*
* @param runnable Runnable to add.
*/
public synchronized void postAtFrontOfQueue(Runnable runnable) {
if (isPaused() || Thread.currentThread() != associatedThread) {
runnables.add(0, new ScheduledRunnable(runnable, currentTime));
} else {
runOrQueueRunnable(runnable, currentTime);
}
}
代码示例来源:origin: org.robolectric/utils
/**
* Add a runnable to the head of the queue.
*
* @param runnable Runnable to add.
*/
public synchronized void postAtFrontOfQueue(Runnable runnable) {
if (isPaused() || Thread.currentThread() != associatedThread) {
final long timeDisambiguator;
if (runnables.isEmpty()) {
timeDisambiguator = nextTimeDisambiguator++;
} else {
timeDisambiguator = runnables.peek().timeDisambiguator - 1;
}
runnables.add(new ScheduledRunnable(runnable, 0, timeDisambiguator));
} else {
runOrQueueRunnable(runnable, currentTime);
}
}
内容来源于网络,如有侵权,请联系作者删除!