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


Java MotionEvent.ACTION_HOVER_ENTER屬性代碼示例

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


在下文中一共展示了MotionEvent.ACTION_HOVER_ENTER屬性的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: setContentViewMotionEventOffsets

private void setContentViewMotionEventOffsets(MotionEvent e, boolean canClear) {
    // TODO(dtrainor): Factor this out to LayoutDriver.
    if (e == null || mTabVisible == null) return;

    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);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:23,代碼來源:CompositorViewHolder.java

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

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

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

示例10: onHoverEvent

@Override
public boolean onHoverEvent(MotionEvent event) {
    try {
        if (Common.isTouchToExploreEnabled()) {
            if (event.getActionMasked() == MotionEvent.ACTION_HOVER_ENTER) {
                clickTime = System.currentTimeMillis();
            }
            //This is double tap
            if (event.getActionMasked() == MotionEvent.ACTION_HOVER_ENTER && Math.abs(xPosition - event.getX()) < 20 && Math.abs(yPosition - event.getY()) < 20 && firstTap && clickTime - lastClickTime < 1000) {
                lastClickTime = 0;
                firstTap = false;
                gestureDoubleTap.onDoubleTap(event);
                return false;
            } //This is long single tap
            else if (event.getActionMasked() == MotionEvent.ACTION_HOVER_EXIT) {
                firstTap = true;
                lastClickTime = clickTime;
                xPosition = event.getX();
                yPosition = event.getY();
            }
            return onTouchEvent(event);
        } else {
            return super.onHoverEvent(event);
        }
    } catch (Exception e) {
        e.printStackTrace();
        return super.onHoverEvent(event);
    }
}
 
開發者ID:MohammadAlBanna,項目名稱:Swift-Braille-Soft-keyboard,代碼行數:29,代碼來源:KeyboardSurface.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: onInterceptHoverEvent

@Override
public boolean onInterceptHoverEvent(MotionEvent ev) {
    if (mLauncher == null || mLauncher.getWorkspace() == null) {
        return false;
    }
    Folder currentFolder = mLauncher.getWorkspace().getOpenFolder();
    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:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:41,代碼來源:DragLayer.java

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

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

@Override
public boolean onHoverEvent(MotionEvent event) {
  // When touch exploration is turned on, lifting a finger while inside
  // the button's hover target bounds should perform a click action.
  if (mAccessibilityManager.isEnabled() && mAccessibilityManager.isTouchExplorationEnabled()) {
    switch (event.getActionMasked()) {
      case MotionEvent.ACTION_HOVER_ENTER:
        // Lift-to-type temporarily disables double-tap activation.
        mWasClickable = isClickable();
        mWasLongClickable = isLongClickable();
        if (mWasLongClickable && mLongHoverContentDesc != null) {
          if (mLongHoverRunnable == null) {
            mLongHoverRunnable =
                new Runnable() {
                  @Override
                  public void run() {
                    setLongHovered(true);
                    announceForAccessibility(mLongHoverContentDesc);
                  }
                };
          }
          postDelayed(mLongHoverRunnable, LONG_HOVER_TIMEOUT);
        }

        setClickable(false);
        setLongClickable(false);
        break;
      case MotionEvent.ACTION_HOVER_EXIT:
        if (mHoverBounds.contains(event.getX(), event.getY())) {
          if (mLongHovered) {
            performLongClick();
          } else {
            simulateClickForAccessibility();
          }
        }

        cancelLongHover();
        setClickable(mWasClickable);
        setLongClickable(mWasLongClickable);
        break;
    }
  }

  return super.onHoverEvent(event);
}
 
開發者ID:dialogs,項目名稱:android-dialer,代碼行數:45,代碼來源:DialpadKeyButton.java


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