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

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

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

Handler.removeCallbacks介绍

暂无

代码示例

代码示例来源:origin: ReactiveX/RxAndroid

@Override
public void dispose() {
  handler.removeCallbacks(this);
  disposed = true;
}

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

@Override
 public void removeCallbacks(Runnable r) {
  mHandler.removeCallbacks(r);
 }
}

代码示例来源:origin: google/ExoPlayer

public void stopPeriodicUpdates() {
 periodicUpdatesStarted = false;
 handler.removeCallbacks(this);
}

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

public synchronized void cancel() {
 if (mIsPosted) {
  mIsPosted = false;
  mSource = ApplyNewChangeSet.NONE;
  mAttribution = null;
  mHandler.removeCallbacks(this);
 }
}

代码示例来源:origin: google/ExoPlayer

@Override
public void setProgressUpdatingEnabled(boolean enabled) {
 handler.removeCallbacks(this);
 if (enabled) {
  handler.post(this);
 }
}

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

private void recordVibrate(long milliseconds) {
 vibrating = true;
 this.milliseconds = milliseconds;
 handler.removeCallbacks(stopVibratingRunnable);
 handler.postDelayed(stopVibratingRunnable, this.milliseconds);
}

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

private void recordVibratePattern(long[] pattern, int repeat) {
 vibrating = true;
 this.pattern = pattern;
 this.repeat = repeat;
 handler.removeCallbacks(stopVibratingRunnable);
 if (repeat < 0) {
  long endDelayMillis = 0;
  for (long t : pattern) {
   endDelayMillis += t;
  }
  handler.postDelayed(stopVibratingRunnable, endDelayMillis);
 }
}

代码示例来源:origin: rey5137/material

/**
 * Dismiss Dialog immediately without showing out animation.
 */
public void dismissImmediately(){
  super.dismiss();
  if(mHandler != null)
    mHandler.removeCallbacks(mDismissAction);
}

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

@Override
 public void run() {
  mHandlerThread.interrupt();
  mMainHandler.removeCallbacks(mBitmapFetchRunnable);
  mBackgroundHandler.removeCallbacks(mEventDispatchRunnable);
  mIsRunning = false;
  mHandlerThread = null;
  mBitmap = null;
  mCanvas = null;
  mStream = null;
 }
}

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

private void setHighlightedViewImpl(@Nullable View view, @Nullable Rect bounds, int color) {
 mHandler.removeCallbacks(mHighlightViewOnUiThreadRunnable);
 mViewToHighlight.set(view);
 mBoundsToHighlight.set(bounds);
 mContentColor.set(color);
 mHandler.postDelayed(mHighlightViewOnUiThreadRunnable, 100);
}

代码示例来源:origin: google/ExoPlayer

/* package */ void onDashManifestRefreshRequested() {
 handler.removeCallbacks(simulateManifestRefreshRunnable);
 startLoadingManifest();
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

/**
 * 取消 十秒的定时器进行 缓存操作
 */
protected void cancelTimeOutBuffer() {
  Debuger.printfError("cancelTimeOutBuffer");
  // 取消定时
  if (needTimeOutOther)
    mainThreadHandler.removeCallbacks(mTimeOutRunnable);
}

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

@Implementation
 protected void cancel() {
  cancelled = true;
  vibrating = false;
  handler.removeCallbacks(stopVibratingRunnable);
 }
}

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

@Override
public void release() {
  if (simpleExoPlayer != null) {
    simpleExoPlayer.release();
  }
  if (mainHandler != null)
    mainHandler.removeCallbacks(callback);
}

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

@Implementation
protected void removeCallbacks(int callbackType, Runnable action, Object token) {
 handler.removeCallbacks(action, token);
}

代码示例来源:origin: lingochamp/FileDownloader

private void stopTimeCount() {
  if (isFinishing()) {
    return;
  }
  isStopTimer = true;
  timeConsumeTv.getHandler().removeCallbacks(timeCountRunnable);
  final long consume = System.currentTimeMillis() - start;
  if (timeConsumeTv != null) {
    timeConsumeTv.setText(String.valueOf(consume / 1000f));
  }
}

代码示例来源:origin: google/ExoPlayer

public void update() {
 TaskState[] taskStates = downloadManager.getAllTaskStates();
 startForeground(notificationId, getForegroundNotification(taskStates));
 notificationDisplayed = true;
 if (periodicUpdatesStarted) {
  handler.removeCallbacks(this);
  handler.postDelayed(this, updateInterval);
 }
}

代码示例来源:origin: rey5137/material

/**
 * Dismiss the popup window.
 */
public void dismiss() {
  mPopup.dismiss();
  removePromptView();
  mPopup.setContentView(null);
  mDropDownList = null;
  mHandler.removeCallbacks(mResizePopupRunnable);
}

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

@Test
public void testRemoveCallbacks() throws Exception {
 Handler handler = new Handler();
 ShadowLooper shadowLooper = shadowOf(handler.getLooper());
 shadowLooper.pause();
 handler.post(scratchRunnable);
 handler.removeCallbacks(scratchRunnable);
 shadowLooper.unPause();
 assertThat(scratchRunnable.wasRun).isFalse();
}

代码示例来源:origin: bumptech/glide

/**
 * Lifecycle callback that cancels all in progress requests and clears and recycles resources for
 * all completed requests.
 */
@Override
public synchronized void onDestroy() {
 targetTracker.onDestroy();
 for (Target<?> target : targetTracker.getAll()) {
  clear(target);
 }
 targetTracker.clear();
 requestTracker.clearRequests();
 lifecycle.removeListener(this);
 lifecycle.removeListener(connectivityMonitor);
 mainHandler.removeCallbacks(addSelfToLifecycle);
 glide.unregisterRequestManager(this);
}

相关文章