Java Code Examples for android.view.KeyEvent#isTracking()
The following examples show how to use
android.view.KeyEvent#isTracking() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TapTargetView.java From TapTargetView with Apache License 2.0 | 6 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (isVisible() && isInteractable && cancelable && keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { isInteractable = false; if (listener != null) { listener.onTargetCancel(this); } else { new Listener().onTargetCancel(this); } return true; } return false; }
Example 2
Source File: AppMenu.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (mPopup == null || mPopup.getListView() == null) return false; if (event.getKeyCode() == KeyEvent.KEYCODE_MENU) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { event.startTracking(); v.getKeyDispatcherState().startTracking(event, this); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { v.getKeyDispatcherState().handleUpEvent(event); if (event.isTracking() && !event.isCanceled()) { dismiss(); return true; } } } return false; }
Example 3
Source File: FindToolbar.java From delion with Apache License 2.0 | 6 votes |
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { // Tell the framework to start tracking this event. getKeyDispatcherState().startTracking(event, this); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { getKeyDispatcherState().handleUpEvent(event); if (event.isTracking() && !event.isCanceled()) { mFindToolbar.deactivate(); return true; } } } return false; }
Example 4
Source File: UrlBar.java From delion with Apache License 2.0 | 6 votes |
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { // Tell the framework to start tracking this event. getKeyDispatcherState().startTracking(event, this); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { getKeyDispatcherState().handleUpEvent(event); if (event.isTracking() && !event.isCanceled()) { mUrlBarDelegate.backKeyPressed(); return true; } } } return false; }
Example 5
Source File: AppMenu.java From delion with Apache License 2.0 | 6 votes |
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (mPopup == null || mPopup.getListView() == null) return false; if (event.getKeyCode() == KeyEvent.KEYCODE_MENU) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { event.startTracking(); v.getKeyDispatcherState().startTracking(event, this); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { v.getKeyDispatcherState().handleUpEvent(event); if (event.isTracking() && !event.isCanceled()) { dismiss(); return true; } } } return false; }
Example 6
Source File: Dialog.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * A key was released. * <p> * Default implementation consumes {@link KeyEvent#KEYCODE_BACK KEYCODE_BACK} * and, as of {@link android.os.Build.VERSION_CODES#P P}, {@link KeyEvent#KEYCODE_ESCAPE * KEYCODE_ESCAPE} to close the dialog. * * @see #onKeyDown * @see android.view.KeyEvent */ @Override public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) && event.isTracking() && !event.isCanceled()) { onBackPressed(); return true; } return false; }
Example 7
Source File: QImageView.java From mobile-manager-tool with MIT License | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 8
Source File: ImageViewTouchBase.java From reader with MIT License | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { // If we're zoomed in, pressing Back jumps out to show the // entire image, otherwise Back returns the user to the gallery. zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 9
Source File: ImageViewTouchBase.java From yiim_v2 with GNU General Public License v2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { // If we're zoomed in, pressing Back jumps out to show the // entire image, otherwise Back returns the user to the gallery. zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 10
Source File: ImageViewTouchBase.java From droidddle with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { // If we're zoomed in, pressing Back jumps out to show the // entire image, otherwise Back returns the user to the gallery. zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 11
Source File: MainActivity.java From letv with Apache License 2.0 | 5 votes |
public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode != 4 || !event.isTracking() || event.isCanceled()) { return super.onKeyUp(keyCode, event); } if (this.mLiveFragment.onBackPressed() && event.getRepeatCount() == 0) { return true; } if (!LetvUtils.isNoRetainPopupPcode() && mExitRetainController.showExitRetainPopupwindow(getWindow().getDecorView().getRootView())) { return true; } handleTwiceBackExit(); return true; }
Example 12
Source File: ImageViewTouchBase.java From XERUNG with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { // If we're zoomed in, pressing Back jumps out to show the // entire image, otherwise Back returns the user to the gallery zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 13
Source File: ImageViewTouchBase.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { // If we're zoomed in, pressing Back jumps out to show the // entire image, otherwise Back returns the user to the gallery zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 14
Source File: LauncherAppWidgetHostView.java From LaunchEnr with GNU General Public License v3.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (event.isTracking()) { if (!mChildrenFocused && keyCode == KeyEvent.KEYCODE_ENTER) { mChildrenFocused = true; ArrayList<View> focusableChildren = getFocusables(FOCUS_FORWARD); focusableChildren.remove(this); int childrenCount = focusableChildren.size(); switch (childrenCount) { case 0: mChildrenFocused = false; break; case 1: { if (getTag() instanceof ItemInfo) { ItemInfo item = (ItemInfo) getTag(); if (item.spanX == 1 && item.spanY == 1) { focusableChildren.get(0).performClick(); mChildrenFocused = false; return true; } } // continue; } default: focusableChildren.get(0).requestFocus(); return true; } } } return super.onKeyUp(keyCode, event); }
Example 15
Source File: ImageViewTouchBase.java From reader with MIT License | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { // If we're zoomed in, pressing Back jumps out to show the // entire image, otherwise Back returns the user to the gallery. zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 16
Source File: ImageViewTouchBase.java From styT with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { if (getScale() > 1.0f) { // If we're zoomed in, pressing Back jumps out to show the // entire image, otherwise Back returns the user to the gallery zoomTo(1.0f); return true; } } return super.onKeyUp(keyCode, event); }
Example 17
Source File: ZoomButtonsController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private boolean onContainerKey(KeyEvent event) { int keyCode = event.getKeyCode(); if (isInterestingKey(keyCode)) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { if (mOwnerView != null) { KeyEvent.DispatcherState ds = mOwnerView.getKeyDispatcherState(); if (ds != null) { ds.startTracking(event, this); } } return true; } else if (event.getAction() == KeyEvent.ACTION_UP && event.isTracking() && !event.isCanceled()) { setVisible(false); return true; } } else { dismissControlsDelayed(ZOOM_CONTROLS_TIMEOUT); } // Let the container handle the key return false; } else { ViewRootImpl viewRoot = mOwnerView.getViewRootImpl(); if (viewRoot != null) { viewRoot.dispatchInputEvent(event); } // We gave the key to the owner, don't let the container handle this key return true; } }
Example 18
Source File: InputMethodService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Override this to intercept key up events before they are processed by the * application. If you return true, the application will not itself * process the event. If you return false, the normal application processing * will occur as if the IME had not seen the event at all. * * <p>The default implementation intercepts {@link KeyEvent#KEYCODE_BACK * KeyEvent.KEYCODE_BACK} to hide the current IME UI if it is shown. In * addition, in fullscreen mode only, it will consume DPAD movement * events to move the cursor in the extracted text view, not allowing * them to perform navigation in the underlying application. */ public boolean onKeyUp(int keyCode, KeyEvent event) { if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { final ExtractEditText eet = getExtractEditTextIfVisible(); if (eet != null && eet.handleBackInTextActionModeIfNeeded(event)) { return true; } if (event.isTracking() && !event.isCanceled()) { return handleBack(true); } } return doMovementKey(keyCode, event, MOVEMENT_UP); }
Example 19
Source File: KeyEventCompatEclair.java From guideshow with MIT License | 4 votes |
public static boolean isTracking(KeyEvent event) { return event.isTracking(); }
Example 20
Source File: Dialog.java From PreferenceFragment with Apache License 2.0 | 3 votes |
/** * A key was released. * <p> * The default implementation handles KEYCODE_BACK to close the dialog. * * @see #onKeyDown * @see KeyEvent */ public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) { onBackPressed(); return true; } return false; }