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.linkbubble.ui.BubbleFlowView.java

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {

    final int action = event.getAction();
    if ((action == MotionEvent.ACTION_MOVE) && mInterceptingTouch && mTouchInterceptor != null) {
        return true;
    }/*from www.  j  av a2  s.  c om*/

    switch (action & MotionEvent.ACTION_MASK) {
    case MotionEvent.ACTION_MOVE:
        if (mActiveTouchPointerId == INVALID_POINTER) {
            // If we don't have a valid id, the touch down wasn't on content.
            break;
        }

        final int pointerIndex = event.findPointerIndex(mActiveTouchPointerId);
        if (pointerIndex == -1) {
            Log.e(TAG, "Invalid pointerId=" + mActiveTouchPointerId + " in onInterceptTouchEvent");
            break;
        }

        final int y = (int) event.getY(pointerIndex);
        final int yDiff = Math.abs(y - mLastMotionY);
        if (yDiff > 0) {
            mLastMotionY = y;
            // Here is the crux of it all...
            if (mTouchInterceptor != null) {
                mInterceptingTouch = true;
            }
        }

    case MotionEvent.ACTION_DOWN:
        // ACTION_DOWN always refers to pointer index 0.
        mLastMotionY = (int) event.getY();
        mActiveTouchPointerId = event.getPointerId(0);
        break;

    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
        if (!mInterceptingTouch && mLongPress) {
            final float bubblePeriod = (float) Constant.BUBBLE_FLOW_ANIM_TIME / 1000.f;
            final float contentPeriod = bubblePeriod * 0.666667f; // 0.66667 is the normalized t value when f = 1.0f for overshoot interpolator of 0.5 tension
            MainController.get().expandBubbleFlow((long) (contentPeriod * 1000), false);
        }
        mActiveTouchPointerId = INVALID_POINTER;
        mInterceptingTouch = false;
        break;
    }

    if (super.onInterceptTouchEvent(event)) {
        return true;
    }

    return mInterceptingTouch;
}

From source file:com.cyanogenmod.filemanager.ui.widgets.ViewDragHelper.java

/**
 * Process a touch event received by the parent view. This method will dispatch callback events
 * as needed before returning. The parent view's onTouchEvent implementation should call this.
 *
 * @param ev The touch event received by the parent view
 *///from w  w w. j a  v  a  2s  .c om
public void processTouchEvent(MotionEvent ev) {
    final int action = ev.getActionMasked();
    final int actionIndex = ev.getActionIndex();

    if (action == MotionEvent.ACTION_DOWN) {
        // Reset things for a new event stream, just in case we didn't get
        // the whole previous stream.
        cancel();
    }

    if (mVelocityTracker == null) {
        mVelocityTracker = VelocityTracker.obtain();
    }
    mVelocityTracker.addMovement(ev);

    switch (action) {
    case MotionEvent.ACTION_DOWN: {
        final float x = ev.getX();
        final float y = ev.getY();
        final int pointerId = ev.getPointerId(0);
        final View toCapture = findTopChildUnder((int) x, (int) y);

        saveInitialMotion(x, y, pointerId);

        // Since the parent is already directly processing this touch event,
        // there is no reason to delay for a slop before dragging.
        // Start immediately if possible.
        tryCaptureViewForDrag(toCapture, pointerId);

        final int edgesTouched = mInitialEdgesTouched[pointerId];
        if ((edgesTouched & mTrackingEdges) != 0) {
            mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId);
        }
        break;
    }

    case MotionEvent.ACTION_POINTER_DOWN: {
        final int pointerId = ev.getPointerId(actionIndex);
        final float x = ev.getX(actionIndex);
        final float y = ev.getY(actionIndex);

        saveInitialMotion(x, y, pointerId);

        // A ViewDragHelper can only manipulate one view at a time.
        if (mDragState == STATE_IDLE) {
            // If we're idle we can do anything! Treat it like a normal down event.

            final View toCapture = findTopChildUnder((int) x, (int) y);
            tryCaptureViewForDrag(toCapture, pointerId);

            final int edgesTouched = mInitialEdgesTouched[pointerId];
            if ((edgesTouched & mTrackingEdges) != 0) {
                mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId);
            }
        } else if (isCapturedViewUnder((int) x, (int) y)) {
            // We're still tracking a captured view. If the same view is under this
            // point, we'll swap to controlling it with this pointer instead.
            // (This will still work if we're "catching" a settling view.)

            tryCaptureViewForDrag(mCapturedView, pointerId);
        }
        break;
    }

    case MotionEvent.ACTION_MOVE: {
        if (mDragState == STATE_DRAGGING) {
            final int index = ev.findPointerIndex(mActivePointerId);
            final float x = ev.getX(index);
            final float y = ev.getY(index);
            final int idx = (int) (x - mLastMotionX[mActivePointerId]);
            final int idy = (int) (y - mLastMotionY[mActivePointerId]);

            dragTo(mCapturedView.getLeft() + idx, mCapturedView.getTop() + idy, idx, idy);

            saveLastMotion(ev);
        } else {
            // Check to see if any pointer is now over a draggable view.
            final int pointerCount = ev.getPointerCount();
            for (int i = 0; i < pointerCount; i++) {
                final int pointerId = ev.getPointerId(i);
                final float x = ev.getX(i);
                final float y = ev.getY(i);
                final float dx = x - mInitialMotionX[pointerId];
                final float dy = y - mInitialMotionY[pointerId];

                reportNewEdgeDrags(dx, dy, pointerId);
                if (mDragState == STATE_DRAGGING) {
                    // Callback might have started an edge drag.
                    break;
                }

                final View toCapture = findTopChildUnder((int) x, (int) y);
                if (checkTouchSlop(toCapture, dx, dy) && tryCaptureViewForDrag(toCapture, pointerId)) {
                    break;
                }
            }
            saveLastMotion(ev);
        }
        break;
    }

    case MotionEvent.ACTION_POINTER_UP: {
        final int pointerId = ev.getPointerId(actionIndex);
        if (mDragState == STATE_DRAGGING && pointerId == mActivePointerId) {
            // Try to find another pointer that's still holding on to the captured view.
            int newActivePointer = INVALID_POINTER;
            final int pointerCount = ev.getPointerCount();
            for (int i = 0; i < pointerCount; i++) {
                final int id = ev.getPointerId(i);
                if (id == mActivePointerId) {
                    // This one's going away, skip.
                    continue;
                }

                final float x = ev.getX(i);
                final float y = ev.getY(i);
                if (findTopChildUnder((int) x, (int) y) == mCapturedView
                        && tryCaptureViewForDrag(mCapturedView, id)) {
                    newActivePointer = mActivePointerId;
                    break;
                }
            }

            if (newActivePointer == INVALID_POINTER) {
                // We didn't find another pointer still touching the view, release it.
                releaseViewForPointerUp();
            }
        }
        clearMotionHistory(pointerId);
        break;
    }

    case MotionEvent.ACTION_UP: {
        if (mDragState == STATE_DRAGGING) {
            releaseViewForPointerUp();
        }
        cancel();
        break;
    }

    case MotionEvent.ACTION_CANCEL: {
        if (mDragState == STATE_DRAGGING) {
            dispatchViewReleased(0, 0);
        }
        cancel();
        break;
    }
    }
}

From source file:android.support.design.widget.SheetBehavior.java

@Override
public boolean onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) {
    if (!child.isShown()) {
        return false;
    }//w ww  .j  av a  2  s .co m
    int action = MotionEventCompat.getActionMasked(event);
    // Record the velocity
    if (action == MotionEvent.ACTION_DOWN) {
        reset();
    }
    if (mVelocityTracker == null) {
        mVelocityTracker = VelocityTracker.obtain();
    }
    mVelocityTracker.addMovement(event);
    switch (action) {
    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL:
        mTouchingScrollingChild = false;
        mActivePointerId = MotionEvent.INVALID_POINTER_ID;
        // Reset the ignore flag
        if (mIgnoreEvents) {
            mIgnoreEvents = false;
            return false;
        }
        break;
    case MotionEvent.ACTION_DOWN:
        mInitialY = (int) event.getY();
        int initialX = (int) event.getX();
        View scroll = mNestedScrollingChildRef.get();
        if (scroll != null && parent.isPointInChildBounds(scroll, initialX, mInitialY)) {
            mActivePointerId = event.getPointerId(event.getActionIndex());
            mTouchingScrollingChild = true;
        }
        mIgnoreEvents = mActivePointerId == MotionEvent.INVALID_POINTER_ID
                && !parent.isPointInChildBounds(child, initialX, mInitialY);
        break;
    }
    if (!mIgnoreEvents && mViewDragHelper.shouldInterceptTouchEvent(event)) {
        return true;
    }
    // We have to handle cases that the ViewDragHelper does not capture the bottom sheet because
    // it is not the top most view of its parent. This is not necessary when the touch event is
    // happening over the scrolling content as nested scrolling logic handles that case.
    View scroll = mNestedScrollingChildRef.get();
    return action == MotionEvent.ACTION_MOVE && scroll != null && !mIgnoreEvents && mState != STATE_DRAGGING
            && !parent.isPointInChildBounds(scroll, (int) event.getX(), (int) event.getY())
            && Math.abs(mInitialY - event.getY()) > mViewDragHelper.getTouchSlop();
}

From source file:org.alex.refreshlayout.RefreshLayout.java

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

    if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
        mReturningToStart = false;// www  .j ava  2s .  c om
    }

    if (!isEnabled() || mReturningToStart || canChildScrollUp() || isRefreshing() || nestedScrollInProgress) {
        // Fail fast if we're not in a state where a swipe is possible
        return false;
    }

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

    case MotionEvent.ACTION_MOVE: {
        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            Log.e(LOG_TAG, "Got ACTION_MOVE event but have an invalid active pointer id.");
            return false;
        }

        final float y = ev.getY(pointerIndex);
        startDragging(y);

        if (isBeingDragged) {
            final float overScrollTop = (y - mInitialMotionY) * DRAG_RATE;
            if (overScrollTop > 0 && !isLoadingMore()) {
                //LogUtil.e("onTouchEvent ... ");
                moveHead(overScrollTop);
            } else {
                return false;
            }
        }
        break;
    }
    case MotionEventCompat.ACTION_POINTER_DOWN: {
        pointerIndex = MotionEventCompat.getActionIndex(ev);
        if (pointerIndex < 0) {
            Log.e(LOG_TAG, "Got ACTION_POINTER_DOWN event but have an invalid action index.");
            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) {
            Log.e(LOG_TAG, "Got ACTION_UP event but don't have an active pointer id.");
            return false;
        }
        if (isBeingDragged) {
            final float y = ev.getY(pointerIndex);
            final float overScrollTop = (y - mInitialMotionY) * DRAG_RATE;
            isBeingDragged = false;
            //LogUtil.e("currentTargetOffsetTop = " + currentTargetOffsetTop);
            finishHead(overScrollTop);
        }
        mActivePointerId = INVALID_POINTER;
        return false;
    }
    case MotionEvent.ACTION_CANCEL:
        return false;
    }

    return true;
}

From source file:com.melolchik.bullshitbingo.ui.views.swipe.BottomSwipeRefreshLayout.java

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    ensureTarget();//from w ww.  ja  v a 2  s .  c  o m

    final int action = MotionEventCompat.getActionMasked(ev);
    int pointerIndex;

    if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
        mReturningToStart = false;
    }

    //log("onInterceptTouchEvent mNestedScrollInProgress = " + mNestedScrollInProgress);
    // log("canChildScrollDown() = " + canChildScrollDown());
    if (!isEnabled() || mReturningToStart || canChildScrollDown() || mRefreshing || mNestedScrollInProgress) {
        // Fail fast if we're not in a state where a swipe is possible
        //log("onInterceptTouchEvent false action = " + action);
        return false;
    }

    //log("onInterceptTouchEvent cant scroll down action = " + action);
    switch (action) {
    case MotionEvent.ACTION_DOWN:
        setTargetOffsetTopAndBottom(0/*mOriginalOffsetTop + mCircleView.getTop()*/, true);
        mActivePointerId = ev.getPointerId(0);
        mIsBeingDragged = false;

        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            return false;
        }
        mInitialDownY = ev.getY(pointerIndex);
        break;

    case MotionEvent.ACTION_MOVE:
        //log("ACTION_MOVE");
        if (mActivePointerId == INVALID_POINTER) {
            log("ACTION_MOVE Got ACTION_MOVE event but don't have an active pointer id.");
            return false;
        }

        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            log("ACTION_MOVE pointerIndex < 0");
            return false;
        }
        final float y = ev.getY(pointerIndex);
        startDragging(y);
        break;

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

    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL:
        mIsBeingDragged = false;
        mActivePointerId = INVALID_POINTER;
        break;
    }

    return mIsBeingDragged;
}

From source file:org.alex.swiperefreshlayout.SwipeRefreshLayout.java

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

    if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
        mReturningToStart = false;//  w  w w .j  a v  a2  s  .c  o m
    }

    if (!isEnabled() || mReturningToStart || canChildScrollUp() || isRefreshing() || nestedScrollInProgress) {
        // Fail fast if we're not in a state where a swipe is possible
        return false;
    }

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

    case MotionEvent.ACTION_MOVE: {
        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            Log.e(LOG_TAG, "Got ACTION_MOVE event but have an invalid active pointer id.");
            return false;
        }

        final float y = ev.getY(pointerIndex);
        startDragging(y);

        if (isBeingDragged) {
            final float overScrollTop = (y - mInitialMotionY) * DRAG_RATE;
            if (overScrollTop > 0 && !isLoadingMore()) {
                //LogUtil.e("onTouchEvent ... ");
                moveHead(overScrollTop);
            } else {
                return false;
            }
        }
        break;
    }
    case MotionEventCompat.ACTION_POINTER_DOWN: {
        pointerIndex = MotionEventCompat.getActionIndex(ev);
        if (pointerIndex < 0) {
            Log.e(LOG_TAG, "Got ACTION_POINTER_DOWN event but have an invalid action index.");
            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) {
            Log.e(LOG_TAG, "Got ACTION_UP event but don't have an active pointer id.");
            return false;
        }
        if (isBeingDragged) {
            final float y = ev.getY(pointerIndex);
            final float overScrollTop = (y - mInitialMotionY) * DRAG_RATE;
            isBeingDragged = false;
            LogUtil.e("currentTargetOffsetTop = " + currentTargetOffsetTop);
            finishHead(overScrollTop);
        }
        mActivePointerId = INVALID_POINTER;
        return false;
    }
    case MotionEvent.ACTION_CANCEL:
        return false;
    }

    return true;
}

From source file:com.hippo.widget.BothScrollView.java

private void onSecondaryPointerUp(MotionEvent ev) {
    final int pointerIndex = (ev.getAction()
            & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_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.
        // TODO: Make this decision more intelligent.
        final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
        mLastMotionX = (int) ev.getY(newPointerIndex);
        mLastMotionY = (int) ev.getY(newPointerIndex);
        mActivePointerId = ev.getPointerId(newPointerIndex);
        if (mVelocityTracker != null) {
            mVelocityTracker.clear();/*from www .  j  a  v  a 2 s .c o m*/
        }
    }
}

From source file:org.alex.refreshlayout.RefreshLayout.java

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    ensureTarget();/*from  w  ww  .  java 2  s .co m*/
    final int action = MotionEventCompat.getActionMasked(ev);
    int pointerIndex;

    if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
        mReturningToStart = false;
    }

    if (!isEnabled() || mReturningToStart || canChildScrollUp() || isRefreshing() || nestedScrollInProgress) {
        // Fail fast if we're not in a state where a swipe is possible
        return false;
    }

    switch (action) {
    case MotionEvent.ACTION_DOWN:
        if (!isLoadingMore()) {
            setTargetOffsetTopAndBottom(originalOffsetTop - circleView.getTop(), true);
        }
        mActivePointerId = ev.getPointerId(0);
        isBeingDragged = false;

        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            return false;
        }
        mInitialDownY = ev.getY(pointerIndex);
        break;

    case MotionEvent.ACTION_MOVE:
        if (mActivePointerId == INVALID_POINTER) {
            Log.e(LOG_TAG, "Got ACTION_MOVE event but don't have an active pointer id.");
            return false;
        }

        pointerIndex = ev.findPointerIndex(mActivePointerId);
        if (pointerIndex < 0) {
            return false;
        }
        final float y = ev.getY(pointerIndex);
        startDragging(y);
        break;

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

    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL:
        isBeingDragged = false;
        mActivePointerId = INVALID_POINTER;
        break;
    }

    return isBeingDragged;
}

From source file:com.doubleTwist.drawerlib.ADrawerLayout.java

private int preProcessScrollMotionEvent(MotionEvent ev) {
    final int action = MotionEventCompat.getActionMasked(ev);

    switch (action) {
    case MotionEvent.ACTION_DOWN:
        if (DEBUG_TOUCH)
            Log.d(TAG, "DOWN: " + ev.getX(0) + "," + ev.getY(0));
        if (!mIsScrolling) {
            mVelocityTracker.clear();/*from   ww  w.  j a va2s.c om*/
            mDownEvent.mCoords.x = ev.getX(0);
            mDownEvent.mCoords.y = ev.getY(0);
            mDownEvent.mPointerId = ev.getPointerId(0);
            if (DEBUG_TOUCH)
                Log.d(TAG, "SAVED: " + ev.getX(0) + "," + ev.getY(0));
        }
        break;
    case MotionEvent.ACTION_MOVE: {
        final int ptrIdx = ev.findPointerIndex(mDownEvent.mPointerId);
        if (ptrIdx < 0 || ptrIdx >= ev.getPointerCount())
            return -1;

        if (DEBUG_TOUCH)
            Log.d(TAG, "MOVE: " + ev.getX(ptrIdx) + "," + ev.getY(ptrIdx));
        if (mIsScrolling) {
            return mDrawerState.mActiveDrawer;
        }

        // If the user has dragged her finger horizontally more than
        // the touch slop, start the scroll

        final float xDiff = calculateDistanceX(ev, mDownEvent);
        final float yDiff = calculateDistanceY(ev, mDownEvent);
        final float dxAbs = Math.abs(xDiff);
        final float dyAbs = Math.abs(yDiff);

        if (DEBUG_TOUCH) {
            Log.d(TAG, "xDiff: " + xDiff + " -- " + ev.getX(ptrIdx) + " -- " + mDownEvent.mCoords.x);
            Log.d(TAG, "xDiff/yDiff/dxAbs/dyAbs: " + xDiff + "/" + yDiff + "/" + dxAbs + "/" + dyAbs);
            Log.d(TAG, "canScrollX/canScrollY: " + canScroll(MotionEvent.AXIS_X, xDiff) + "/"
                    + canScroll(MotionEvent.AXIS_Y, yDiff));
            Log.d(TAG, "activeDrawer/scrollState: " + mDrawerState.mActiveDrawer + "/"
                    + mDrawerState.mScrollState);
        }

        if (dxAbs > dyAbs && dxAbs > mTouchSlop && canScroll(MotionEvent.AXIS_X, xDiff)) {
            if (DEBUG_TOUCH)
                Log.d(TAG, "X axis branch");
            int drawer;
            if (mDrawerState.mActiveDrawer == NO_DRAWER)
                drawer = xDiff > 0 ? LEFT_DRAWER : RIGHT_DRAWER;
            else
                drawer = mDrawerState.mActiveDrawer;
            if (!isInitialPositionValidForDrawer(mDownEvent, drawer))
                drawer = -1;
            return drawer;
        }

        if (dyAbs > dxAbs && dyAbs > mTouchSlop && canScroll(MotionEvent.AXIS_Y, yDiff)) {
            if (DEBUG_TOUCH)
                Log.d(TAG, "Y axis branch");
            int drawer;
            if (mDrawerState.mActiveDrawer == NO_DRAWER)
                drawer = yDiff > 0 ? TOP_DRAWER : BOTTOM_DRAWER;
            else
                drawer = mDrawerState.mActiveDrawer;

            if (!isInitialPositionValidForDrawer(mDownEvent, drawer))
                drawer = -1;
            return drawer;
        }

        break;
    }
    }
    return -1;
}

From source file:com.ecom.consumer.customviews.HorizontalListView.java

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    String move = "";
    final int index = getChildIndex((int) ev.getX(), (int) ev.getY());
    // Log.d("onsingleTapclicked", "" + index);
    // If the tap is inside one of the child views, and we are not
    // blocking touches
    //// ww  w.  j  a va 2 s .co  m
    mViewBeingTouched = getChildAt(index);

    switch (ev.getAction()) {
    case MotionEvent.ACTION_DOWN:
        isTouch = true;
        mIsBeingDragged = super.onInterceptTouchEvent(ev);
        mIsDragged = mIsBeingDragged;
        mLastMotionX = ev.getX();
        mActivePointerId = ev.getPointerId(0);
        // final int index = getChildIndex((int) ev.getX(), (int)
        // ev.getY());

        /**
         * show blue
         */
        mGestureListener.showSelected(true);
        if (index >= 0) {
            // Save off view being touched so it can later be released
            mViewBeingTouched = getChildAt(index);
            // System.out.println("HorizontalListView"+" "+mViewBeingTouched.getHeight());
            if (mViewBeingTouched != null) {
                // Set the view as pressed
                mViewBeingTouched.setPressed(true);
                // invalidate();
                refreshDrawableState();
            }
        }
        move = "DOWN" + index;

        break;
    case MotionEvent.ACTION_MOVE:
        final int activePointerId = mActivePointerId;
        if (activePointerId == -1) {
            // If we don't have a valid id, the touch down wasn't on
            // content.
            break;
        }

        unpressTouchedChild();

        final int pointerIndex = ev.findPointerIndex(activePointerId);
        final float x = ev.getX(pointerIndex);
        final int xDiff = (int) Math.abs(x - mLastMotionX);
        if (xDiff > mTouchSlop) {
            mIsBeingDragged = true;

            mLastMotionX = x;
        }
        move = "MOVE";
        // mGestureListener.showSelected(false);
        break;
    case MotionEvent.ACTION_UP:
        mIsBeingDragged = super.onInterceptTouchEvent(ev);
        move = "UP";
        unpressTouchedChild();
        mGestureListener.showSelected(false);
        break;
    case MotionEvent.ACTION_CANCEL:
        move = "CANCEL";
        // mGestureListener.showSelected(false);
        break;
    }
    // System.out.println("HorizontalListView.onInterceptTouchEvent()" +
    // move
    // + mIsBeingDragged);
    return mIsBeingDragged;
}