当前位置: 首页>>代码示例>>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;未经允许,请勿转载。