當前位置: 首頁>>代碼示例>>Java>>正文


Java MotionEvent.ACTION_HOVER_MOVE屬性代碼示例

本文整理匯總了Java中android.view.MotionEvent.ACTION_HOVER_MOVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java MotionEvent.ACTION_HOVER_MOVE屬性的具體用法?Java MotionEvent.ACTION_HOVER_MOVE怎麽用?Java MotionEvent.ACTION_HOVER_MOVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.view.MotionEvent的用法示例。


在下文中一共展示了MotionEvent.ACTION_HOVER_MOVE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onHoverEvent

@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;
        }
        onTouchEvent(event);
        event.setAction(action);
    }
    super.onHoverEvent(event);
    return true;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:21,代碼來源:GlowPadView.java

示例2: onHoverEvent

@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;
        }
        onTouchEvent(event);
        event.setAction(action);
    }
    return super.onHoverEvent(event);
}
 
開發者ID:aritraroy,項目名稱:PatternLockView,代碼行數:21,代碼來源:PatternLockView.java

示例3: onHoverEvent

@SuppressLint("NewApi")
@Override
   public boolean onHoverEvent(MotionEvent event) {
       if (isEnabled()) {
           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;
           }
           onTouchEvent(event);
           event.setAction(action);
       }
       return super.onHoverEvent(event);
   }
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:21,代碼來源:LockPatternView.java

示例4: limitEventRate

public void limitEventRate(final MotionEvent event)
{
	// Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS
	// With Froyo the rate of touch events seems to be limited by OS, but they are arriving faster then we're redrawing anyway
	if((event.getAction() == MotionEvent.ACTION_MOVE ||
		event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
	{
		synchronized(mRenderer)
		{
			try
			{
				mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
			}
			catch (InterruptedException e)
			{
				Log.v("SDL", "DemoGLSurfaceView::limitEventRate(): Who dared to interrupt my slumber?");
				Thread.interrupted();
			}
		}
	}
}
 
開發者ID:NeoTerm,項目名稱:NeoTerm,代碼行數:21,代碼來源:Video.java

示例5: onGenericMotion

public boolean onGenericMotion(View v, MotionEvent event) {
    if(!isTVMenuDisplayed){
        if (DBG)
            Log.d(TAG, "onGenericMotion : event=" + event);
        if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.M&&event.getActionButton()==MotionEvent.BUTTON_PRIMARY) //
            return false;
        int action = event.getAction();

        if (action == MotionEvent.ACTION_HOVER_ENTER || action == MotionEvent.ACTION_HOVER_MOVE || action == MotionEvent.ACTION_HOVER_EXIT) {
            // Ignore events sent by the remote control when it is in pointer mode
            return false;
        }

        show(FLAG_SIDE_ALL_EXCEPT_UNLOCK_INSTRUCTIONS, 3000);

        return true;
    }
    return false;
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:19,代碼來源:PlayerController.java

示例6: onHoverEvent

@Override
public boolean onHoverEvent(MotionEvent event) {

    if (Build.VERSION.SDK_INT >= 11) {
        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;
            }
            onTouchEvent(event);
            event.setAction(action);
        }
    }
    return super.onHoverEvent(event);
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:24,代碼來源:LockPatternViewEx.java

示例7: onHoverEvent

/**
 * Receives hover events when touch exploration is turned on in SDK versions ICS and higher.
 *
 * @param event The hover event.
 * @return {@code true} if the event is handled.
 */
public boolean onHoverEvent(final MotionEvent event) {
    switch (event.getActionMasked()) {
    case MotionEvent.ACTION_HOVER_ENTER:
        onHoverEnter(event);
        break;
    case MotionEvent.ACTION_HOVER_MOVE:
        onHoverMove(event);
        break;
    case MotionEvent.ACTION_HOVER_EXIT:
        onHoverExit(event);
        break;
    default:
        Log.w(getClass().getSimpleName(), "Unknown hover event: " + event);
        break;
    }
    return true;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:23,代碼來源:KeyboardAccessibilityDelegate.java

示例8: getMotionEventString

public static String getMotionEventString(int action){
	switch(action){
		case(MotionEvent.ACTION_DOWN): return "action_down";
		case(MotionEvent.ACTION_UP): return "action_down";
		case(MotionEvent.ACTION_CANCEL): return "action_down";
		case(MotionEvent.ACTION_MOVE): return "action_move";
		case(MotionEvent.ACTION_OUTSIDE): return "action_outside";
		case(MotionEvent.ACTION_HOVER_ENTER): return "action_hover_enter";
		case(MotionEvent.ACTION_HOVER_EXIT): return "action_hover_exit";
		case(MotionEvent.ACTION_HOVER_MOVE): return "action_hover_move";
		case(MotionEvent.ACTION_MASK): return "action_mask";
	}
	return "unknown action event";
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:TouchDebugUtils.java

示例9: onGenericMotion

@Override
public boolean onGenericMotion(View v, MotionEvent event) {
    float x, y;
    int action;

    switch ( event.getSource() ) {
        case InputDevice.SOURCE_JOYSTICK:
        case InputDevice.SOURCE_GAMEPAD:
        case InputDevice.SOURCE_DPAD:
            return SDLActivity.handleJoystickMotionEvent(event);

        case InputDevice.SOURCE_MOUSE:
            action = event.getActionMasked();
            switch (action) {
                case MotionEvent.ACTION_SCROLL:
                    x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0);
                    y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0);
                    SDLActivity.onNativeMouse(0, action, x, y);
                    return true;

                case MotionEvent.ACTION_HOVER_MOVE:
                    x = event.getX(0);
                    y = event.getY(0);

                    SDLActivity.onNativeMouse(0, action, x, y);
                    return true;

                default:
                    break;
            }
            break;

        default:
            break;
    }

    // Event was not managed
    return false;
}
 
開發者ID:jomof,項目名稱:cdep-android-studio-freetype-sample,代碼行數:39,代碼來源:SDLActivity.java

示例10: actionToString

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";
        case MotionEvent.ACTION_BUTTON_PRESS:
            return "ACTION_BUTTON_PRESS";
        case MotionEvent.ACTION_BUTTON_RELEASE:
            return "ACTION_BUTTON_RELEASE";
    }
    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);
    }
}
 
開發者ID:HanyeeWang,項目名稱:GeekZone,代碼行數:35,代碼來源:ViewUtils.java

示例11: onInterceptHoverEvent

@Override
public boolean onInterceptHoverEvent(MotionEvent ev) {
    if (mLauncher == null || mLauncher.getWorkspace() == null) {
        return false;
    }
    Folder currentFolder = Folder.getOpen(mLauncher);
    if (currentFolder == null) {
        return false;
    } else {
            AccessibilityManager accessibilityManager = (AccessibilityManager)
                    getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
        if (accessibilityManager.isTouchExplorationEnabled()) {
            final int action = ev.getAction();
            boolean isOverFolderOrSearchBar;
            switch (action) {
                case MotionEvent.ACTION_HOVER_ENTER:
                    isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) ||
                        (isInAccessibleDrag() && isEventOverDropTargetBar(ev));
                    if (!isOverFolderOrSearchBar) {
                        sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
                        mHoverPointClosesFolder = true;
                        return true;
                    }
                    mHoverPointClosesFolder = false;
                    break;
                case MotionEvent.ACTION_HOVER_MOVE:
                    isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) ||
                        (isInAccessibleDrag() && isEventOverDropTargetBar(ev));
                    if (!isOverFolderOrSearchBar && !mHoverPointClosesFolder) {
                        sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
                        mHoverPointClosesFolder = true;
                        return true;
                    } else if (!isOverFolderOrSearchBar) {
                        return true;
                    }
                    mHoverPointClosesFolder = false;
            }
        }
    }
    return false;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:41,代碼來源:DragLayer.java

示例12: processGenericEvent

public void processGenericEvent(final MotionEvent event)
{
	if( (event.getAction() & MotionEvent.ACTION_MASK) != MotionEvent.ACTION_HOVER_MOVE &&
		(event.getAction() & MotionEvent.ACTION_MASK) != MotionEvent.ACTION_HOVER_EXIT ) // Ignore hover events, they are broken
		super.processGenericEvent(event);
}
 
開發者ID:NeoTerm,項目名稱:NeoTerm,代碼行數:6,代碼來源:Video.java

示例13: dispatchHoverEvent

@Override
protected boolean dispatchHoverEvent(MotionEvent event) {
    AccessibilityManager accessibilityManager =
            (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);

    if (accessibilityManager.isEnabled()) {
        final int eventY = (int) event.getY();
        final int hoveredVirtualViewId;
        if (eventY < mTopSelectionDividerTop) {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_DECREMENT;
        } else if (eventY > mBottomSelectionDividerBottom) {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INCREMENT;
        } else {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INPUT;
        }
        final int action = event.getActionMasked();
        AccessibilityNodeProviderImpl provider = (AccessibilityNodeProviderImpl) getAccessibilityNodeProviderCompat();
        switch (action) {
            case MotionEvent.ACTION_HOVER_ENTER: {
                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                        AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
                mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
                provider.performAction(hoveredVirtualViewId,
                        AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
            }
            break;
            case MotionEvent.ACTION_HOVER_MOVE: {
                if (mLastHoveredChildVirtualViewId != hoveredVirtualViewId
                        && mLastHoveredChildVirtualViewId != View.NO_ID) {
                    provider.sendAccessibilityEventForVirtualView(
                            mLastHoveredChildVirtualViewId,
                            AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
                    provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                            AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
                    mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
                    provider.performAction(hoveredVirtualViewId,
                            AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
                }
            }
            break;
            case MotionEvent.ACTION_HOVER_EXIT: {
                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                        AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
                mLastHoveredChildVirtualViewId = View.NO_ID;
            }
            break;
        }
    }
    return false;
}
 
開發者ID:h6ah4i,項目名稱:android-numberpickercompat,代碼行數:50,代碼來源:NumberPicker.java

示例14: dispatchHoverEvent

@Override
protected boolean dispatchHoverEvent(MotionEvent event) {
    if (!mHasSelectorWheel) {
        return super.dispatchHoverEvent(event);
    }

    if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled()) {
        final int eventY = (int) event.getY();
        final int hoveredVirtualViewId;
        if (eventY < mTopSelectionDividerTop) {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_DECREMENT;
        } else if (eventY > mBottomSelectionDividerBottom) {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INCREMENT;
        } else {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INPUT;
        }
        final int action = event.getAction() & MotionEvent.ACTION_MASK;
        SupportAccessibilityNodeProvider provider = getSupportAccessibilityNodeProvider();

        switch (action) {
            case MotionEvent.ACTION_HOVER_ENTER: {
                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                        AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
                mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
                provider.performAction(hoveredVirtualViewId,
                        AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
            } break;
            case MotionEvent.ACTION_HOVER_MOVE: {
                if (mLastHoveredChildVirtualViewId != hoveredVirtualViewId
                        && mLastHoveredChildVirtualViewId != View.NO_ID) {
                    provider.sendAccessibilityEventForVirtualView(
                            mLastHoveredChildVirtualViewId,
                            AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
                    provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                            AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
                    mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
                    provider.performAction(hoveredVirtualViewId,
                            AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
                }
            } break;
            case MotionEvent.ACTION_HOVER_EXIT: {
                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                        AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
                mLastHoveredChildVirtualViewId = View.NO_ID;
            } break;
        }
    }
    return false;
}
 
開發者ID:helenepang,項目名稱:LimitedDatePicker,代碼行數:49,代碼來源:NumberPicker.java

示例15: onResolvePointerIcon

/**
 * Adds support for different mouse pointer icons depending on document state and mouse position
 */
@Override
public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
    int icon = PointerIcon.TYPE_DEFAULT;
    Layer l = mCurrentLayer;
    float x = event.getX() - getViewportX();
    float y = event.getY() - getViewportY();

    if (mMode == MODE_LAYER_DRAG || mMode == MODE_LAYER_PRE_DRAG) {
        icon = PointerIcon.TYPE_GRABBING;
    } else {
        if (l != null) {
            if (inPointTouchRadius(x, y, l.getTopLeft())
                    || inPointTouchRadius(x, y, l.getBottomRight())) {
                icon = PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW;
            } else if (inPointTouchRadius(x, y, l.getTopRight())
                    || inPointTouchRadius(x, y, l.getBottomLeft())) {
                icon = PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW;
            } else if (inPointTouchRadius(x, y, l.getMidTop())
                    || inPointTouchRadius(x, y, l.getMidBottom())) {
                icon = PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
            } else if (inPointTouchRadius(x, y, l.getMidLeft())
                    || inPointTouchRadius(x, y, l.getMidRight())) {
                icon = PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW;
            } else if (l.inBounds(x, y)) {
                switch (event.getActionMasked()) {
                    case MotionEvent.ACTION_DOWN:
                    case MotionEvent.ACTION_MOVE:
                        // Only change to hand if this is a primary button click
                        if (event.getActionButton() == MotionEvent.BUTTON_PRIMARY) {
                            icon = PointerIcon.TYPE_GRABBING;
                        } else {
                            icon = PointerIcon.TYPE_DEFAULT;
                        }
                        break;
                    case MotionEvent.ACTION_HOVER_MOVE:
                        icon = PointerIcon.TYPE_GRAB;
                        break;
                    case MotionEvent.ACTION_UP:
                    default:
                        if (event.getActionButton() == MotionEvent.BUTTON_PRIMARY) {
                            icon = PointerIcon.TYPE_GRAB;
                        } else {
                            icon = PointerIcon.TYPE_DEFAULT;
                        }
                }
            }
        }
    }
    return PointerIcon.getSystemIcon(getContext(), icon);
}
 
開發者ID:google,項目名稱:spline,代碼行數:53,代碼來源:DocumentView.java


注:本文中的android.view.MotionEvent.ACTION_HOVER_MOVE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。