android onTouchEvent how to differ DOWN and swipe
<p>I need to differentiate ACTION.DOWN and ACTION.MOVE event, since swipe action = down + move + cancel; I could not get out of the situation. Any ideas?</p>

<pre><code>@Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (getChildCount() == 0)
            return false;

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

        final int action = ev.getAction();
        final float x = ev.getX();

        switch (action) {
        case MotionEvent.ACTION_DOWN:
            /*
             * If being flinged and user touches, stop the fling. isFinished
             * will be false if being flinged.
             */
            if (!mScroller.isFinished()) {
                mScroller.abortAnimation();
            }

            // Remember where the motion event started
            mLastMotionX = x;

            mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST
                    : TOUCH_STATE_SCROLLING;

            isLights = true;
            Log.v("ABC", "intercept touched down");
            return true;
            //break;


        case MotionEvent.ACTION_UP:
            if (mTouchState == TOUCH_STATE_SCROLLING) {
                final VelocityTracker velocityTracker = mVelocityTracker;
                velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
                int velocityX = (int) velocityTracker.getXVelocity();

                if (velocityX &gt; SNAP_VELOCITY &amp;&amp; mCurrentScreen &gt; 0) {
                    // Fling hard enough to move left
                    snapToScreen(mCurrentScreen - 1);
                } else if (velocityX &lt; -SNAP_VELOCITY
                        &amp;&amp; mCurrentScreen &lt; getChildCount() - 1) {
                    // Fling hard enough to move right
                    snapToScreen(mCurrentScreen + 1);
                } else {
                    snapToDestination();
                }

                if (mVelocityTracker != null) {
                    mVelocityTracker.recycle();
                    mVelocityTracker = null;
                }
            }

            mTouchState = TOUCH_STATE_REST;
            Log.v("ABC", "intercept up");
            break;
        case MotionEvent.ACTION_CANCEL:
            mTouchState = TOUCH_STATE_REST;
        }
        return false;
    }



    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (getChildCount() == 0)
            return false;

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

        final int action = ev.getAction();
        final float x = ev.getX();

        if(isLights) {
            mViewLightsListener.onLightsChanged(mLoadedViews.get(mCurrentBufferIndex));
        }
        isLights = false;
        switch (action) {
        case MotionEvent.ACTION_DOWN:


            /*
             * If being flinged and user touches, stop the fling. isFinished
             * will be false if being flinged.
             */
            if (!mScroller.isFinished()) {
                mScroller.abortAnimation();
            }

            // Remember where the motion event started
            mLastMotionX = x;

            mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST
                    : TOUCH_STATE_SCROLLING;
            Log.v("ABC", "down touched");
            break;

        case MotionEvent.ACTION_MOVE:
            final int xDiff = (int) Math.abs(x - mLastMotionX);

            boolean xMoved = xDiff &gt; mTouchSlop;

            if (xMoved) {
                // Scroll if the user moved far enough along the X axis
                mTouchState = TOUCH_STATE_SCROLLING;
            }

            if (mTouchState == TOUCH_STATE_SCROLLING) {
                // Scroll to follow the motion event
                final int deltaX = (int) (mLastMotionX - x);
                mLastMotionX = x;

                final int scrollX = getScrollX();
                if (deltaX &lt; 0) {
                    if (scrollX &gt; 0) {
                        scrollBy(Math.max(-scrollX, deltaX), 0);
                    }
                } else if (deltaX &gt; 0) {
                    final int availableToScroll = getChildAt(
                            getChildCount() - 1).getRight()
                            - scrollX - getWidth();
                    if (availableToScroll &gt; 0) {
                        scrollBy(Math.min(availableToScroll, deltaX), 0);
                    }
                }
                return true;
            }
            break;

        case MotionEvent.ACTION_UP:
            if (mTouchState == TOUCH_STATE_SCROLLING) {
                final VelocityTracker velocityTracker = mVelocityTracker;
                velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
                int velocityX = (int) velocityTracker.getXVelocity();

                if (velocityX &gt; SNAP_VELOCITY &amp;&amp; mCurrentScreen &gt; 0) {
                    // Fling hard enough to move left
                    snapToScreen(mCurrentScreen - 1);
                } else if (velocityX &lt; -SNAP_VELOCITY
                        &amp;&amp; mCurrentScreen &lt; getChildCount() - 1) {
                    // Fling hard enough to move right
                    snapToScreen(mCurrentScreen + 1);
                } else {
                    snapToDestination();
                }

                if (mVelocityTracker != null) {
                    mVelocityTracker.recycle();
                    mVelocityTracker = null;
                }
            }

            mTouchState = TOUCH_STATE_REST;

            break;
        case MotionEvent.ACTION_CANCEL:
            snapToDestination();
            mTouchState = TOUCH_STATE_REST;
        }
        return true;
    }
</code></pre>

<p>I have viewFlow that contains webViews and with swipe current webview changes, on the other hand onDown I hide/show action bar. But now, while I swiping actionbar hiding/showing unwantedly.</p>
