android.os.Handler.postAtFrontOfQueue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(236)

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

Handler.postAtFrontOfQueue介绍

暂无

代码示例

代码示例来源:origin: yanzhenjie/NoHttp

public boolean postAtFrontOfQueue(Runnable r) {
  return mHandler.postAtFrontOfQueue(r);
}

代码示例来源:origin: chentao0707/SimplifyReader

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: mcxiaoke/android-volley

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: jiangqqlmj/FastDev4Android

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: facebook/litho

new ArrayDeque<>(mDataRenderedCallbacks);
mDataRenderedCallbacks.clear();
mMainThreadHandler.postAtFrontOfQueue(
  new Runnable() {
   @Override

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

@Test
public void testPostAtFrontOfQueueThenRunMainLooperOneTaskAtATime_shouldRunFrontOfQueueTaskFirst() throws Exception {
 TestRunnable task1 = new TestRunnable();
 TestRunnable task2 = new TestRunnable();
 ShadowLooper.pauseMainLooper();
 new Handler().post(task1);
 boolean result = new Handler().postAtFrontOfQueue(task2);
 assertTrue(result);
 ShadowLooper.runMainLooperOneTask();
 assertThat(task2.wasRun).isTrue();
 assertThat(task1.wasRun).isFalse();
 ShadowLooper.runMainLooperOneTask();
 assertThat(task1.wasRun).isTrue();
}

代码示例来源:origin: waynell/VideoListPlayer

private void scaleVideoSize(int videoWidth, int videoHeight) {
  if (videoWidth == 0 || videoHeight == 0) {
    return;
  }
  Size viewSize = new Size(getWidth(), getHeight());
  Size videoSize = new Size(videoWidth, videoHeight);
  ScaleManager scaleManager = new ScaleManager(viewSize, videoSize);
  final Matrix matrix = scaleManager.getScaleMatrix(mScaleType);
  if (matrix == null) {
    return;
  }
  if(Looper.myLooper() == Looper.getMainLooper()) {
    setTransform(matrix);
  }
  else {
    mHandler.postAtFrontOfQueue(new Runnable() {
      @Override
      public void run() {
        setTransform(matrix);
      }
    });
  }
}

代码示例来源:origin: gicheonkang/fast-face-android

public void release() {
  mUIHandler.postAtFrontOfQueue(new Runnable() {
    @Override
    public void run() {
      if (mWindowManager != null) {
        mWindowManager.removeViewImmediate(mRootView);
        mRootView = null;
      }
      mUIHandler.removeCallbacksAndMessages(null);
    }
  });
}

代码示例来源:origin: commonsguy/cw-androidarch

@Override
public void onCreate() {
 super.onCreate();
 new Handler().postAtFrontOfQueue(this::enableStrictMode);
}

代码示例来源:origin: com.mopub.volley/mopub-volley

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: xuningjack/AndroidNet

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: jungletian/TitanjumNote

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: com.mcxiaoke.volley/library

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: tazimete/android-app-food-delivery-system

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: MewX/light-novel-library_Wenku8_Android

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: tazimete/android-app-food-delivery-system

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: cat9/EasyVolley

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: panxw/android-volley-manager

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: CPPAlien/DaVinci

@Override
public boolean isCanceled() {
  // This is a little bit of a hack, but hey, why not.
  mCache.clear();
  if (mCallback != null) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postAtFrontOfQueue(mCallback);
  }
  return true;
}

代码示例来源:origin: commonsguy/cw-androidarch

@Override
public void onCreate() {
 super.onCreate();
 if (LeakCanary.isInAnalyzerProcess(this)) {
  return;
 }
 LeakCanary.install(this);
 new Handler().postAtFrontOfQueue(this::enableStrictMode);
}

相关文章