Java Code Examples for android.view.MotionEvent#getPointerCount()
The following examples show how to use
android.view.MotionEvent#getPointerCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraTextureView.java From CameraDemo with Apache License 2.0 | 6 votes |
@Override public boolean onTouchEvent(MotionEvent event) { if (event.getPointerCount() == 1) { // 点击聚焦 mCameraProxy.focusOnPoint((int) event.getX(), (int) event.getY(), getWidth(), getHeight()); return true; } switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_POINTER_DOWN: mOldDistance = getFingerSpacing(event); break; case MotionEvent.ACTION_MOVE: float newDistance = getFingerSpacing(event); if (newDistance > mOldDistance) { mCameraProxy.handleZoom(true); } else if (newDistance < mOldDistance) { mCameraProxy.handleZoom(false); } mOldDistance = newDistance; break; default: break; } return super.onTouchEvent(event); }
Example 2
Source File: Utils.java From Stayfit with Apache License 2.0 | 6 votes |
public static void velocityTrackerPointerUpCleanUpIfNecessary(MotionEvent ev, VelocityTracker tracker) { // Check the dot product of current velocities. // If the pointer that left was opposing another velocity vector, clear. tracker.computeCurrentVelocity(1000, mMaximumFlingVelocity); final int upIndex = ev.getActionIndex(); final int id1 = ev.getPointerId(upIndex); final float x1 = tracker.getXVelocity(id1); final float y1 = tracker.getYVelocity(id1); for (int i = 0, count = ev.getPointerCount(); i < count; i++) { if (i == upIndex) continue; final int id2 = ev.getPointerId(i); final float x = x1 * tracker.getXVelocity(id2); final float y = y1 * tracker.getYVelocity(id2); final float dot = x + y; if (dot < 0) { tracker.clear(); break; } } }
Example 3
Source File: MapView.java From android_maplibui with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean onScroll( MotionEvent event1, MotionEvent event2, float distanceX, float distanceY) { if (event2.getPointerCount() > 1) { return false; } //Log.d(TAG, "onScroll: " + event1.toString() + ", " + event2.toString() + ", " // + distanceX + ", " + distanceY); panStart(event1); panMoveTo(event2); return true; }
Example 4
Source File: GOSurfaceView.java From settlers-remake with MIT License | 6 votes |
public void onTouchEvent(MotionEvent e) { scaleGestureDetector.onTouchEvent(e); gestureDetector.onTouchEvent(e); longPressDetector.onTouchEvent(e); if (e.getAction() == MotionEvent.ACTION_UP) { if (drawStarted()) { endDraw(currentPoint(e)); } if (panStarted()) { endPan(relativePanPoint(e)); } } if (e.getPointerCount() > 1) { if (drawStarted()) { abortDraw(); } if (panStarted()) { endPan(relativePanPoint(e)); } } }
Example 5
Source File: PZSImageView.java From zom-android-matrix with Apache License 2.0 | 5 votes |
/** * check user double tapped this view.. or not. * @param ev current motion event in a @{link MotionEvent} * @return {@code true} if user double tapped this view. */ protected boolean isDoubleTap(MotionEvent ev){ //if old pointer is tapped? if( ev.getPointerCount() > 1){ //if there are more than one pointer... reset mLastTocuhDownTime = 0; return false; } long downTime = ev.getDownTime(); long diff = downTime - mLastTocuhDownTime; mLastTocuhDownTime = downTime; return diff < DOUBLE_TAP_MARGIN_TIME; }
Example 6
Source File: TwoFingerGestureDetector.java From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * MotionEvent has no getRawY(int) method; simulate it pending future API approval. * @param event * @param pointerIndex * @return */ protected static float getRawY(MotionEvent event, int pointerIndex) { float offset = event.getY() - event.getRawY(); if (pointerIndex < event.getPointerCount()) { return event.getY(pointerIndex) + offset; } return 0f; }
Example 7
Source File: LineScrollAndScaleView.java From kAndroid with Apache License 2.0 | 5 votes |
@Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: touch = true; break; case MotionEvent.ACTION_MOVE: if (event.getPointerCount() == 1) { //长按之后移动 if (isLongPress || !isClosePress) { onLongPress(event); } } break; case MotionEvent.ACTION_POINTER_UP: invalidate(); break; case MotionEvent.ACTION_UP: if (!isClosePress) { isLongPress = false; } touch = false; invalidate(); break; case MotionEvent.ACTION_CANCEL: if (!isClosePress) { isLongPress = false; } touch = false; invalidate(); break; } mMultipleTouch = event.getPointerCount() > 1; this.mDetector.onTouchEvent(event); this.mScaleDetector.onTouchEvent(event); return true; }
Example 8
Source File: PhotoFilterBlurControl.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private float getDistance(MotionEvent event) { if (event.getPointerCount() != 2) { return 0; } float x1 = event.getX(0); float y1 = event.getY(0); float x2 = event.getX(1); float y2 = event.getY(1); return (float) Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
Example 9
Source File: StickerView.java From StickerView with MIT License | 5 votes |
/** * 计算双指之间的距离 */ private float spacing(MotionEvent event) { if (event.getPointerCount() == 2) { float x = event.getX(0) - event.getX(1); float y = event.getY(0) - event.getY(1); return (float) Math.sqrt(x * x + y * y); } else { return 0; } }
Example 10
Source File: GestureControllerForPager.java From GestureViews with Apache License 2.0 | 5 votes |
private void handleTouch(MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_POINTER_DOWN: if (event.getPointerCount() == 2) { // on first non-primary pointer // Skipping ViewPager fake dragging if we're not started dragging yet // to allow scale/rotation gestures isSkipViewPager = !hasViewPagerX(); } break; default: } }
Example 11
Source File: NXTRemoteControl.java From nxt-remote-control with Apache License 2.0 | 5 votes |
@Override public boolean onTouch(View v, MotionEvent event) { TankView tv = (TankView) v; float y; int action = event.getAction(); if ((action == MotionEvent.ACTION_DOWN) || (action == MotionEvent.ACTION_MOVE)) { byte l = 0; byte r = 0; for (int i = 0; i < event.getPointerCount(); i++) { y = -1.0f*(event.getY(i)-tv.mZero)/tv.mRange; if (y > 1.0f) { y = 1.0f; } if (y < -1.0f) { y = -1.0f; } if (event.getX(i) < tv.mWidth/2f) { l = (byte) (y * 100); } else { r = (byte) (y * 100); } } if (mReverse) { l *= -1; r *= -1; } if (!mReverseLR) { mNXTTalker.motors(l, r, mRegulateSpeed, mSynchronizeMotors); } else { mNXTTalker.motors(r, l, mRegulateSpeed, mSynchronizeMotors); } } else if ((action == MotionEvent.ACTION_UP) || (action == MotionEvent.ACTION_CANCEL)) { mNXTTalker.motors((byte) 0, (byte) 0, mRegulateSpeed, mSynchronizeMotors); } return true; }
Example 12
Source File: MultiTouchZoomableImageView.java From NIM_Android_UIKit with MIT License | 5 votes |
@Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { try { // Skip if there are multiple points of contact if ((e1 != null && e1.getPointerCount() > 1) || (e2 != null && e2.getPointerCount() > 1) || (mScaleDetector != null && mScaleDetector.isInProgress())) return false; // Scroll the bitmap if (transIgnoreScale || getScale() > zoomDefault()) { stopFling(); postTranslate(-distanceX, -distanceY); if (isScrollOver(distanceX)) { if (mViewPager != null) { mViewPager.requestDisallowInterceptTouchEvent(false); } } else { if (mViewPager != null) { mViewPager.requestDisallowInterceptTouchEvent(true); } } center(true, true, false); } else { if (mViewPager != null) { mViewPager.requestDisallowInterceptTouchEvent(false); } } } catch (IllegalArgumentException e) { e.printStackTrace(); } // Default case return true; }
Example 13
Source File: GestureCropImageView.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * If it's ACTION_DOWN event - user touches the screen and all current animation must be canceled. * If it's ACTION_UP event - user removed all fingers from the screen and current image position must be corrected. * If there are more than 2 fingers - update focal point coordinates. * Pass the event to the gesture detectors if those are enabled. */ @Override public boolean onTouchEvent(MotionEvent event) { if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) { cancelAllAnimations(); } if (event.getPointerCount() > 1) { mMidPntX = (event.getX(0) + event.getX(1)) / 2; mMidPntY = (event.getY(0) + event.getY(1)) / 2; } mGestureDetector.onTouchEvent(event); if (mIsScaleEnabled) { mScaleDetector.onTouchEvent(event); } if (mIsRotateEnabled) { mRotateDetector.onTouchEvent(event); } if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) { setImageToWrapCropBounds(); } return true; }
Example 14
Source File: MultiTouchHandler.java From Alite with GNU General Public License v3.0 | 4 votes |
@Override public boolean onTouch(View v, MotionEvent event) { if (freeze != -1 && (System.currentTimeMillis() - freeze) < delay) { return true; } freeze = -1; synchronized (this) { if (currentView != v) { return false; } scaleDetector.onTouchEvent(event); sweepDetector.onTouchEvent(event); int action = event.getAction() & MotionEvent.ACTION_MASK; int pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; int pointerCount = event.getPointerCount(); TouchEvent touchEvent; for (int i = 0; i < MAX_TOUCHPOINTS; i++) { if (i >= pointerCount) { isTouched[i] = false; id[i] = -1; continue; } int pointerId = event.getPointerId(i); if (event.getAction() != MotionEvent.ACTION_MOVE && i != pointerIndex) { continue; } switch (action) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_POINTER_DOWN: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_DOWN; touchEvent.pointer = pointerId; touchEvent.x = touchX[i] = (int) ((event.getX(i) - offsetX) * scaleX); touchEvent.y = touchY[i] = (int) ((event.getY(i) - offsetY) * scaleY); isTouched[i] = true; id[i] = pointerId; touchEventsBuffer.add(touchEvent); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_CANCEL: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_UP; touchEvent.pointer = pointerId; touchEvent.x = touchX[i] = (int) ((event.getX(i) - offsetX) * scaleX); touchEvent.y = touchY[i] = (int) ((event.getY(i) - offsetY) * scaleY); isTouched[i] = false; id[i] = -1; touchEventsBuffer.add(touchEvent); break; case MotionEvent.ACTION_MOVE: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_DRAGGED; touchEvent.pointer = pointerId; touchEvent.x = touchX[i] = (int) ((event.getX(i) - offsetX) * scaleX); touchEvent.y = touchY[i] = (int) ((event.getY(i) - offsetY) * scaleY); isTouched[i] = true; id[i] = pointerId; touchEventsBuffer.add(touchEvent); break; } } return true; } }
Example 15
Source File: RangeSeekBarView.java From Android-Video-Trimmer with Apache License 2.0 | 4 votes |
@Override public boolean onTouchEvent(MotionEvent event) { if (isTouchDown) { return super.onTouchEvent(event); } if (event.getPointerCount() > 1) { return super.onTouchEvent(event); } if (!isEnabled()) return false; if (absoluteMaxValuePrim <= mMinShootTime) { return super.onTouchEvent(event); } int pointerIndex;// 记录点击点的index final int action = event.getAction(); switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: //记住最后一个手指点击屏幕的点的坐标x,mDownMotionX mActivePointerId = event.getPointerId(event.getPointerCount() - 1); pointerIndex = event.findPointerIndex(mActivePointerId); mDownMotionX = event.getX(pointerIndex); // 判断touch到的是最大值thumb还是最小值thumb pressedThumb = evalPressedThumb(mDownMotionX); if (pressedThumb == null) return super.onTouchEvent(event); setPressed(true);// 设置该控件被按下了 onStartTrackingTouch();// 置mIsDragging为true,开始追踪touch事件 trackTouchEvent(event); attemptClaimDrag(); if (mRangeSeekBarChangeListener != null) { mRangeSeekBarChangeListener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue(), MotionEvent.ACTION_DOWN, isMin, pressedThumb); } break; case MotionEvent.ACTION_MOVE: if (pressedThumb != null) { if (mIsDragging) { trackTouchEvent(event); } else { // Scroll to follow the motion event pointerIndex = event.findPointerIndex(mActivePointerId); final float x = event.getX(pointerIndex);// 手指在控件上点的X坐标 // 手指没有点在最大最小值上,并且在控件上有滑动事件 if (Math.abs(x - mDownMotionX) > mScaledTouchSlop) { setPressed(true); Log.e(TAG, "没有拖住最大最小值");// 一直不会执行? invalidate(); onStartTrackingTouch(); trackTouchEvent(event); attemptClaimDrag(); } } if (notifyWhileDragging && mRangeSeekBarChangeListener != null) { mRangeSeekBarChangeListener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue(), MotionEvent.ACTION_MOVE, isMin, pressedThumb); } } break; case MotionEvent.ACTION_UP: if (mIsDragging) { trackTouchEvent(event); onStopTrackingTouch(); setPressed(false); } else { onStartTrackingTouch(); trackTouchEvent(event); onStopTrackingTouch(); } invalidate(); if (mRangeSeekBarChangeListener != null) { mRangeSeekBarChangeListener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue(), MotionEvent.ACTION_UP, isMin, pressedThumb); } pressedThumb = null;// 手指抬起,则置被touch到的thumb为空 break; case MotionEvent.ACTION_POINTER_DOWN: final int index = event.getPointerCount() - 1; // final int index = ev.getActionIndex(); mDownMotionX = event.getX(index); mActivePointerId = event.getPointerId(index); invalidate(); break; case MotionEvent.ACTION_POINTER_UP: onSecondaryPointerUp(event); invalidate(); break; case MotionEvent.ACTION_CANCEL: if (mIsDragging) { onStopTrackingTouch(); setPressed(false); } invalidate(); // see above explanation break; default: break; } return true; }
Example 16
Source File: OverlayView.java From PictureSelector with Apache License 2.0 | 4 votes |
@Override public boolean onTouchEvent(MotionEvent event) { if (mCropViewRect.isEmpty() || mFreestyleCropMode == FREESTYLE_CROP_MODE_DISABLE) { return false; } float x = event.getX(); float y = event.getY(); if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) { mCurrentTouchCornerIndex = getCurrentTouchIndex(x, y); boolean shouldHandle = mCurrentTouchCornerIndex != -1; if (!shouldHandle) { mPreviousTouchX = -1; mPreviousTouchY = -1; } else if (mPreviousTouchX < 0) { mPreviousTouchX = x; mPreviousTouchY = y; } return shouldHandle; } if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_MOVE) { if (event.getPointerCount() == 1 && mCurrentTouchCornerIndex != -1) { x = Math.min(Math.max(x, getPaddingLeft()), getWidth() - getPaddingRight()); y = Math.min(Math.max(y, getPaddingTop()), getHeight() - getPaddingBottom()); updateCropViewRect(x, y); mPreviousTouchX = x; mPreviousTouchY = y; return true; } } if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) { mPreviousTouchX = -1; mPreviousTouchY = -1; mCurrentTouchCornerIndex = -1; if (mCallback != null) { mCallback.onCropRectUpdated(mCropViewRect); } } return false; }
Example 17
Source File: PinchImageView.java From ImagePicker with Apache License 2.0 | 4 votes |
@Override public boolean onTouchEvent(MotionEvent event) { super.onTouchEvent(event); int action = event.getAction() & MotionEvent.ACTION_MASK; //最后一个点抬起或者取消,结束所有模式 if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { //如果之前是缩放模式,还需要触发一下缩放结束动画 if (mPinchMode == PINCH_MODE_SCALE) { scaleEnd(); } mPinchMode = PINCH_MODE_FREE; } else if (action == MotionEvent.ACTION_POINTER_UP) { //多个手指情况下抬起一个手指,此时需要是缩放模式才触发 if (mPinchMode == PINCH_MODE_SCALE) { //抬起的点如果大于2,那么缩放模式还有效,但是有可能初始点变了,重新测量初始点 if (event.getPointerCount() > 2) { //如果还没结束缩放模式,但是第一个点抬起了,那么让第二个点和第三个点作为缩放控制点 if (event.getAction() >> 8 == 0) { saveScaleContext(event.getX(1), event.getY(1), event.getX(2), event.getY(2)); //如果还没结束缩放模式,但是第二个点抬起了,那么让第一个点和第三个点作为缩放控制点 } else if (event.getAction() >> 8 == 1) { saveScaleContext(event.getX(0), event.getY(0), event.getX(2), event.getY(2)); } } //如果抬起的点等于2,那么此时只剩下一个点,也不允许进入单指模式,因为此时可能图片没有在正确的位置上 } //第一个点按下,开启滚动模式,记录开始滚动的点 } else if (action == MotionEvent.ACTION_DOWN) { //在矩阵动画过程中不允许启动滚动模式 if (!(mScaleAnimator != null && mScaleAnimator.isRunning())) { //停止所有动画 cancelAllAnimator(); //切换到滚动模式 mPinchMode = PINCH_MODE_SCROLL; //保存触发点用于move计算差值 mLastMovePoint.set(event.getX(), event.getY()); } //非第一个点按下,关闭滚动模式,开启缩放模式,记录缩放模式的一些初始数据 } else if (action == MotionEvent.ACTION_POINTER_DOWN) { //停止所有动画 cancelAllAnimator(); //切换到缩放模式 mPinchMode = PINCH_MODE_SCALE; //保存缩放的两个手指 saveScaleContext(event.getX(0), event.getY(0), event.getX(1), event.getY(1)); } else if (action == MotionEvent.ACTION_MOVE) { if (!(mScaleAnimator != null && mScaleAnimator.isRunning())) { //在滚动模式下移动 if (mPinchMode == PINCH_MODE_SCROLL) { //每次移动产生一个差值累积到图片位置上 scrollBy(event.getX() - mLastMovePoint.x, event.getY() - mLastMovePoint.y); //记录新的移动点 mLastMovePoint.set(event.getX(), event.getY()); //在缩放模式下移动 } else if (mPinchMode == PINCH_MODE_SCALE && event.getPointerCount() > 1) { //两个缩放点间的距离 float distance = MathUtils.getDistance(event.getX(0), event.getY(0), event.getX(1), event.getY(1)); //保存缩放点中点 float[] lineCenter = MathUtils.getCenterPoint(event.getX(0), event.getY(0), event.getX(1), event.getY(1)); mLastMovePoint.set(lineCenter[0], lineCenter[1]); //处理缩放 scale(mScaleCenter, mScaleBase, distance, mLastMovePoint); } } } //无论如何都处理各种外部手势 mGestureDetector.onTouchEvent(event); return true; }
Example 18
Source File: SwipeMenuRecyclerView.java From SwipeRecyclerView-master with Apache License 2.0 | 4 votes |
@Override public boolean onInterceptTouchEvent(MotionEvent e) { boolean isIntercepted = super.onInterceptTouchEvent(e); if (allowSwipeDelete) // swipe and menu conflict. return isIntercepted; else { if (e.getPointerCount() > 1) return true; int action = e.getAction(); int x = (int) e.getX(); int y = (int) e.getY(); switch (action) { case MotionEvent.ACTION_DOWN: { mDownX = x; mDownY = y; isIntercepted = false; int touchingPosition = getChildAdapterPosition(findChildViewUnder(x, y)); if (touchingPosition != mOldTouchedPosition && mOldSwipedLayout != null && mOldSwipedLayout.isMenuOpen()) { mOldSwipedLayout.smoothCloseMenu(); isIntercepted = true; } if (isIntercepted) { mOldSwipedLayout = null; mOldTouchedPosition = INVALID_POSITION; } else { ViewHolder vh = findViewHolderForAdapterPosition(touchingPosition); if (vh != null) { View itemView = getSwipeMenuView(vh.itemView); if (itemView instanceof SwipeMenuLayout) { mOldSwipedLayout = (SwipeMenuLayout) itemView; mOldTouchedPosition = touchingPosition; } } } break; } // They are sensitive to retain sliding and inertia. case MotionEvent.ACTION_MOVE: { isIntercepted = handleUnDown(x, y, isIntercepted); if (mOldSwipedLayout == null) break; ViewParent viewParent = getParent(); if (viewParent == null) break; int disX = mDownX - x; // 向左滑,显示右侧菜单,或者关闭左侧菜单。 boolean showRightCloseLeft = disX > 0 && (mOldSwipedLayout.hasRightMenu() || mOldSwipedLayout.isLeftCompleteOpen()); // 向右滑,显示左侧菜单,或者关闭右侧菜单。 boolean showLeftCloseRight = disX < 0 && (mOldSwipedLayout.hasLeftMenu() || mOldSwipedLayout.isRightCompleteOpen()); viewParent.requestDisallowInterceptTouchEvent(showRightCloseLeft || showLeftCloseRight); } case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { isIntercepted = handleUnDown(x, y, isIntercepted); break; } } } return isIntercepted; }
Example 19
Source File: EntityView.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public boolean onTouchEvent(MotionEvent event) { if (event.getPointerCount() > 1 || !delegate.allowInteraction(this)) { return false; } float x = event.getRawX(); float y = event.getRawY(); int action = event.getActionMasked(); boolean handled = false; switch (action) { case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_DOWN: { if (!isSelected() && delegate != null) { delegate.onEntitySelected(this); announcedSelection = true; } previousLocationX = x; previousLocationY = y; handled = true; hasReleased = false; } break; case MotionEvent.ACTION_MOVE: { handled = onTouchMove(x, y); } break; case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { onTouchUp(); handled = true; } break; } gestureDetector.onTouchEvent(event); return handled; }
Example 20
Source File: ModPieControls.java From GravityBox with Apache License 2.0 | 4 votes |
@Override public boolean onTouch(View v, MotionEvent event) { final int action = event.getAction(); final PieController.Tracker tracker = (PieController.Tracker)v.getTag(); if (tracker == null) { if (DEBUG_INPUT) { log("Pie trigger onTouch: action: " + action + ", (" + event.getAxisValue(MotionEvent.AXIS_X) + "," + event.getAxisValue(MotionEvent.AXIS_Y) + ") position: NULL returning: false"); } return false; } if (!mPieController.isShowing()) { if (event.getPointerCount() > 1) { if (DEBUG_INPUT) { log("Pie trigger onTouch: action: " + action + ", (to many pointers) position: " + tracker.position.name() + " returning: false"); } return false; } switch (action) { case MotionEvent.ACTION_DOWN: tracker.start(event); break; case MotionEvent.ACTION_MOVE: if (tracker.move(event)) { if (DEBUG) { log("Pie control activated on: (" + event.getAxisValue(MotionEvent.AXIS_X) + "," + event.getAxisValue(MotionEvent.AXIS_Y) + ") with position: " + tracker.position.name()); } // send the activation to the controller mPieController.activateFromTrigger(v, event, tracker.position); // forward a spoofed ACTION_DOWN event MotionEvent echo = (MotionEvent) XposedHelpers.callMethod(event, "copy"); echo.setAction(MotionEvent.ACTION_DOWN); return mPieContainer.onTouch(v, echo); } break; default: // whatever it was, we are giving up on this one tracker.active = false; break; } } else { if (DEBUG_INPUT) { log("Pie trigger onTouch: action: " + action + ", (" + event.getAxisValue(MotionEvent.AXIS_X) + "," + event.getAxisValue(MotionEvent.AXIS_Y) + ") position: " + tracker.position.name() + " delegating"); } return mPieContainer.onTouch(v, event); } if (DEBUG_INPUT) { log("Pie trigger onTouch: action: " + action + ", (" + event.getAxisValue(MotionEvent.AXIS_X) + "," + event.getAxisValue(MotionEvent.AXIS_Y) + ") position: " + tracker.position.name() + " returning: " + tracker.active); } return tracker.active; }