Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5446057 authored by Adam Powell's avatar Adam Powell
Browse files

Don't bounce programmatic scrolls of ScrollView and HorizontalScrollView.

parent 1f40f174
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -821,10 +821,13 @@ public class HorizontalScrollView extends FrameLayout {
        }
        long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
        if (duration > ANIMATED_SCROLL_GAP) {
            int width = getWidth() - mPaddingRight - mPaddingLeft;
            int right = getChildAt(0).getWidth();
            mScroller.startScroll(mScrollX, mScrollY, dx, dy,
                    0, Math.max(0, right - width), 0, 0);
            final int width = getWidth() - mPaddingRight - mPaddingLeft;
            final int right = getChildAt(0).getWidth();
            final int maxX = Math.max(0, right - width);
            final int scrollX = mScrollX;
            dx = Math.max(0, Math.min(scrollX + dx, maxX)) - scrollX;

            mScroller.startScroll(scrollX, mScrollY, dx, 0);
            awakenScrollBars(mScroller.getDuration());
            invalidate();
        } else {
+7 −4
Original line number Diff line number Diff line
@@ -823,10 +823,13 @@ public class ScrollView extends FrameLayout {
        }
        long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
        if (duration > ANIMATED_SCROLL_GAP) {
            int height = getHeight() - mPaddingBottom - mPaddingTop;
            int bottom = getChildAt(0).getHeight();
            mScroller.startScroll(mScrollX, mScrollY, dx, dy,
                    0, 0, 0, Math.max(0, bottom - height));
            final int height = getHeight() - mPaddingBottom - mPaddingTop;
            final int bottom = getChildAt(0).getHeight();
            final int maxY = Math.max(0, bottom - height);
            final int scrollY = mScrollY;
            dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;

            mScroller.startScroll(mScrollX, scrollY, 0, dy);
            awakenScrollBars(mScroller.getDuration());
            invalidate();
        } else {