MotionEvent obtainNoHistory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MotionEvent obtainNoHistory method.

This code example shows how to use the following methods:getAction, getActionIndex, getActionMasked, getX, obtainNoHistory
    } 
 
    @Override 
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (mWallpaperConnection != null && mWallpaperConnection.mEngine != null) {
            MotionEvent dup = MotionEvent.obtainNoHistory(ev);
            try { 
                mWallpaperConnection.mEngine.dispatchPointer(dup);
            } catch (RemoteException e) {
            } 
        } 
         
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            onUserInteraction();
        } 
        boolean handled = getWindow().superDispatchTouchEvent(ev);
        if (!handled) {
            handled = onTouchEvent(ev);
        } 
 

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY, obtainNoHistory
                } 
 
                private boolean handleTapOrPress(MotionEvent e, boolean isLongPress) {
                    if (mAnimating) return true;
 
                    float x = e.getX();
                    float y = e.getY();
                    if (isTouchOutsideArea(x, y)) {
                        // User clicked on area outside the popup. 
                        hide(true); 
                    } else if (mOnTapListener != null) {
                        PointF converted = convertTouchPoint(x, y);
                        MotionEvent event = MotionEvent.obtainNoHistory(e);
                        event.setLocation(converted.x, converted.y);
                        if (isLongPress) {
                            mOnTapListener.onLongPress(PopupZoomer.this, event);
                        } else { 
                            mOnTapListener.onSingleTap(PopupZoomer.this, event);
                        } 
                        hide(true); 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
obtainNoHistory Method Overview
Create a new MotionEvent, copying from an existing one, but not including any historical point information.
See Code Examples for other Android MotionEvent Methods: