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


Java MotionEvent.ACTION_POINTER_DOWN属性代码示例

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


在下文中一共展示了MotionEvent.ACTION_POINTER_DOWN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTouch

@Override
public boolean onTouch(View v, MotionEvent event) {
  try {
    boolean result = mGestureDetector.onTouchEvent(event);
    switch (event.getActionMasked()) {
      case MotionEvent.ACTION_POINTER_DOWN:
      case MotionEvent.ACTION_DOWN:
        result |= handleMotionEvent(LowLevelGesture.ACTION_DOWN, event);
        break;
      case MotionEvent.ACTION_MOVE:
        result |= handleMotionEvent(LowLevelGesture.ACTION_MOVE, event);
        break;
      case MotionEvent.ACTION_UP:
      case MotionEvent.ACTION_POINTER_UP:
        finishDisallowInterceptTouchEvent(v);
        result |= handleMotionEvent(LowLevelGesture.ACTION_UP, event);
        result |= handlePanMotionEvent(event);
        break;
      case MotionEvent.ACTION_CANCEL:
        finishDisallowInterceptTouchEvent(v);
        result |= handleMotionEvent(LowLevelGesture.ACTION_CANCEL, event);
        result |= handlePanMotionEvent(event);
        break;
    }
    return result;
  } catch (Exception e) {
    WXLogUtils.e("Gesture RunTime Error ", e);
    return false;
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:30,代码来源:WXGesture.java

示例2: onTouch

@Override
public boolean onTouch(View v, MotionEvent event) {
  int action = event.getAction();
  if (mOnActivePseudoListner != null) {
    if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN) {
      mOnActivePseudoListner.updateActivePseudo(true);
    } else if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
      mOnActivePseudoListner.updateActivePseudo(false);
    }
  }
  return mIsConsumeOnTouch;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:12,代码来源:TouchActivePseudoListener.java

示例3: onTouchEvent

@Override
public boolean onTouchEvent(MotionEvent event) {

    if (!isPDFViewReady()) {
        return super.onTouchEvent(event);
    }

    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
        case MotionEvent.ACTION_POINTER_DOWN:
            pdfView.stopFling();
            handler.removeCallbacks(hidePageScrollerRunnable);
            if (pdfView.isSwipeVertical()) {
                currentPos = event.getRawY() - getY();
            } else {
                currentPos = event.getRawX() - getX();
            }
        case MotionEvent.ACTION_MOVE:
            if (pdfView.isSwipeVertical()) {
                setPosition(event.getRawY() - currentPos + relativeHandlerMiddle);
                pdfView.setPositionOffset(relativeHandlerMiddle / (float) getHeight(), false);
            } else {
                setPosition(event.getRawX() - currentPos + relativeHandlerMiddle);
                pdfView.setPositionOffset(relativeHandlerMiddle / (float) getWidth(), false);
            }
            return true;
        case MotionEvent.ACTION_CANCEL:
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_POINTER_UP:
            hideDelayed();
            return true;
    }

    return super.onTouchEvent(event);
}
 
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:35,代码来源:DefaultScrollHandle.java

示例4: dispatchTouchEvent

@Override
public boolean dispatchTouchEvent(MotionEvent e) {
    final float height = getHeight();
    final float transY = getTranslationY();
    final float scrollDamp = mAViewParams.mOverScrollDamp * Math.abs(height - Math.abs(transY)) / height;

    switch (e.getActionMasked()) {
        case MotionEvent.ACTION_DOWN: {
            mAViewState.setTouchLastXY(e);
            break;
        }
        case MotionEvent.ACTION_POINTER_DOWN: {
            mAViewState.setTouchDXY(e, scrollDamp);
            break;
        }
        case MotionEvent.ACTION_MOVE: {
            if (mAViewState.getLastAction() == MotionEvent.ACTION_POINTER_UP) {
                mAViewState.setTouchLastXY(e);
            } else {
                mAViewState.setTouchDXY(e, scrollDamp);
            }
            break;
        }
        case MotionEvent.ACTION_POINTER_UP: {
            int indexOfUpPointer = e.getActionIndex();
            if (indexOfUpPointer == 0) {
                mAViewState.setTouchLastXY(e);
            }
            break;
        }
        case MotionEvent.ACTION_UP: {
            mAViewState.resetTouch();
            break;
        }
    }
    return super.dispatchTouchEvent(e);
}
 
开发者ID:anmingyu11,项目名称:OverScrollableRecyclerView-Method1,代码行数:37,代码来源:ARecyclerView.java

示例5: onTouch

@Override
public boolean onTouch(View v, MotionEvent event) {

    ImageView view = (ImageView) v;

    // Dump touch event to log
    dumpEvent(event);

    // Handle touch events here...
    switch (event.getAction() & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN:
            lastPoint.set(event.getX(), event.getY());
            mode = DRAG;
            break;
        case MotionEvent.ACTION_POINTER_DOWN:
            oldDist = spacing(event);
            mode = ZOOM;
            break;
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_POINTER_UP:
            mode = NONE;
            break;
        case MotionEvent.ACTION_MOVE:

            if (mode == DRAG) {

                // Do nothing at the outer left side. Probably the user opened the navigation drawer:
                if (event.getX() < LEFT_MARGIN)
                    return false;

                float xDiff = event.getX() - lastPoint.x;
                float yDiff = event.getY() - lastPoint.y;

                float diff;

                if (Math.abs(xDiff) > Math.abs(yDiff)) {
                    diff = xDiff;
                    if (event.getY() < view.getHeight() / 2)
                        diff *= -1;
                }
                else {
                    diff = yDiff;
                    if (event.getX() > view.getWidth() / 2)
                        diff *= -1;
                }

                float fac = .25f;
                int iDiff = Math.round(diff * fac);

                mPlanetChangeCallBacks.addAngle(iDiff);

                lastPoint.set(event.getX(), event.getY());


            } else if (mode == ZOOM) {

                float newDist = spacing(event);

                float scale = newDist / oldDist;
                mPlanetChangeCallBacks.addScaleLog(scale * scale);

                oldDist = newDist;

            }
            break;
    }


    return true; // indicate event was handled
}
 
开发者ID:hollaus,项目名称:TinyPlanetMaker,代码行数:70,代码来源:OnPlanetTouchListener.java

示例6: onTouchEvent

public boolean onTouchEvent(MotionEvent event){
    switch (event.getActionMasked()) {
        case MotionEvent.ACTION_DOWN:
            ptrID1 = event.getPointerId(event.getActionIndex());
            break;
        case MotionEvent.ACTION_POINTER_DOWN:
            ptrID2 = event.getPointerId(event.getActionIndex());
            sX = event.getX(event.findPointerIndex(ptrID1));
            sY = event.getY(event.findPointerIndex(ptrID1));
            fX = event.getX(event.findPointerIndex(ptrID2));
            fY = event.getY(event.findPointerIndex(ptrID2));
            break;
        case MotionEvent.ACTION_MOVE:
            if(ptrID1 != INVALID_POINTER_ID && ptrID2 != INVALID_POINTER_ID){
                float nfX, nfY, nsX, nsY;
                nsX = event.getX(event.findPointerIndex(ptrID1));
                nsY = event.getY(event.findPointerIndex(ptrID1));
                nfX = event.getX(event.findPointerIndex(ptrID2));
                nfY = event.getY(event.findPointerIndex(ptrID2));

                mAngle = angleBetweenLines(fX, fY, sX, sY, nfX, nfY, nsX, nsY);

                if (mListener != null) {
                    mListener.OnRotation(this);
                }
            }
            break;
        case MotionEvent.ACTION_UP:
            ptrID1 = INVALID_POINTER_ID;
            break;
        case MotionEvent.ACTION_POINTER_UP:
            ptrID2 = INVALID_POINTER_ID;
            break;
        case MotionEvent.ACTION_CANCEL:
            ptrID1 = INVALID_POINTER_ID;
            ptrID2 = INVALID_POINTER_ID;
            break;
    }
    return true;
}
 
开发者ID:SarthakDoshi04,项目名称:text-on-image,代码行数:40,代码来源:RotationGestureDetector.java

示例7: onInterceptTouchEvent

@Override
public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent event) {
    int action = event.getActionMasked();
    boolean isScrollIdle = RecyclerListView.this.getScrollState() == RecyclerListView.SCROLL_STATE_IDLE;

    if ((action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN) && currentChildView == null && isScrollIdle) {
        currentChildView = view.findChildViewUnder(event.getX(), event.getY());
        if (currentChildView instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) currentChildView;
            float x = event.getX() - currentChildView.getLeft();
            float y = event.getY() - currentChildView.getTop();
            final int count = viewGroup.getChildCount();
            for (int i = count - 1; i >= 0; i--) {
                final View child = viewGroup.getChildAt(i);
                if (x >= child.getLeft() && x <= child.getRight() && y >= child.getTop() && y <= child.getBottom()) {
                    if (child.isClickable()) {
                        currentChildView = null;
                        break;
                    }
                }
            }
        }
        currentChildPosition = -1;
        if (currentChildView != null) {
            currentChildPosition = view.getChildPosition(currentChildView);
            MotionEvent childEvent = MotionEvent.obtain(0, 0, event.getActionMasked(), event.getX() - currentChildView.getLeft(), event.getY() - currentChildView.getTop(), 0);
            if (currentChildView.onTouchEvent(childEvent)) {
                interceptedByChild = true;
            }
            childEvent.recycle();
        }
    }

    if (currentChildView != null && !interceptedByChild) {
        try {
            if (event != null) {
                mGestureDetector.onTouchEvent(event);
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
    }

    if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN) {
        if (!interceptedByChild && currentChildView != null) {
            selectChildRunnable = new Runnable() {
                @Override
                public void run() {
                    if (selectChildRunnable != null && currentChildView != null) {
                        currentChildView.setPressed(true);
                        selectChildRunnable = null;
                    }
                }
            };
            AndroidUtilities.runOnUIThread(selectChildRunnable, ViewConfiguration.getTapTimeout());
        }
    } else if (currentChildView != null && (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP || action == MotionEvent.ACTION_CANCEL || !isScrollIdle)) {
        if (selectChildRunnable != null) {
            AndroidUtilities.cancelRunOnUIThread(selectChildRunnable);
            selectChildRunnable = null;
        }
        currentChildView.setPressed(false);
        currentChildView = null;
        interceptedByChild = false;
    }
    return false;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:67,代码来源:RecyclerListView.java

示例8: dispatchTouchEvent

/**
 * 处理横向滑动的事件
 */

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    int action = ev.getActionMasked();
    if (action == MotionEvent.ACTION_DOWN) {
        isChildHandle = false;
        // 记录手指按下的位置
        startY = ev.getY();
        startX = ev.getX();
        distanceX = 0;
        distanceY = 0;
        // 获取按下的那个View
        int position = pointToPosition((int) startX, (int) startY);
        touchView = getChildAt(position);

        if (hasChildOpen()) {
            // 如果触摸的不是打开的那个View, 关闭所有View,并且拦截所有事件
            if (touchView != null && touchView instanceof SwipeRecycleViewItemLayout &&
                    ((SwipeRecycleViewItemLayout) touchView).isOpen()) {
                isChildHandle = true; // 将事件交给child!
            } else {
                closeAllSwipeItem();
                //return false;
            }
        }
    }
    // 禁用多点触控
    if (action == MotionEvent.ACTION_POINTER_DOWN) {
        return false;
    }

    return super.dispatchTouchEvent(ev);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:36,代码来源:RSwipeRecycleView.java

示例9: processTouchEvent

private boolean processTouchEvent(MotionEvent event) {
    if (!pressed && event.getActionMasked() == MotionEvent.ACTION_DOWN || event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
        if (!takingPhoto) {
            pressed = true;
            maybeStartDraging = true;
            lastY = event.getY();
        }
    } else if (pressed) {
        if (event.getActionMasked() == MotionEvent.ACTION_MOVE) {
        } else if (event.getActionMasked() == MotionEvent.ACTION_CANCEL || event.getActionMasked() == MotionEvent.ACTION_UP || event.getActionMasked() == MotionEvent.ACTION_POINTER_UP) {
            pressed = false;
            if (dragging) {
                dragging = false;
                if (cameraView != null) {
                    if (Math.abs(cameraView.getTranslationY()) > cameraView.getMeasuredHeight() / 6.0f) {
                        closeCamera(true);
                    } else {
                        AnimatorSet animatorSet = new AnimatorSet();
                        animatorSet.playTogether(
                                ObjectAnimator.ofFloat(cameraView, "translationY", 0.0f),
                                ObjectAnimator.ofFloat(cameraPanel, "alpha", 1.0f),
                                ObjectAnimator.ofFloat(flashModeButton[0], "alpha", 1.0f),
                                ObjectAnimator.ofFloat(flashModeButton[1], "alpha", 1.0f));
                        animatorSet.setDuration(250);
                        animatorSet.setInterpolator(interpolator);
                        animatorSet.start();
                        cameraPanel.setTag(null);
                    }
                }
            } else {
                cameraView.getLocationOnScreen(viewPosition);
                float viewX = event.getRawX() - viewPosition[0];
                float viewY = event.getRawY() - viewPosition[1];
                cameraView.focusToPoint((int) viewX, (int) viewY);
            }
        }
    }
    return true;
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:39,代码来源:CameraActivity.java

示例10: handleTouch

/**
 * Handles the touch event.
 * 
 * @param event
 *            the touch event
 */
public boolean handleTouch(MotionEvent event) {
	int action = event.getAction() & MotionEvent.ACTION_MASK;	// same as getActionMask
	if (action == MotionEvent.ACTION_MOVE) {
		if (event.getPointerCount() == 1)	{	// slide
			float newX = event.getX(0);
			float newY = event.getY(0);
			if (mfOldX >= 0 && mfOldY >= 0)	{	// valid last position.
				moglChart.slide(mfOldX, mfOldY, newX, newY);
			}
			mfOldX2 = -1;
			mfOldY2 = -1;
			mfOldX = newX;
			mfOldY = newY;
		} else if (event.getPointerCount() == 2)	{	// pinch
			if (!(moglChart instanceof OGLExprChart))	{
				// note that OGLExprChart is also instance of OGLChart so cannot use
				// if (moglChart instanceof OGLChart)...
				pinch2Zoom(event);	// data chart pinch to zoom
			}
		}
	} else if (action == MotionEvent.ACTION_DOWN) {
		mfOldX = event.getX(0);
		mfOldY = event.getY(0);
		moglChart.click(mfOldX, mfOldY);
	} else if (action == MotionEvent.ACTION_POINTER_DOWN) {
		if (event.getPointerCount() == 2)	{
			mfOldX = event.getX(0);
			mfOldY = event.getY(0);
			mfOldX2 = event.getX(1);
			mfOldY2 = event.getY(1);
		} else if (event.getPointerCount() > 2)	{
			// if more than two pointers, exit pinch to zoom mode.
			mfOldX = -1;
			mfOldY = -1;
			mfOldX2 = -1;
			mfOldY2 = -1;
		}
	} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
		if (event.getPointerCount() == 2 && moglChart instanceof OGLExprChart) {
			pinch2Zoom(event);
		}
		mfOldX = -1;
		mfOldY = -1;
		mfOldX2 = -1;
		mfOldY2 = -1;
	}
	//TODO: enable or disable click.
	return true;	//!mRenderer.isClickEnabled();
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:55,代码来源:OGLChartView.java

示例11: onPointerEvent

public void onPointerEvent(MotionEvent event) {
    switch (event.getActionMasked()) {
        case MotionEvent.ACTION_DOWN:
            mSwipeFireable = true;
            mDebugFireable = true;
            mDownPointers = 0;
            captureDown(event, 0);
            break;
        case MotionEvent.ACTION_POINTER_DOWN:
            captureDown(event, event.getActionIndex());
            if (mDebugFireable) {
                mDebugFireable = event.getPointerCount() < 5;
                if (!mDebugFireable) {
                    mCallbacks.onDebug();
                }
            }
            break;
        case MotionEvent.ACTION_MOVE:
            if (mSwipeFireable) {
                final int swipe = detectSwipe(event);
                mSwipeFireable = swipe == SWIPE_NONE;
                if (swipe == SWIPE_FROM_TOP) {
                    mCallbacks.onSwipeFromTop();
                } else if (swipe == SWIPE_FROM_BOTTOM) {
                    int y = (int) event.getY();
                    int navbarH = 200;
                    int screenH = PhoneWindowManagerHook.screenH;
                   // XpLog.i("y is " + y + "\n navbarH is " + navbarH + "\n screenH is " + screenH);
                    if (y > (screenH - navbarH))
                        mCallbacks.onSwipeFromBottom();
                } else if (swipe == SWIPE_FROM_RIGHT) {
                    mCallbacks.onSwipeFromRight();
                }
            }
            break;
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_CANCEL:
            mSwipeFireable = false;
            mDebugFireable = false;
            break;
        default:
    }
}
 
开发者ID:EggUncle,项目名称:XposedNavigationBar,代码行数:43,代码来源:GesturesListener.java

示例12: onTouch

@Override
public boolean onTouch(View v, MotionEvent event) {
  try {
    boolean result = mGestureDetector.onTouchEvent(event);
    switch (event.getActionMasked()) {
      case MotionEvent.ACTION_POINTER_DOWN:
      case MotionEvent.ACTION_DOWN:
        mIsTouchEventConsumed = false;
        /**
         * If component has same scroll orientation with it's parent and it's parent not scrollable
         * , we should disallow parent in DOWN.
         */
        if(hasSameOrientationWithParent() && !isParentScrollable()){
          ViewParent p;
          if ((p = component.getRealView().getParent()) != null) {
            p.requestDisallowInterceptTouchEvent(true);
          }
        }
        result |= handleMotionEvent(LowLevelGesture.ACTION_DOWN, event);
        break;
      case MotionEvent.ACTION_MOVE:
        result |= handleMotionEvent(LowLevelGesture.ACTION_MOVE, event);
        break;
      case MotionEvent.ACTION_UP:
      case MotionEvent.ACTION_POINTER_UP:
        finishDisallowInterceptTouchEvent(v);
        result |= handleMotionEvent(LowLevelGesture.ACTION_UP, event);
        result |= handlePanMotionEvent(event);
        break;
      case MotionEvent.ACTION_CANCEL:
        finishDisallowInterceptTouchEvent(v);
        result |= handleMotionEvent(LowLevelGesture.ACTION_CANCEL, event);
        result |= handlePanMotionEvent(event);
        break;
    }
    return result;
  } catch (Exception e) {
    WXLogUtils.e("Gesture RunTime Error ", e);
    return false;
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:41,代码来源:WXGesture.java

示例13: init

private void init(
    int viewTag,
    TouchEventType touchEventType,
    MotionEvent motionEventToCopy,
    long gestureStartTime,
    float viewX,
    float viewY,
    TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper) {
  super.init(viewTag);

  SoftAssertions.assertCondition(gestureStartTime != UNSET,
      "Gesture start time must be initialized");
  short coalescingKey = 0;
  int action = (motionEventToCopy.getAction() & MotionEvent.ACTION_MASK);
  switch (action) {
    case MotionEvent.ACTION_DOWN:
      touchEventCoalescingKeyHelper.addCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_UP:
      touchEventCoalescingKeyHelper.removeCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_POINTER_DOWN:
    case MotionEvent.ACTION_POINTER_UP:
      touchEventCoalescingKeyHelper.incrementCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_MOVE:
      coalescingKey =
        touchEventCoalescingKeyHelper.getCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_CANCEL:
      touchEventCoalescingKeyHelper.removeCoalescingKey(gestureStartTime);
      break;
    default:
      throw new RuntimeException("Unhandled MotionEvent action: " + action);
  }
  mTouchEventType = touchEventType;
  mMotionEvent = MotionEvent.obtain(motionEventToCopy);
  mCoalescingKey = coalescingKey;
  mViewX = viewX;
  mViewY = viewY;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:41,代码来源:TouchEvent.java

示例14: onTouchEvent

public boolean onTouchEvent(@NonNull MotionEvent event) {
    switch (event.getActionMasked()) {
        case MotionEvent.ACTION_DOWN:
            sX = event.getX();
            sY = event.getY();
            mPointerIndex1 = event.findPointerIndex(event.getPointerId(0));
            mAngle = 0;
            mIsFirstTouch = true;
            break;
        case MotionEvent.ACTION_POINTER_DOWN:
            fX = event.getX();
            fY = event.getY();
            mPointerIndex2 = event.findPointerIndex(event.getPointerId(event.getActionIndex()));
            mAngle = 0;
            mIsFirstTouch = true;
            break;
        case MotionEvent.ACTION_MOVE:
            if (mPointerIndex1 != INVALID_POINTER_INDEX && mPointerIndex2 != INVALID_POINTER_INDEX && event.getPointerCount() > mPointerIndex2) {
                float nfX, nfY, nsX, nsY;

                nsX = event.getX(mPointerIndex1);
                nsY = event.getY(mPointerIndex1);
                nfX = event.getX(mPointerIndex2);
                nfY = event.getY(mPointerIndex2);

                if (mIsFirstTouch) {
                    mAngle = 0;
                    mIsFirstTouch = false;
                } else {
                    calculateAngleBetweenLines(fX, fY, sX, sY, nfX, nfY, nsX, nsY);
                }

                if (mListener != null) {
                    mListener.onRotation(this);
                }
                fX = nfX;
                fY = nfY;
                sX = nsX;
                sY = nsY;
            }
            break;
        case MotionEvent.ACTION_UP:
            mPointerIndex1 = INVALID_POINTER_INDEX;
            break;
        case MotionEvent.ACTION_POINTER_UP:
            mPointerIndex2 = INVALID_POINTER_INDEX;
            break;
    }
    return true;
}
 
开发者ID:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:50,代码来源:RotationGestureDetector.java

示例15: handleStartProgressEvent

@Override
protected void handleStartProgressEvent(int actionCode, MotionEvent event) {
    switch (actionCode) {
        case MotionEvent.ACTION_POINTER_DOWN:
            // At least the second finger is on screen now

            resetState(); // In case we missed an UP/CANCEL event
            mPrevEvent = MotionEvent.obtain(event);
            mTimeDelta = 0;

            updateStateByEvent(event);

            // See if we have a sloppy gesture
            mSloppyGesture = isSloppyGesture(event);
            if (!mSloppyGesture) {
                // No, start gesture now
                mGestureInProgress = mListener.onShoveBegin(this);
            }
            break;

        case MotionEvent.ACTION_MOVE:
            if (!mSloppyGesture) {
                break;
            }

            // See if we still have a sloppy gesture
            mSloppyGesture = isSloppyGesture(event);
            if (!mSloppyGesture) {
                // No, start normal gesture now
                mGestureInProgress = mListener.onShoveBegin(this);
            }

            break;

        case MotionEvent.ACTION_POINTER_UP:
            if (!mSloppyGesture) {
                break;
            }

            break;
    }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:42,代码来源:ShoveGestureDetector.java


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