当前位置: 首页>>代码示例>>Java>>正文


Java MotionEvent.ACTION_HOVER_EXIT属性代码示例

本文整理汇总了Java中android.view.MotionEvent.ACTION_HOVER_EXIT属性的典型用法代码示例。如果您正苦于以下问题:Java MotionEvent.ACTION_HOVER_EXIT属性的具体用法?Java MotionEvent.ACTION_HOVER_EXIT怎么用?Java MotionEvent.ACTION_HOVER_EXIT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.MotionEvent的用法示例。


在下文中一共展示了MotionEvent.ACTION_HOVER_EXIT属性的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: getMotionOffsets

private Point getMotionOffsets(MotionEvent e) {
    int actionMasked = e.getActionMasked();
    if (SPenSupport.isSPenSupported(mHost.getContext())) {
        actionMasked = SPenSupport.convertSPenEventAction(actionMasked);
    }

    if (actionMasked == MotionEvent.ACTION_DOWN
            || actionMasked == MotionEvent.ACTION_HOVER_ENTER) {
        getViewportPixel(mCachedRect);

        mCachedPoint.set(-mCachedRect.left, -mCachedRect.top);
        return mCachedPoint;
    } else if (actionMasked == MotionEvent.ACTION_UP
            || actionMasked == MotionEvent.ACTION_CANCEL
            || actionMasked == MotionEvent.ACTION_HOVER_EXIT) {
        mCachedPoint.set(0, 0);
        return mCachedPoint;
    }

    return null;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:LayoutManager.java

示例4: 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

示例5: onHover

@Override
public boolean onHover(View v, MotionEvent event) {
    if (mPopup != null && mFromTouch) {
        return false;
    }
    AccessibilityManager manager = (AccessibilityManager)
            mAnchor.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (manager.isEnabled() && manager.isTouchExplorationEnabled()) {
        return false;
    }
    switch (event.getAction()) {
        case MotionEvent.ACTION_HOVER_MOVE:
            if (mAnchor.isEnabled() && mPopup == null) {
                mAnchorX = (int) event.getX();
                mAnchorY = (int) event.getY();
                setPendingHandler(this);
            }
            break;
        case MotionEvent.ACTION_HOVER_EXIT:
            hide();
            break;
    }

    return false;
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:25,代码来源:TooltipCompatHandler.java

示例6: 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

示例7: 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

示例8: processGenericEvent

public void processGenericEvent(final MotionEvent event)
{
	super.processGenericEvent(event);
	if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_MOVE ||
		(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_ENTER ||
		(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_EXIT )
	{
		hover = true;
		hoverX = event.getX();
		hoverY = event.getY();
		hoverTime = System.currentTimeMillis();
		if( ExternalMouseDetected == 0 && (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_MOVE )
			fingerHover = true;
		if( tap && System.currentTimeMillis() < tapTime + 1000 )
		{
			tap = false;
			hoverTouchDistance += Math.abs(tapX - hoverX) + Math.abs(tapY - hoverY);
			Log.i("SDL", "Hover hoverX " + hoverX + " tapX " + tapX + " hoverY " + hoverX + " tapY " + tapY + " hoverTouchDistance " + hoverTouchDistance);
		}
	}
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:21,代码来源:Video.java

示例9: 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

示例10: 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

示例11: 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

示例12: 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:SavorGit,项目名称:Hotspot-master-devp,代码行数:49,代码来源:NumberPicker.java

示例13: onTouch

@Override
        public boolean onTouch(View v, MotionEvent event) {
            rootDisplay = mWindowManager.getDefaultDisplay();
            Point size = new Point();
            rootDisplay.getSize(size);
            int width = size.x;
            int height = size.y;

            rootRelativeLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
//                    closeImageView.setVisibility(View.VISIBLE);
                    //remember the initial position.
                    initialX = params.x;
                    initialY = params.y;

                    //get the touch location
                    initialTouchX = event.getRawX();
                    initialTouchY = event.getRawY();
                    return true;
                case MotionEvent.ACTION_UP:
//                    closeImageView.setVisibility(View.VISIBLE);
                    int Xdiff = (int) (event.getRawX() - initialTouchX);
                    int Ydiff = (int) (event.getRawY() - initialTouchY);


                    //The check for Xdiff <10 && YDiff< 10 because sometime elements moves a little while clicking.
                    //So that is click event.
                    if (Xdiff < 10 && Ydiff < 10) {
                        if (isViewCollapsed()) {
                            //When user clicks on the image view of the collapsed layout,
                            //visibility of the collapsed layout will be changed to "View.GONE"
                            //and expanded view will become visible.
                            floatingButton.setVisibility(View.GONE);
                            expandedButton.setVisibility(View.VISIBLE);
                            expandedLayout.setVisibility(View.VISIBLE);
                        }
                    }
                    return true;
                case MotionEvent.ACTION_MOVE:
//                    closeImageView.setVisibility(View.VISIBLE);
                    //Calculate the X and Y coordinates of the view.
                    params.x = initialX + (int) (event.getRawX() - initialTouchX);
                    params.y = initialY + (int) (event.getRawY() - initialTouchY);
                    //Update the layout with new X & Y coordinate
                    mWindowManager.updateViewLayout(mFloatingView, params);
                    return true;

                case MotionEvent.ACTION_HOVER_EXIT:
                    closeImageView.setVisibility(View.GONE);
//                    rootRelativeLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
//                            ViewGroup.LayoutParams.WRAP_CONTENT));
                    return true;

            }
            return false;
        }
 
开发者ID:Lekky71,项目名称:WhatsAppStatusSaver,代码行数:58,代码来源:FloatingButtonService.java

示例14: 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

示例15: process

public void process(final MotionEvent event)
{
	int hwMouseEvent =  ((event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE || Globals.ForceHardwareMouse) ? Mouse.MOUSE_HW_INPUT_MOUSE :
						((event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS) ? Mouse.MOUSE_HW_INPUT_STYLUS :
						Mouse.MOUSE_HW_INPUT_FINGER;
	if( ExternalMouseDetected != hwMouseEvent )
	{
		ExternalMouseDetected = hwMouseEvent;
		DemoGLSurfaceView.nativeHardwareMouseDetected(hwMouseEvent);
	}
	super.process(event);
	if( !Globals.FingerHover && ExternalMouseDetected == Mouse.MOUSE_HW_INPUT_FINGER )
		return; // Finger hover disabled in settings
	if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_MOVE ) // Support bluetooth/USB mouse - available since Android 3.1
	{
		int action;
		// TODO: it is possible that multiple pointers return that event, but we're handling only pointer #0
		if( touchEvents[0].down )
			action = Mouse.SDL_FINGER_UP;
		else
			action = Mouse.SDL_FINGER_HOVER;
		touchEvents[0].down = false;
		touchEvents[0].x = (int)event.getX();
		touchEvents[0].y = (int)event.getY();
		touchEvents[0].pressure = Mouse.MAX_HOVER_DISTANCE;
		touchEvents[0].size = 0;
		//if( event.getAxisValue(MotionEvent.AXIS_DISTANCE) != 0.0f )
		InputDevice device = InputDevice.getDevice(event.getDeviceId());
		if( device != null && device.getMotionRange(MotionEvent.AXIS_DISTANCE) != null &&
			device.getMotionRange(MotionEvent.AXIS_DISTANCE).getRange() > 0.0f )
			touchEvents[0].pressure = (int)((event.getAxisValue(MotionEvent.AXIS_DISTANCE) -
					device.getMotionRange(MotionEvent.AXIS_DISTANCE).getMin()) * Mouse.MAX_PRESSURE / device.getMotionRange(MotionEvent.AXIS_DISTANCE).getRange());
		DemoGLSurfaceView.nativeMotionEvent( touchEvents[0].x, touchEvents[0].y, action, 0, touchEvents[0].pressure, touchEvents[0].size );
	}
	if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_EXIT ) // Update screen for finger hover
	{
		touchEvents[0].pressure = Mouse.HOVER_REDRAW_SCREEN;
		touchEvents[0].size = 0;
		DemoGLSurfaceView.nativeMotionEvent( touchEvents[0].x, touchEvents[0].y, Mouse.SDL_FINGER_HOVER, 0, touchEvents[0].pressure, touchEvents[0].size );
	}
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:41,代码来源:Video.java


注:本文中的android.view.MotionEvent.ACTION_HOVER_EXIT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。