Example usage for android.view MotionEvent getPointerId

List of usage examples for android.view MotionEvent getPointerId

Introduction

In this page you can find the example usage for android.view MotionEvent getPointerId.

Prototype

public final int getPointerId(int pointerIndex) 

Source Link

Document

Return the pointer identifier associated with a particular pointer data index in this event.

Usage

From source file:com.leeon.blank.widget.RangeBarNew.java

private void handleTouchUp(MotionEvent event) {
    final int actionIndex = (event.getAction()
            & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
    final int actionID = event.getPointerId(actionIndex);
    if (actionID == mLeftPointerID) {
        if (!mLeftHit) {
            return;
        }//from  ww w  . j a v a2 s.  c  o  m
        // If cursor between in tow mark locations, it should be located on the lower or higher one.
        if (getDiffByX(event.getX()) == 1) {
            // step 1:Calculate the offset with lower mark.
            final float offset = mLeftCursorIndex % 5;
            // step 2:Decide which mark will go to.
            if (offset < 2.5f) {
                // If left cursor want to be located on lower mark, go ahead
                // guys.
                // Because right cursor will never appear lower than the
                // left one.
                mLeftCursorNextIndex = (int) (mLeftCursorIndex / 5) * 5;
            } else {
                mLeftCursorNextIndex = (int) (mLeftCursorIndex / 5) * 5 + 1;
                // If left cursor want to be located on higher mark,
                // situation becomes a little complicated.
                // We should check that whether distance between left and
                // right cursor is less than 1, and next index of left
                // cursor is difference with current
                // of right one.
                if (Math.abs(mLeftCursorIndex - mRightCursorIndex) <= 5
                        && mLeftCursorNextIndex == mRightCursorNextIndex) {
                    // Left can not go to the higher, just to the lower one.
                    mLeftCursorNextIndex = (int) (mLeftCursorIndex / 5) * 5;
                }
            }
            // step 3: Move to.
            if (!mLeftScroller.computeScrollOffset()) {
                final int fromX = (int) (mLeftCursorIndex * mTinyPartLength);
                mLeftScroller.startScroll(fromX, 0, (int) (mLeftCursorNextIndex * mTinyPartLength - fromX), 0,
                        mDuration);
            }
            if (mLeftCursorNextIndex != mLeftCursorPreIndex) {
                mLeftCursorPreIndex = mLeftCursorNextIndex;
            }
        }

        // Reset values of parameters
        mLeftPointerLastX = 0;
        mLeftCursorBG.setState(mUnPressedEanabledState);
        mLeftPointerID = -1;
        mLeftHit = false;
        invalidate();
    } else if (actionID == mRightPointerID) {
        if (!mRightHit) {
            return;
        }

        if (getDiffByX(event.getX()) == 1) {
            final float offset = mRightCursorIndex % 5;
            if (offset > 2.5f) {
                mRightCursorNextIndex = (int) (mRightCursorIndex / 5) * 5 + 1;
            } else {
                mRightCursorNextIndex = (int) (mRightCursorIndex / 5) * 5;
                if (Math.abs(mLeftCursorIndex - mRightCursorIndex) <= 5
                        && mRightCursorNextIndex == mLeftCursorNextIndex) {
                    mRightCursorNextIndex = (int) (mRightCursorIndex / 5) * 5 + 1;
                }
            }
            if (!mRightScroller.computeScrollOffset()) {
                final int fromX = (int) (mRightCursorIndex * mTinyPartLength);
                mRightScroller.startScroll(fromX, 0, (int) (mRightCursorNextIndex * mTinyPartLength - fromX), 0,
                        mDuration);
            }
            if (mRightCursorNextIndex != mRightCursorPreIndex) {
                mRightCursorPreIndex = mRightCursorNextIndex;
            }
        }

        mRightPointerLastX = 0;
        mLeftCursorBG.setState(mUnPressedEanabledState);
        mRightPointerID = -1;
        mRightHit = false;
        invalidate();
    }
}

From source file:nz.ac.otago.psyanlab.common.designer.program.stage.StageView.java

private void updateMotionCoords(MotionEvent event, final int pointerCount) {
    for (int pointerIndex = 0; pointerIndex < pointerCount; pointerIndex++) {
        int pointerId = event.getPointerId(pointerIndex);
        mMotionX.put(pointerId, event.getX(pointerIndex));
        mMotionY.put(pointerId, event.getY(pointerIndex));
    }/*from  w ww. j  ava  2  s.c  om*/
}

From source file:org.cocos2dx.lib.TextInputWraper.java

private void dumpEvent(MotionEvent event) {
    String names[] = { "DOWN", "UP", "MOVE", "CANCEL", "OUTSIDE", "POINTER_DOWN", "POINTER_UP", "7?", "8?",
            "9?" };
    StringBuilder sb = new StringBuilder();
    int action = event.getAction();
    int actionCode = action & MotionEvent.ACTION_MASK;
    sb.append("event ACTION_").append(names[actionCode]);
    if (actionCode == MotionEvent.ACTION_POINTER_DOWN || actionCode == MotionEvent.ACTION_POINTER_UP) {
        sb.append("(pid ").append(action >> MotionEvent.ACTION_POINTER_ID_SHIFT);
        sb.append(")");
    }//from  w  ww  .  j a va  2 s.  c o m
    sb.append("[");
    for (int i = 0; i < event.getPointerCount(); i++) {
        sb.append("#").append(i);
        sb.append("(pid ").append(event.getPointerId(i));
        sb.append(")=").append((int) event.getX(i));
        sb.append(",").append((int) event.getY(i));
        if (i + 1 < event.getPointerCount())
            sb.append(";");
    }
    sb.append("]");
    Log.d(TAG, sb.toString());
}

From source file:com.csounds.examples.tests.SynthActivity.java

/** Called when the activity is first created. */
@Override//www. j  av  a  2  s.  c  o  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    for (int i = 0; i < touchIds.length; i++) {
        touchIds[i] = -1;
        touchX[i] = -1;
        touchY[i] = -1;
    }
    multiTouchView = new View(this);

    setContentView(R.layout.synth2);
    multiTouchView = (RelativeLayout) findViewById(R.id.synth);
    octPlusButton = (Button) findViewById(R.id.plusoctavebutton);
    octMinusButton = (Button) findViewById(R.id.minusoctavebutton);
    diode4 = (ToggleButton) findViewById(R.id.diode4);
    diode3 = (ToggleButton) findViewById(R.id.diode3);
    LcdScreenView lcd = (LcdScreenView) findViewById(R.id.lcd_screen);
    new DrumMachineLcdUpdater(lcd.getModel());
    this.createLoadListener((View) lcd);
    keyboardLayout = (RelativeLayout) findViewById(R.id.keyboard);
    keyboardLayout.setOnTouchListener(new OnTouchListener() {

        /* (non-Javadoc)
         * @see android.view.View.OnTouchListener#onTouch(android.view.View, android.view.MotionEvent)
         */
        public boolean onTouch(View v, MotionEvent event) {
            final int action = event.getAction() & MotionEvent.ACTION_MASK;
            float[] touchArrayDown = new float[2];
            switch (action) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_POINTER_DOWN:

                for (int i = 0; i < event.getPointerCount(); i++) {
                    int pointerId = event.getPointerId(i);
                    int id = getTouchId(pointerId);

                    if (id == -1) {

                        id = getTouchIdAssignment();

                        if (id != -1) {
                            touchIds[id] = pointerId;
                            touchX[id] = event.getX(i) / keyboardLayout.getWidth();
                            touchY[id] = 1 - (event.getY(i) / keyboardLayout.getHeight());
                            //TODO calculte interval Y

                            if (touchXPtr[id] != null) {
                                //TODO swtich touchid
                                //                           Log.d("touchXtouchY","touchX[id]) " + touchX[id] + " touchY[id]) " + touchY[id] + " multitouchview width " + multiTouchView.getWidth() + " multitouchview width " + multiTouchView.getHeight());
                                //                           Log.d("touchXtouchY","keyboardLayout width " + keyboardLayout.getWidth() + " keyboardLayout width " + keyboardLayout.getHeight());
                                // get the key from the touch coordinates
                                float[] touchArray = new float[2];
                                touchArray = evaluateTouchKey(touchX[id], touchY[id]);
                                touchArrayDown[0] = touchX[id];
                                touchArrayDown[1] = touchY[id];
                                touchX[id] = touchArray[0];
                                touchY[id] = touchArray[1];

                                //                           Log.d("touchXtouchY","touchX[id]) " + touchX[id] + " touchY[id]) " + touchY[id]);
                                touchXPtr[id].SetValue(0, touchX[id]);
                                touchYPtr[id].SetValue(0, touchY[id]);
                                csoundObj.sendScore(String.format("i1.%d 0 -2 %d", id, id));
                            }

                        }
                    }

                }

                break;
            case MotionEvent.ACTION_MOVE:

                for (int i = 0; i < event.getPointerCount(); i++) {
                    int pointerId = event.getPointerId(i);
                    int id = getTouchId(pointerId);

                    if (id != -1) {
                        touchIds[id] = pointerId;
                        touchX[id] = event.getX(i) / keyboardLayout.getWidth();
                        touchY[id] = 1 - (event.getY(i) / keyboardLayout.getHeight());
                        //TODO calculte interval Y

                        if (touchXPtr[id] != null) {
                            //TODO swtich touchid
                            //                           Log.d("aaa","touchX[id]) " + touchX[id] + " touchY[id]) " + touchY[id] + " multitouchview width " + multiTouchView.getWidth() + " multitouchview width " + multiTouchView.getHeight());
                            //                           Log.d("aaa","keyboardLayout width " + keyboardLayout.getWidth() + " keyboardLayout width " + keyboardLayout.getHeight());
                            // get the key from the touch coordinates
                            float[] touchArray = new float[2];

                            touchArray = evaluateTouchKey(touchX[id], touchY[id]);

                            touchX[id] = touchArray[0];
                            touchY[id] = touchArray[1];

                            //                           Log.d("touchXtouchY","touchX[id]) " + touchX[id] + " touchY[id]) " + touchY[id]);
                            touchXPtr[id].SetValue(0, touchX[id]);
                            touchYPtr[id].SetValue(0, touchY[id]);
                            csoundObj.sendScore(String.format("i1.%d 0 -2 %d", id, id));
                        }

                    }

                }
                break;

            case MotionEvent.ACTION_POINTER_UP:
            case MotionEvent.ACTION_UP: {
                int activePointerIndex = event.getActionIndex();
                int pointerId = event.getPointerId(activePointerIndex);

                int id = getTouchId(pointerId);
                if (id != -1) {
                    touchIds[id] = -1;
                    csoundObj.sendScore(String.format("i-1.%d 0 0 %d", id, id));
                }
                //write file
                /*         System.out.println(String.format(
                      "i1.%d 0 -2 %d", id, id));
                writeToFile(String.format(
                      "i1.%d 0 -2 %d", id, id));
                 */
            }
                break;
            }

            return true;
        }

    });

    OnTouchListener octBtnOk = new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                if (octNbr < 12)
                    octNbr += 12;
                break;
            }
            return false;
        }
    };
    octPlusButton.setOnTouchListener(octBtnOk);

    OnTouchListener octBtnMinus = new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                if (octNbr > -36)
                    octNbr -= 12;

                break;
            }
            return false;
        }
    };

    octMinusButton.setOnTouchListener(octBtnMinus);

    String csd = getResourceFileAsString(R.raw.multitouch_xy_kx);
    File f = createTempFile(csd);

    csoundObj.addBinding(this);

    csoundObj.startCsound(f);
    //   initknobs();

    initSeekBar(diode3, diode4);

}

From source file:com.ouyangzn.view.DragLayout.java

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    boolean helpResult = mDragHelper.shouldInterceptTouchEvent(ev);
    switch (MotionEventCompat.getActionMasked(ev)) {
    case MotionEvent.ACTION_DOWN:
        mDownX = ev.getX();/*from   w ww  .jav  a2  s . co m*/
        mDownY = ev.getY();
        break;
    }
    if (isHorizontalScrollView(mDraggedView)) {
        boolean intercept = false;
        switch (MotionEventCompat.getActionMasked(ev)) {
        case MotionEvent.ACTION_MOVE:
            if (mDirection == DIRECTION_TOP || mDirection == DIRECTION_BOTTOM) {
                // ?--->support-v4DrawerLayout??
                intercept = mDragHelper.checkTouchSlop(ViewDragHelper.DIRECTION_VERTICAL, ev.getPointerId(0));
            } else {
                // ?
                if (ev.getX() - mDownX > 0) {
                    // view????,
                    if (mDirection == DIRECTION_LEFE && mDraggedView.getRight() == mRemainDistance) {
                        intercept = true;
                    } else if (mDirection == DIRECTION_RIGHT) {
                        // view????view??
                        intercept = !ViewCompat.canScrollHorizontally(mDraggedView, -1);
                    }
                }
                // 
                else {
                    // view?????,
                    if (mDirection == DIRECTION_RIGHT
                            && (mLayoutWidth - mDraggedView.getLeft()) == mRemainDistance) {
                        intercept = true;
                    } else if (mDirection == DIRECTION_LEFE) {
                        // view???view??
                        intercept = !ViewCompat.canScrollHorizontally(mDraggedView, 1);
                    }
                }
            }
            // ???view
            if (intercept)
                mDragHelper.captureChildView(mDraggedView, ev.getPointerId(0));
            break;
        }
        return helpResult || intercept;
    }
    if (isVerticalScrollView(mDraggedView)) {
        boolean intercept = false;
        switch (MotionEventCompat.getActionMasked(ev)) {
        case MotionEvent.ACTION_MOVE:
            if (mDirection == DIRECTION_LEFE || mDirection == DIRECTION_RIGHT) {
                // ?--->support-v4DrawerLayout??
                intercept = mDragHelper.checkTouchSlop(ViewDragHelper.DIRECTION_HORIZONTAL, ev.getPointerId(0));
            } else {
                // 
                if (ev.getY() - mDownY > 0) {
                    if (mDirection == DIRECTION_TOP && mDraggedView.getBottom() == mRemainDistance) {
                        intercept = true;
                    } else if (mDirection == DIRECTION_BOTTOM) {
                        intercept = !ViewCompat.canScrollVertically(mDraggedView, -1);
                    }
                }
                // 
                else {
                    // view????
                    if (mDirection == DIRECTION_BOTTOM
                            && (mLayoutHeight - mDraggedView.getBottom()) == mRemainDistance) {
                        intercept = true;
                    } else if (mDirection == DIRECTION_TOP) {
                        // view???view??
                        intercept = !ViewCompat.canScrollVertically(mDraggedView, 1);
                    }
                }
            }
            break;
        }
        Log.d(TAG, "----------onInterceptTouchEvent.return = " + (helpResult || intercept));
        // ???view
        if (intercept)
            mDragHelper.captureChildView(mDraggedView, ev.getPointerId(0));
        return helpResult || intercept;
    }
    return helpResult;
}

From source file:com.dirkgassen.wator.ui.view.RangeSlider.java

/**
 * Handle touch events: drag the thumb to new values. This method also detects clicks.
 *
 * @param event the touch event//from  w ww .  j  a v  a  2 s . c  o m
 * @return {@code true} if the event was handled; {@code false} otherwise
 */
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
    if (Log.isLoggable("Wa-Tor", Log.DEBUG)) {
        Log.d("Wa-Tor", "Got touch event: " + event);
    }
    int paddingLeft = getPaddingLeft();
    int paddingRight = getPaddingRight();
    switch (event.getAction() & MotionEvent.ACTION_MASK) {
    case MotionEvent.ACTION_DOWN:
        touchEventStartTime = System.currentTimeMillis();
        valueBeforeDragging = value;
        activePointerId = event.getPointerId(0);
        float valuePos = positionFromValue(paddingLeft, paddingRight);
        float x = event.getX();
        if (x < valuePos - thumbSize / 2 || x > valuePos + thumbSize / 2) {
            int newValue = valueFromPosition(x, paddingLeft, paddingRight);
            if (Log.isLoggable("Wa-Tor", Log.DEBUG)) {
                Log.d("Wa-Tor", "Starting to drag thumb OUTSIDE of thumb");
            }
            if (newValue != value) {
                touchEventStartTime = 0L; // Not a click
                updateValue(newValue, true /* from user */);
            }
            touchOffset = 0f;
        } else {
            touchOffset = x - valuePos;
            if (Log.isLoggable("Wa-Tor", Log.DEBUG)) {
                Log.d("Wa-Tor", "Starting to drag thumb INSIDE of thumb; offset = " + touchOffset);
            }
        }
        isDragging = true;
        return true;
    case MotionEvent.ACTION_MOVE:
        if (activePointerId != -1) {
            final int pointerIndex = event.findPointerIndex(activePointerId);
            float currentPos = event.getX(pointerIndex) - touchOffset;
            int newValue = valueFromPosition(currentPos, paddingLeft, paddingRight);
            if (newValue != value) {
                if (Log.isLoggable("Wa-Tor", Log.DEBUG)) {
                    Log.d("Wa-Tor", "Got new value " + newValue + " (old = " + value + ")");
                }
                touchEventStartTime = 0L; // Not a click
                updateValue(newValue, true /* from user */);
            }
        }
        return true;
    case MotionEvent.ACTION_UP:
        if (touchEventStartTime > 0L && System.currentTimeMillis() - touchEventStartTime < MAX_CLICK_DURATION) {
            performClick();
        }
        isDragging = false;
        break;
    case MotionEvent.ACTION_CANCEL:
        isDragging = false;
        updateValue(valueBeforeDragging, true /* from user */);
        break;
    case MotionEvent.ACTION_POINTER_UP:
        isDragging = false;
        break;
    }

    return super.onTouchEvent(event);
}

From source file:com.com.mytoolsproject.SwipeRefreshLayout.java

private void onSecondaryPointerUp(MotionEvent ev) {
    final int pointerIndex = MotionEventCompat.getActionIndex(ev);
    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;
        mActivePointerId = ev.getPointerId(newPointerIndex);
    }/*from w w  w  . j a v  a 2s  .co  m*/
}

From source file:com.ymsfd.practices.ui.widget.SwipeRefreshLayout.java

private void onSecondaryPointerUp(MotionEvent ev) {
    final int pointerIndex = MotionEventCompat.getActionIndex(ev);
    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;
        mActivePointerId = ev.getPointerId(newPointerIndex);
        D("onSecondaryPointerUp");
    }//from ww w  .  j  a  va  2 s  .com
}

From source file:com.tasomaniac.openwith.resolver.ResolverDrawerLayout.java

@Override
public boolean onTouchEvent(MotionEvent ev) {
    final int action = MotionEventCompat.getActionMasked(ev);

    mVelocityTracker.addMovement(ev);//from  w w w  . j  a  va2  s  . c  o m

    boolean handled = false;
    switch (action) {
    case MotionEvent.ACTION_DOWN: {
        final float x = ev.getX(0);
        final float y = ev.getY(0);
        mInitialTouchX = x;
        mInitialTouchY = mLastTouchY = y;
        mActivePointerId = ev.getPointerId(0);
        final boolean hitView = findChildUnder(mInitialTouchX, mInitialTouchY) != null;
        handled = (!hitView && mOnDismissedListener != null) || mCollapsibleHeight > 0;
        mIsDragging = hitView && handled;
        abortAnimation();
    }
        break;

    case MotionEvent.ACTION_MOVE: {
        int index = ev.findPointerIndex(mActivePointerId);
        if (index < 0) {
            Timber.e("Bad pointer id %d, resetting", mActivePointerId);
            index = 0;
            mActivePointerId = ev.getPointerId(0);
            mInitialTouchX = ev.getX(0);
            mInitialTouchY = mLastTouchY = ev.getY(0);
        }
        final float x = ev.getX(index);
        final float y = ev.getY(index);
        if (!mIsDragging) {
            final float dy = y - mInitialTouchY;
            if (Math.abs(dy) > mTouchSlop && findChildUnder(x, y) != null) {
                handled = mIsDragging = true;
                mLastTouchY = Math.max(mLastTouchY - mTouchSlop,
                        Math.min(mLastTouchY + dy, mLastTouchY + mTouchSlop));
            }
        }
        if (mIsDragging) {
            final float dy = y - mLastTouchY;
            performDrag(dy);
        }
        mLastTouchY = y;
    }
        break;

    case MotionEvent.ACTION_POINTER_DOWN: {
        final int pointerIndex = MotionEventCompat.getActionIndex(ev);

        mActivePointerId = ev.getPointerId(pointerIndex);
        mInitialTouchX = ev.getX(pointerIndex);
        mInitialTouchY = mLastTouchY = ev.getY(pointerIndex);
    }
        break;

    case MotionEvent.ACTION_POINTER_UP: {
        onSecondaryPointerUp(ev);
    }
        break;

    case MotionEvent.ACTION_UP: {
        final boolean wasDragging = mIsDragging;
        mIsDragging = false;
        if (!wasDragging && findChildUnder(mInitialTouchX, mInitialTouchY) == null
                && findChildUnder(ev.getX(0), ev.getY(0)) == null) {
            if (mOnDismissedListener != null) {
                dispatchOnDismissed();
                resetTouch();
                return true;
            }
        }
        if (mOpenOnClick && Math.abs(ev.getX(0) - mInitialTouchX) < mTouchSlop
                && Math.abs(ev.getY(0) - mInitialTouchY) < mTouchSlop) {
            smoothScrollTo(0, 0);
            return true;
        }
        mVelocityTracker.computeCurrentVelocity(1000);
        final float yvel = VelocityTrackerCompat.getYVelocity(mVelocityTracker, mActivePointerId);
        if (Math.abs(yvel) > mMinFlingVelocity) {
            if (mOnDismissedListener != null && yvel > 0 && mCollapseOffset > mCollapsibleHeight) {
                smoothScrollTo(mCollapsibleHeight + mUncollapsibleHeight, yvel);
                mDismissOnScrollerFinished = true;
            } else {
                smoothScrollTo(yvel < 0 ? 0 : mCollapsibleHeight, yvel);
            }
        } else {
            smoothScrollTo(mCollapseOffset < mCollapsibleHeight / 2 ? 0 : mCollapsibleHeight, 0);
        }
        resetTouch();
    }
        break;

    case MotionEvent.ACTION_CANCEL: {
        if (mIsDragging) {
            smoothScrollTo(mCollapseOffset < mCollapsibleHeight / 2 ? 0 : mCollapsibleHeight, 0);
        }
        resetTouch();
        return true;
    }
    }

    return handled;
}

From source file:com.lovejjfg.powerrefresh.PowerRefreshLayout.java

@Override
public boolean onTouchEvent(MotionEvent ev) {
    final int action = MotionEventCompat.getActionMasked(ev);
    int pointerIndex;

    if (!isEnabled() || !canChildScrollUp() || isLoading || isRefreshing || mNestedScrollInProgress) {
        // Fail fast if we're not in a state where a swipe is possible
        return false;
    }//www .jav a  2  s  . co m

    switch (action) {
    case MotionEvent.ACTION_DOWN:
        mActivePointerId = ev.getPointerId(0);
        mIsBeingDragged = false;
        break;

    case MotionEvent.ACTION_MOVE: {
        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            return false;
        }

        final float y = ev.getY(pointerIndex);
        startDragging(y);
        //in this case ,just can refresh.
        if (mIsBeingDragged) {
            final float overscrollTop = (y - mInitialMotionY);
            if (overscrollTop < 0 && getScrollY() > 0) {
                ev.setAction(MotionEvent.ACTION_CANCEL);
                return false;
            }
            currentStatus = STATE_REFRESH;
            goToRefresh((int) overscrollTop);
        }
        mInitialMotionY = y;
        break;
    }
    case MotionEventCompat.ACTION_POINTER_DOWN: {
        pointerIndex = MotionEventCompat.getActionIndex(ev);
        if (pointerIndex < 0) {
            return false;
        }
        mActivePointerId = ev.getPointerId(pointerIndex);
        break;
    }

    //            case MotionEventCompat.ACTION_POINTER_UP:
    //                onSecondaryPointerUp(ev);
    //                break;

    case MotionEvent.ACTION_UP: {
        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            return false;
        }

        if (mIsBeingDragged) {
            mIsBeingDragged = false;
            resetScroll();
        }
        mActivePointerId = INVALID_POINTER;
        return false;
    }
    case MotionEvent.ACTION_CANCEL:
        resetScroll();
        return false;
    }

    return true;
}