org.robolectric.util.Scheduler.remove()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.robolectric.util.Scheduler.remove()方法的一些代码示例,展示了Scheduler.remove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.remove()方法的具体详情如下:
包路径:org.robolectric.util.Scheduler
类名称:Scheduler
方法名:remove

Scheduler.remove介绍

[英]Remove a runnable from the queue.
[中]从队列中删除runnable。

代码示例

代码示例来源:origin: robolectric/robolectric

@Override
public List<Runnable> shutdownNow() {
 isShutdown = true;
 List<Runnable> notExecutedRunnables = new ArrayList<>();
 for (Runnable runnable : runnables) {
  scheduler.remove(runnable);
  notExecutedRunnables.add(runnable);
 }
 runnables.clear();
 return notExecutedRunnables;
}

代码示例来源:origin: robolectric/robolectric

@Implementation
protected boolean removeCallbacks(Runnable callback) {
 ShadowLooper shadowLooper = Shadow.extract(Looper.getMainLooper());
 shadowLooper.getScheduler().remove(callback);
 return true;
}

代码示例来源:origin: robolectric/robolectric

private void unschedule() {
 Handler target = realMessage.getTarget();
 if (target != null && scheduledRunnable != null) {
  shadowOf(target.getLooper()).getScheduler().remove(scheduledRunnable);
  scheduledRunnable = null;
 }
}

代码示例来源:origin: robolectric/robolectric

@Test
public void remove_ShouldRemoveAllInstancesOfRunnableFromQueue() throws Exception {
 scheduler.post(new TestRunnable());
 TestRunnable runnable = new TestRunnable();
 scheduler.post(runnable);
 scheduler.post(runnable);
 assertThat(scheduler.size()).isEqualTo(3);
 scheduler.remove(runnable);
 assertThat(scheduler.size()).isEqualTo(1);
 scheduler.advanceToLastPostedRunnable();
 assertThat(runnable.wasRun).isFalse();
}

代码示例来源:origin: org.robolectric/shadows-framework

@Override
public List<Runnable> shutdownNow() {
 isShutdown = true;
 List<Runnable> notExecutedRunnables = new ArrayList<>();
 for (Runnable runnable : runnables) {
  scheduler.remove(runnable);
  notExecutedRunnables.add(runnable);
 }
 runnables.clear();
 return notExecutedRunnables;
}

代码示例来源:origin: org.robolectric/framework

@Override
public List<Runnable> shutdownNow() {
 isShutdown = true;
 List<Runnable> notExecutedRunnables = new ArrayList<>();
 for (Runnable runnable : runnables) {
  scheduler.remove(runnable);
  notExecutedRunnables.add(runnable);
 }
 runnables.clear();
 return notExecutedRunnables;
}

代码示例来源:origin: org.robolectric/shadows-core-v23

@Override
public List<Runnable> shutdownNow() {
 isShutdown = true;
 List<Runnable> notExecutedRunnables = new ArrayList<>();
 for (Runnable runnable : runnables) {
  scheduler.remove(runnable);
  notExecutedRunnables.add(runnable);
 }
 runnables.clear();
 return notExecutedRunnables;
}

代码示例来源:origin: org.robolectric/shadows-core

@Override
public List<Runnable> shutdownNow() {
 isShutdown = true;
 List<Runnable> notExecutedRunnables = new ArrayList<>();
 for (Runnable runnable : runnables) {
  scheduler.remove(runnable);
  notExecutedRunnables.add(runnable);
 }
 runnables.clear();
 return notExecutedRunnables;
}

代码示例来源:origin: org.robolectric/shadows-core-v23

@Implementation
public void removeCallbacks(Runnable callback) {
 shadowOf(Looper.getMainLooper()).getScheduler().remove(callback);
}

代码示例来源:origin: org.robolectric/shadows-framework

@Implementation
protected boolean removeCallbacks(Runnable callback) {
 ShadowLooper shadowLooper = Shadow.extract(Looper.getMainLooper());
 shadowLooper.getScheduler().remove(callback);
 return true;
}

代码示例来源:origin: org.robolectric/shadows-core

@Implementation
public void removeCallbacks(Runnable callback) {
 shadowOf(Looper.getMainLooper()).getScheduler().remove(callback);
}

代码示例来源:origin: org.robolectric/framework

@Implementation
public void removeCallbacks(Runnable callback) {
 shadowOf(Looper.getMainLooper()).getScheduler().remove(callback);
}

代码示例来源:origin: org.robolectric/shadows-core-v23

private void unschedule() {
 Handler target = realMessage.getTarget();
 if (target != null && scheduledRunnable != null) {
  shadowOf(target.getLooper()).getScheduler().remove(scheduledRunnable);
  scheduledRunnable = null;
 }
}

代码示例来源:origin: org.robolectric/shadows-core

private void unschedule() {
 Handler target = realMessage.getTarget();
 if (target != null && scheduledRunnable != null) {
  shadowOf(target.getLooper()).getScheduler().remove(scheduledRunnable);
  scheduledRunnable = null;
 }
}

代码示例来源:origin: org.robolectric/framework

private void unschedule() {
 Handler target = realMessage.getTarget();
 if (target != null && scheduledRunnable != null) {
  shadowOf(target.getLooper()).getScheduler().remove(scheduledRunnable);
  scheduledRunnable = null;
 }
}

代码示例来源:origin: org.robolectric/shadows-framework

private void unschedule() {
 Handler target = realMessage.getTarget();
 if (target != null && scheduledRunnable != null) {
  shadowOf(target.getLooper()).getScheduler().remove(scheduledRunnable);
  scheduledRunnable = null;
 }
}

相关文章