Code example for Scroller

Methods: abortAnimation, isFinished

0
        final int action = event.getAction();
        final float x = event.getX();
 
        switch (action) {
            case MotionEvent.ACTION_DOWN:
                if (!mScroller.isFinished())
                    mScroller.abortAnimation();
                mLastX = x;
                break; 
            case MotionEvent.ACTION_MOVE:
                int delta = (int) (mLastX - x);
                mLastX = x;
                final int scrollX = getScrollX();
                if (delta < 0) {
                    if (scrollX > 0) {
                        scrollBy(Math.max(-scrollX, delta), 0);
                    } 
                } else if (delta > 0) {
                    final int availableToScroll =
                            getChildAt(getChildCount() - 1).getRight() - scrollX - getWidth();
                    if (availableToScroll > 0) {