Example usage for android.support.v4.view MotionEventCompat ACTION_POINTER_INDEX_MASK

List of usage examples for android.support.v4.view MotionEventCompat ACTION_POINTER_INDEX_MASK

Introduction

In this page you can find the example usage for android.support.v4.view MotionEventCompat ACTION_POINTER_INDEX_MASK.

Prototype

int ACTION_POINTER_INDEX_MASK

To view the source code for android.support.v4.view MotionEventCompat ACTION_POINTER_INDEX_MASK.

Click Source Link

Document

Synonym for MotionEvent#ACTION_POINTER_INDEX_MASK .

Usage

From source file:caesar.feng.framework.widget.StaggeredGrid.ExtendableListView.java

private void onSecondaryPointerUp(MotionEvent event) {
    final int pointerIndex = (event.getAction()
            & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> MotionEventCompat.ACTION_POINTER_INDEX_SHIFT;
    final int pointerId = event.getPointerId(pointerIndex);
    if (pointerId == mActivePointerId) {
        // This was our active pointer going up. Choose a new
        // active pointer and adjust accordingly.
        // TODO: Make this decision more intelligent.
        final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
        mMotionX = (int) event.getX(newPointerIndex);
        mMotionY = (int) event.getY(newPointerIndex);
        mActivePointerId = event.getPointerId(newPointerIndex);
        recycleVelocityTracker();// www.ja  v  a2 s . c om
    }
}