List of usage examples for android.view MotionEvent ACTION_HOVER_ENTER
int ACTION_HOVER_ENTER
To view the source code for android.view MotionEvent ACTION_HOVER_ENTER.
Click Source Link
From source file:com.android.inputmethod.latin.suggestions.SuggestionStripView.java
@Override public boolean onTouchEvent(final MotionEvent me) { if (!mMoreSuggestionsView.isShowingInParent()) { // Ignore any touch event while more suggestions panel hasn't been shown. // Detecting sliding up is done at {@link #onInterceptTouchEvent}. return true; }// w w w.j a v a2s.c o m // In the sliding input mode. {@link MotionEvent} should be forwarded to // {@link MoreSuggestionsView}. final int index = me.getActionIndex(); final int x = mMoreSuggestionsView.translateX((int) me.getX(index)); final int y = mMoreSuggestionsView.translateY((int) me.getY(index)); me.setLocation(x, y); if (!mNeedsToTransformTouchEventToHoverEvent) { mMoreSuggestionsView.onTouchEvent(me); return true; } // In sliding suggestion mode with accessibility mode on, a touch event should be // transformed to a hover event. final int width = mMoreSuggestionsView.getWidth(); final int height = mMoreSuggestionsView.getHeight(); final boolean onMoreSuggestions = (x >= 0 && x < width && y >= 0 && y < height); if (!onMoreSuggestions && !mIsDispatchingHoverEventToMoreSuggestions) { // Just drop this touch event because dispatching hover event isn't started yet and // the touch event isn't on {@link MoreSuggestionsView}. return true; } final int hoverAction; if (onMoreSuggestions && !mIsDispatchingHoverEventToMoreSuggestions) { // Transform this touch event to a hover enter event and start dispatching a hover // event to {@link MoreSuggestionsView}. mIsDispatchingHoverEventToMoreSuggestions = true; hoverAction = MotionEvent.ACTION_HOVER_ENTER; } else if (me.getActionMasked() == MotionEvent.ACTION_UP) { // Transform this touch event to a hover exit event and stop dispatching a hover event // after this. mIsDispatchingHoverEventToMoreSuggestions = false; mNeedsToTransformTouchEventToHoverEvent = false; hoverAction = MotionEvent.ACTION_HOVER_EXIT; } else { // Transform this touch event to a hover move event. hoverAction = MotionEvent.ACTION_HOVER_MOVE; } me.setAction(hoverAction); mMoreSuggestionsView.onHoverEvent(me); return true; }
From source file:org.chromium.chrome.browser.compositor.CompositorViewHolder.java
private void setContentViewMotionEventOffsets(MotionEvent e, boolean canClear) { // TODO(dtrainor): Factor this out to LayoutDriver. if (e == null || mTabVisible == null) return;/*from www . ja va 2 s . c om*/ ContentViewCore contentViewCore = mTabVisible.getContentViewCore(); if (contentViewCore == null) return; int actionMasked = e.getActionMasked(); if (SPenSupport.isSPenSupported(getContext())) { actionMasked = SPenSupport.convertSPenEventAction(actionMasked); } if (actionMasked == MotionEvent.ACTION_DOWN || actionMasked == MotionEvent.ACTION_HOVER_ENTER) { if (mLayoutManager != null) mLayoutManager.getViewportPixel(mCacheViewport); contentViewCore.setCurrentTouchEventOffsets(-mCacheViewport.left, -mCacheViewport.top); } else if (canClear && (actionMasked == MotionEvent.ACTION_UP || actionMasked == MotionEvent.ACTION_CANCEL || actionMasked == MotionEvent.ACTION_HOVER_EXIT)) { contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f); } }
From source file:it.mb.whatshare.Utils.java
/** * Returns a string that represents the symbolic name of the specified * action such as "ACTION_DOWN", "ACTION_POINTER_DOWN(3)" or an equivalent * numeric constant such as "35" if unknown. By Google. * /*from ww w. ja v a2s . co m*/ * @param action * The action. * @return The symbolic name of the specified action. */ public static String actionToString(int action) { switch (action) { case MotionEvent.ACTION_DOWN: return "ACTION_DOWN"; case MotionEvent.ACTION_UP: return "ACTION_UP"; case MotionEvent.ACTION_CANCEL: return "ACTION_CANCEL"; case MotionEvent.ACTION_OUTSIDE: return "ACTION_OUTSIDE"; case MotionEvent.ACTION_MOVE: return "ACTION_MOVE"; case MotionEvent.ACTION_HOVER_MOVE: return "ACTION_HOVER_MOVE"; case MotionEvent.ACTION_SCROLL: return "ACTION_SCROLL"; case MotionEvent.ACTION_HOVER_ENTER: return "ACTION_HOVER_ENTER"; case MotionEvent.ACTION_HOVER_EXIT: return "ACTION_HOVER_EXIT"; } int index = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_POINTER_DOWN: return "ACTION_POINTER_DOWN(" + index + ")"; case MotionEvent.ACTION_POINTER_UP: return "ACTION_POINTER_UP(" + index + ")"; default: return Integer.toString(action); } }
From source file:com.hippo.widget.lockpattern.LockPatternView.java
@Override public boolean onHoverEvent(@NonNull MotionEvent event) { AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isTouchExplorationEnabled()) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_HOVER_ENTER: event.setAction(MotionEvent.ACTION_DOWN); break; case MotionEvent.ACTION_HOVER_MOVE: event.setAction(MotionEvent.ACTION_MOVE); break; case MotionEvent.ACTION_HOVER_EXIT: event.setAction(MotionEvent.ACTION_UP); break; }/*from w w w . j ava 2 s .c o m*/ onTouchEvent(event); event.setAction(action); } return super.onHoverEvent(event); }
From source file:com.android.screenspeak.contextmenu.RadialMenuView.java
@Override public boolean onTouchEvent(@NonNull MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_HOVER_ENTER: // Fall-through to movement events. onEnter(event.getX(), event.getY()); case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_HOVER_MOVE: onMove(event.getX(), event.getY()); break;//w w w . j a v a 2 s . c om case MotionEvent.ACTION_UP: case MotionEvent.ACTION_HOVER_EXIT: onUp(event.getX(), event.getY()); break; default: // Don't handle other types of events. return false; } mHandler.onTouch(this, event); return true; }
From source file:com.googlecode.eyesfree.widget.RadialMenuView.java
@Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_HOVER_ENTER: // Fall-through to movement events. onEnter(event.getX(), event.getY()); case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_HOVER_MOVE: onMove(event.getX(), event.getY()); break;/*from w w w.ja v a 2 s. c o m*/ case MotionEvent.ACTION_UP: case MotionEvent.ACTION_HOVER_EXIT: onUp(event.getX(), event.getY()); break; default: // Don't handle other types of events. return false; } mHandler.onTouch(this, event); return true; }
From source file:com.android.nobug.view.pattern.PatternView.java
@Override public boolean onHoverEvent(MotionEvent event) { if (mAccessibilityManager.isTouchExplorationEnabled()) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_HOVER_ENTER: event.setAction(MotionEvent.ACTION_DOWN); break; case MotionEvent.ACTION_HOVER_MOVE: event.setAction(MotionEvent.ACTION_MOVE); break; case MotionEvent.ACTION_HOVER_EXIT: event.setAction(MotionEvent.ACTION_UP); break; }//from w w w . j a v a 2s . co m onTouchEvent(event); event.setAction(action); } return super.onHoverEvent(event); }
From source file:io.authme.sdk.widget.LockPatternView.java
@Override public boolean onHoverEvent(MotionEvent event) { if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)) .isTouchExplorationEnabled()) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_HOVER_ENTER: event.setAction(MotionEvent.ACTION_DOWN); break; case MotionEvent.ACTION_HOVER_MOVE: event.setAction(MotionEvent.ACTION_MOVE); break; case MotionEvent.ACTION_HOVER_EXIT: event.setAction(MotionEvent.ACTION_UP); break; }//from w w w. jav a 2 s .c o m onTouchEvent(event); event.setAction(action); } return super.onHoverEvent(event); }
From source file:com.android.incallui.widget.multiwaveview.GlowPadView.java
@Override public boolean onHoverEvent(MotionEvent event) { final AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isTouchExplorationEnabled()) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_HOVER_ENTER: event.setAction(MotionEvent.ACTION_DOWN); break; case MotionEvent.ACTION_HOVER_MOVE: event.setAction(MotionEvent.ACTION_MOVE); break; case MotionEvent.ACTION_HOVER_EXIT: event.setAction(MotionEvent.ACTION_UP); break; }/*from w w w. j av a 2 s.com*/ onTouchEvent(event); event.setAction(action); } super.onHoverEvent(event); return true; }