android.view.MotionEvent#ACTION_POINTER_ID_SHIFT源码实例Demo

下面列出了android.view.MotionEvent#ACTION_POINTER_ID_SHIFT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: LotteryTrend   文件: TrendScrollViewWidget.java
private void onSecondaryPointerUp(MotionEvent ev) {
	final int pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
	final int pointerId = ev.getPointerId(pointerIndex);
	if (pointerId == mActivePointerId) {
		// This was our active pointer going up. Choose a new
		// active pointer and adjust accordingly.
		final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
		mLastMotionX = ev.getX(newPointerIndex);
		mLastMotionY = ev.getY(newPointerIndex);
		mActivePointerId = ev.getPointerId(newPointerIndex);
		if (mVelocityTracker != null) {
			mVelocityTracker.clear();
		}
	}
}
 
源代码2 项目: star-zone-android   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码3 项目: CodeEditor   文件: TouchNavigationMethod.java
final protected int getPointerId(MotionEvent e) {
    return (e.getAction() & MotionEvent.ACTION_POINTER_ID_MASK)
            >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码4 项目: imsdk-android   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码5 项目: OmniList   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码6 项目: Favorite-Android-Client   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码7 项目: lua-for-android   文件: TouchNavigationMethod.java
final protected int getPointerId(MotionEvent e) {
    return (e.getAction() & MotionEvent.ACTION_POINTER_ID_MASK)
            >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码8 项目: ImagePicker   文件: CropCompat.java
@SuppressWarnings("deprecation")
@TargetApi(VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action)
{
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码9 项目: Android   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码10 项目: ZoomPreviewPicture   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码11 项目: AndroidPickPhotoDialog   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码12 项目: Tweetin   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码13 项目: RobotCA   文件: JoystickView.java
@Override
public boolean onTouchEvent(MotionEvent event) {

    // Touch events indicate user wants to reset calibration in Tilt mode
    if (controlMode == ControlMode.Tilt) {

        // Reset calibration
        tiltOffset = null;

        return true;
    }

    final int action = event.getAction();

    switch (action & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_MOVE: {
            // If the primary contact point is no longer on the screen then ignore
            // the event.
            if (pointerId != INVALID_POINTER_ID) {
                // If the virtual joystick is in resume-previous-velocity mode.
                if (previousVelocityMode) {
                    // And the current contact is close to the contact location prior to
                    // ContactUp.
                    if (inLastContactRange(event.getX(event.getActionIndex()),
                            event.getY(event.getActionIndex()))) {
                        // Then use the previous velocity.
                        onContactMove(contactUpLocation.x + joystickRadius, contactUpLocation.y
                                + joystickRadius);
                    }
                    // Since the current contact is not close to the prior location.
                    else {
                        // Exit the resume-previous-velocity mode.
                        previousVelocityMode = false;
                    }
                }
                // Since the resume-previous-velocity mode is not active generate
                // velocities based on current contact position.
                else {
                    onContactMove(event.getX(event.findPointerIndex(pointerId)),
                            event.getY(event.findPointerIndex(pointerId)));
                }
            }
            break;
        }
        case MotionEvent.ACTION_DOWN: {
            // Get the coordinates of the pointer that is initiating the
            // interaction.
            pointerId = event.getPointerId(event.getActionIndex());
            onContactDown();
            // If the current contact is close to the location of the contact prior
            // to contactUp.
            if (inLastContactRange(event.getX(event.getActionIndex()), event.getY(event.getActionIndex()))) {
                // Trigger resume-previous-velocity mode.
                previousVelocityMode = true;
                // The animation calculations/operations are performed in
                // onContactMove(). If this is not called and the user's finger stays
                // perfectly still after the down event, no operation is performed.
                // Calling onContactMove avoids this.
                onContactMove(contactUpLocation.x + joystickRadius, contactUpLocation.y + joystickRadius);
            } else {
                onContactMove(event.getX(event.getActionIndex()), event.getY(event.getActionIndex()));
            }
            break;
        }
        case MotionEvent.ACTION_POINTER_UP:
        case MotionEvent.ACTION_UP: {
            // Check if the contact that initiated the interaction is up.
            //noinspection deprecation
            if ((action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT == pointerId) {
                onContactUp();
            }
            break;
        }
    }
    return true;
}
 
源代码14 项目: Dashboard   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码16 项目: android-project-wo2b   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码17 项目: Dashboard   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码18 项目: MoeGallery   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}
 
源代码20 项目: GalleryFinal   文件: Compat.java
@SuppressWarnings("deprecation")
@TargetApi(VERSION_CODES.ECLAIR)
private static int getPointerIndexEclair(int action) {
    return (action & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
}