@Override public void onDraw(Canvas canvas, RectF latlonRect, RectF tilesRect, DrawSettings nightMode) { BaseMapLayer mainLayer = view.getMainLayer(); boolean zoomInEnabled = mainLayer != null && view.getZoom() < mainLayer.getMaximumShownMapZoom(); boolean zoomOutEnabled = mainLayer != null && view.getZoom() > mainLayer.getMinimumShownMapZoom(); if (zoomInButton.isEnabled() != zoomInEnabled) { zoomInButton.setEnabled(zoomInEnabled); } if (zoomOutButton.isEnabled() != zoomOutEnabled) { zoomOutButton.setEnabled(zoomOutEnabled); } drawApplicationMode(canvas); if (view.isZooming()) { showZoomLevel = true; showUIHandler.removeMessages(SHOW_ZOOM_LEVEL_MSG_ID); } else { if (showZoomLevel) { hideZoomLevelInTime(); } } if (showZoomLevel || !view.getSettings().SHOW_RULER.get()) { drawZoomLevel(canvas); } else { drawRuler(canvas); } }
private void evaluatePredict(int mask) { Leg.i(TAG, "evaluatePredict(" + mask + ")"); calculatePredict(mask); Leg.i(TAG, "calculated predict: " + mPredict); if ((mPredict & START_PRD_SB_SV) == START_PRD_SB_SV) { Leg.i(TAG, "prediction: foreground surface"); Surface surface = mSurfaceHolder.getSurface(); if (surface != null && surface.isValid()) { mPlaybackService.setForegroundSurfaceHolder(mSurfaceHolder); } else { mPlaybackService.setForegroundSurfaceHolder(null); } } if ((mPredict & START_PRD_SI_SB_SV) == START_PRD_SI_SB_SV) { Leg.i(TAG, "prediction: send start playback message"); mHandler.removeMessages(START_PLAY_BACK); mHandler.removeMessages(STOP_PLAY_BACK); if (!mPlaybackService.isPlaying()) { mHandler.obtainMessage(STOP_PLAY_BACK).sendToTarget(); mHandler.obtainMessage(START_PLAY_BACK).sendToTarget(); } } }
/** 暂停并且清除定时任务 */ public void pauseClearDelayed() { pause(); if (mVideoHandler.hasMessages(HANDLER_MESSAGE_PARSE)) mVideoHandler.removeMessages(HANDLER_MESSAGE_PARSE); if (mVideoHandler.hasMessages(HANDLER_MESSAGE_LOOP)) mVideoHandler.removeMessages(HANDLER_MESSAGE_LOOP); }
@Override protected void onPause() { aborted = true; handler.removeMessages(MSG_CHECK_FORCE_COMPRESSION); handler.removeMessages(MSG_CONTENT_READY); super.onPause(); }
private void cancelTaps() { mHandler.removeMessages(SHOW_PRESS); mHandler.removeMessages(LONG_PRESS); mHandler.removeMessages(TAP); mIsDoubleTapping = false; mAlwaysInTapRegion = false; mAlwaysInBiggerTapRegion = false; if (mInLongPress) { mInLongPress = false; } }
// 取消录音,清除计时 private void cancelRecord() { // 可能在消息队列中还存在HandlerMessage,移除剩余消息 mVolumeHandler.removeMessages(56, null); mVolumeHandler.removeMessages(57, null); mVolumeHandler.removeMessages(58, null); mVolumeHandler.removeMessages(59, null); mTimeUp = false; cancelTimer(); stopRecording(); if (recordIndicator != null) recordIndicator.dismiss(); if (myRecAudioFile != null) myRecAudioFile.delete(); }
private void requestReloadingDialpads() { boolean isReloadTimeout = false; if (mHandler.hasMessages(RELOAD_DIALPADS_TIMEOUT)) { isReloadTimeout = true; mHandler.removeMessages(RELOAD_DIALPADS_TIMEOUT); } mHandler.sendEmptyMessageDelayed(RELOAD_DIALPADS_TIMEOUT, RELOAD_DIALPADS_DELAYTIME); loge("isReloadTimeout=" + isReloadTimeout); mHandler.removeMessages(RELOAD_DIALPADS); mHandler.sendEmptyMessageDelayed( RELOAD_DIALPADS, isReloadTimeout ? RELOAD_DIALPADS_DELAYTIME : 0); }
void elementHandler(int x, int y, int action) { for (Point point : points.getValues()) if (point.getRegion().contains(x, y)) return; switch (action) { case MotionEvent.ACTION_DOWN: mHandler.sendMessageDelayed( Message.obtain(mHandler, CODE_ELEMENT_LONGCLICK), ViewConfiguration.getLongPressTimeout()); fX = x - getScVal(this.x); fY = y - getScVal(this.y); break; case MotionEvent.ACTION_MOVE: if (mMoovingPermitted) { dX = getGridCoord((x - fX) / getScaleFactor()); dY = getGridCoord((y - fY) / getScaleFactor()); if (this.x != dX | this.y != dY) { this.x = dX; this.y = dY; for (Link link : links) link.measure(); onUpdate(); getSdk().getSdkFragment().update(); isPossibleToRemoving = getSdk().getSdkFragment().getRemovingElementView().checkRemoving(this); } } break; case MotionEvent.ACTION_UP: if (mMoovingPermitted) { mMoovingPermitted = false; getSdk().getSdkFragment().lockScroll(false); getSdk().getSdkFragment().setRemovingViewState(false); MainActivity.mainFragment.showTabs(); } else if (mLinkCreationToggle) { mLinkCreationToggle = false; } else { if (!isSelected()) sdk.setSelectedElement(this); } if (mHandler.hasMessages(CODE_ELEMENT_LONGCLICK)) mHandler.removeMessages(CODE_ELEMENT_LONGCLICK); if (isPossibleToRemoving) getSdk().getSdkFragment().getRemovingElementView().remove(this); break; case MotionEvent.ACTION_CANCEL: if (mHandler.hasMessages(CODE_ELEMENT_LONGCLICK)) mHandler.removeMessages(CODE_ELEMENT_LONGCLICK); break; } }
private void cancel() { mHandler.removeMessages(SHOW_PRESS); mHandler.removeMessages(LONG_PRESS); mHandler.removeMessages(TAP); mVelocityTracker.recycle(); mVelocityTracker = null; mIsDoubleTapping = false; mStillDown = false; mAlwaysInTapRegion = false; mAlwaysInBiggerTapRegion = false; if (mInLongPress) { mInLongPress = false; } }
/** 区域内循环播放 */ public void loopDelayed(int startTime, int endTime) { if (mVideoHandler.hasMessages(HANDLER_MESSAGE_PARSE)) mVideoHandler.removeMessages(HANDLER_MESSAGE_PARSE); if (mVideoHandler.hasMessages(HANDLER_MESSAGE_LOOP)) mVideoHandler.removeMessages(HANDLER_MESSAGE_LOOP); int delayMillis = endTime - startTime; seekTo(startTime); if (!isPlaying()) start(); if (mVideoHandler.hasMessages(HANDLER_MESSAGE_LOOP)) mVideoHandler.removeMessages(HANDLER_MESSAGE_LOOP); mVideoHandler.sendMessageDelayed( mVideoHandler.obtainMessage(HANDLER_MESSAGE_LOOP, getCurrentPosition(), delayMillis), delayMillis); }
private void cancelTaps() { mHandler.removeMessages(1); mHandler.removeMessages(2); mHandler.removeMessages(3); mIsDoubleTapping = false; mAlwaysInTapRegion = false; mAlwaysInBiggerTapRegion = false; mDeferConfirmSingleTap = false; if (mInLongPress) { mInLongPress = false; } }
private void m() { t = m.getCurrentPosition(); if (J.hasMessages(7)) { J.removeMessages(7); } if (J.hasMessages(9)) { J.removeMessages(9); } if (b.getVisibility() == 0) { b.setVisibility(8); } new Thread(new jw(this)).start(); }
@Override public void destroy() { AwesomeBarCursorAdapter adapter = getCursorAdapter(); unregisterEventListener("SearchEngines:Data"); if (adapter == null) { return; } Cursor cursor = adapter.getCursor(); if (cursor != null) cursor.close(); mHandler.removeMessages(MESSAGE_UPDATE_FAVICONS); mHandler.removeMessages(MESSAGE_LOAD_FAVICONS); mHandler = null; }
public boolean moveTetrominoRight() { Log.d(TAG, "move tetromino to right"); synchronized (lockObj) { if (currentTetromino.moveRight(oldMap)) { currentMap.copyFrom(oldMap); currentTetromino.putOnMap(currentMap); lastMoveMap.copyFrom(currentMap); // if old position will collision but new moved position will not, then need remove the new // tetromino message and send tetromino move message= if (!currentTetromino.isCollisionY( currentTetromino.getY() + 1, currentTetromino.getSharp(), oldMap)) { if (handler.hasMessages(MSG_NEW_TETROMINO)) { handler.removeMessages(MSG_NEW_TETROMINO); handler.sendEmptyMessageDelayed(MSG_TETROMINO_MOVE, TETROMINO_MOVE_INTERVAL_RESEND); } } for (ITetrisListener listener : customizedListeners) { listener.onTetrominoMove(); } return true; } return false; } }
@Override public void onDestroyView() { mList = null; mHandler.removeCallbacks(mRequestFocus); mHandler.removeMessages(MSG_BIND_PREFERENCES); super.onDestroyView(); }
void requestTimer(boolean on) { if (gameWantsTimer && on) return; gameWantsTimer = on; if (on) handler.sendMessageDelayed(handler.obtainMessage(MsgType.TIMER.ordinal()), timerInterval); else handler.removeMessages(MsgType.TIMER.ordinal()); }
@Override public void handleMessage(Message m) { switch (m.what) { case MSG_START: mHandler.sendEmptyMessage(MSG_UPDATE); break; case MSG_STOP: mHandler.removeMessages(MSG_UPDATE); break; case MSG_UPDATE: int[] pids = mMemoryService.getTrackedProcesses(); final int N = getChildCount(); if (pids.length != N) initViews(); else for (int i = 0; i < N; i++) { ProcessWatcher pw = ((ProcessWatcher) getChildAt(i)); if (indexOf(pids, pw.getPid()) < 0) { initViews(); break; } pw.update(); } mHandler.sendEmptyMessageDelayed(MSG_UPDATE, UPDATE_RATE); break; } }
@Override protected void onPause() { super.onPause(); // removeWindow(); kl.reenableKeyguard(); unregisterReceiver(mWifiReceiver); unregisterReceiver(mPowerBroadcastReceiver); sensorManager.unregisterListener(lsn); mWifiHandler.removeMessages(WIFI_MSG_SCAN); Log.d(TAG, " __________________---------- oldBrightness = " + oldBrightness); switch (mRecorder.state()) { case Recorder.IDLE_STATE: mRecorder.delete(); break; case Recorder.PLAYING_STATE: mRecorder.stop(); mRecorder.delete(); break; case Recorder.RECORDING_STATE: mRecorder.stop(); mRecorder.clear(); break; } mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, mOldVolume, 0); if (mSpeakerOn) { mAudioManager.setSpeakerphoneOn(false); } // unregisterReceiver(mPowerBroadcastReceiver); }
/** Cancel loading of a drawable for a certain ImageView. */ public void cancelLoad(ImageView view) { String fso = mRequests.get(view); if (fso != null && mWorkerHandler != null) { mWorkerHandler.removeMessages(MSG_LOAD, fso); } mRequests.remove(view); }
public void setIcon(int index, StatusBarIcon icon) { synchronized (mList) { int what = MSG_ICON | index; mHandler.removeMessages(what); mHandler.obtainMessage(what, OP_SET_ICON, 0, icon.clone()).sendToTarget(); } }
@Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_PRESSED: mHandler.removeMessages(MSG_TIMEOUT); if (mPressedCount < Integer.MAX_VALUE) { mPressedCount++; } break; case MSG_TIMEOUT: mHandler.removeCallbacksAndMessages(null); switch (mPressedCount) { case SINGLE_CLICK: sendMediaCommand((Context) msg.obj, CMDTOGGLEPAUSE); break; case DOUBLE_CLICK: sendMediaCommand((Context) msg.obj, CMDNEXT); break; case TRIPLE_CLICK: sendMediaCommand((Context) msg.obj, CMDPREVIOUS); break; } mPressedCount = 0; break; } }
public void removeIcon(int index) { synchronized (mList) { int what = MSG_ICON | index; mHandler.removeMessages(what); mHandler.obtainMessage(what, OP_REMOVE_ICON, 0, null).sendToTarget(); } }
private void autoFocus() { if (CameraController.autoFocus()) { mState = STATE_FOCUSING; updateFocusUI(); mHandler.removeMessages(RESET_TOUCH_FOCUS); } }
void pause() { synchronized (mLock) { mResumed = false; mRefreshUiListener = null; mHandler.removeMessages(MSG_UPDATE_TIME); } }
/** * Show the controller on screen. It will go away automatically after 'timeout' milliseconds of * inactivity. * * @param timeInMilliSeconds The timeout in milliseconds. Use 0 to show the controller until * hide() is called. */ @Override public void show(final int timeInMilliSeconds) { if (!mShowing) { showBottomArea(); setProgress(); if (mPauseButton != null) { mPauseButton.requestFocus(); } mShowing = true; setVisibility(View.VISIBLE); } updatePausePlay(); // cause the progress bar to be updated even if mShowing // was already true. This happens, for example, if we're // paused with the progress bar showing the user hits play. mHandler.sendEmptyMessage(SHOW_PROGRESS); Message msg = mHandler.obtainMessage(FADE_OUT); if (timeInMilliSeconds != 0) { mHandler.removeMessages(FADE_OUT); mHandler.sendMessageDelayed(msg, timeInMilliSeconds); } if (visibilityListener != null) { visibilityListener.onControlsVisibilityChange(true); } }
protected void onPostResume() { super.onPostResume(); a.removeMessages(2); a(); b.e(); }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equalsIgnoreCase(ACTION_SHOW_PROGRESSBAR)) { setSupportProgressBarIndeterminateVisibility(true); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else if (action.equalsIgnoreCase(ACTION_HIDE_PROGRESSBAR)) { setSupportProgressBarIndeterminateVisibility(false); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else if (action.equalsIgnoreCase(ACTION_SHOW_TEXTINFO)) { String info = intent.getStringExtra("info"); int max = intent.getIntExtra("max", 0); int progress = intent.getIntExtra("progress", 100); mInfoText.setText(info); mInfoProgress.setMax(max); mInfoProgress.setProgress(progress); if (info == null) { /* Cancel any upcoming visibility change */ mHandler.removeMessages(ACTIVITY_SHOW_INFOLAYOUT); mInfoLayout.setVisibility(View.GONE); } else { /* Slightly delay the appearance of the progress bar to avoid unnecessary flickering */ if (!mHandler.hasMessages(ACTIVITY_SHOW_INFOLAYOUT)) { Message m = new Message(); m.what = ACTIVITY_SHOW_INFOLAYOUT; mHandler.sendMessageDelayed(m, 300); } } } }
private void gotoMenu() { if (userPagelayout != null) { isAnimationOpen = !isAnimationOpen; if (isAnimationOpen) { if (mainMenu != null) { mainMenu.setIsCanClick(true); } mHandler.removeMessages(MessageID.MESSAGE_CONNECT_LAYOUTOVER); Animation animation = AnimationUtils.loadAnimation(this, R.anim.right_out); animation.setFillEnabled(true); animation.setFillAfter(true); animation.setAnimationListener(this); // 动画播放,实际布局坐标不变 userPagelayout.startAnimation(animation); OfflineLog.writeMainMenu(); // 写入离线日志 } else { if (mainMenu != null) { mainMenu.setIsCanClick(false); } Animation animation = AnimationUtils.loadAnimation(this, R.anim.left_in); animation.setAnimationListener(this); animation.setFillEnabled(true); animation.setFillAfter(true); userPagelayout.startAnimation(animation); } } }
public void updateNetworkState(int state, NetworkInfo info) { mHandler.removeMessages(UPDATE_NETWORK_STATE); Message m = Message.obtain(mHandler, UPDATE_NETWORK_STATE); m.arg1 = state; m.obj = info; mHandler.sendMessage(m); }
private void cancelAutoFocus() { Log.e(TAG, "cancelAutofocus"); // Note: CameraController.getFocusMode(); will return // 'FOCUS_MODE_AUTO' if actual // mode is in fact FOCUS_MODE_CONTINUOUS_PICTURE or // FOCUS_MODE_CONTINUOUS_VIDEO int fm = CameraController.getFocusMode(); if (fm != CameraParameters.AF_MODE_UNSUPPORTED) { if (fm != preferenceFocusMode && preferenceFocusMode != CameraParameters.MF_MODE) { CameraController.cancelAutoFocus(); CameraController.setCameraFocusMode(preferenceFocusMode); } } // Reset the tap area before calling mListener.cancelAutofocus. // Otherwise, focus mode stays at auto and the tap area passed to the // driver is not reset. CameraController.setCameraFocusAreas(null); ApplicationScreen.instance.setCameraMeteringMode(ApplicationScreen.getMeteringMode()); resetTouchFocus(); mState = STATE_IDLE; CameraController.setFocusState(CameraController.FOCUS_STATE_IDLE); updateFocusUI(); mHandler.removeMessages(RESET_TOUCH_FOCUS); }