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

Commit e421195d authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix for [Horizontal]ScrollView scroll range reporting"

parents cf06dd0a a2f91016
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -890,14 +890,15 @@ public class HorizontalScrollView extends FrameLayout {
     */
    @Override
    protected int computeHorizontalScrollRange() {
        int count = getChildCount();
        final int count = getChildCount();
        final int contentWidth = getWidth() - mPaddingLeft - mPaddingRight;
        if (count == 0) {
            return getWidth();
            return contentWidth;
        }
        
        int scrollRange = getChildAt(0).getRight();
        int scrollX = mScrollX;
        int overscrollRight = scrollRange - getWidth() - mPaddingLeft - mPaddingRight;
        final int scrollX = mScrollX;
        final int overscrollRight = Math.max(0, scrollRange - contentWidth);
        if (scrollX < 0) {
            scrollRange -= scrollX;
        } else if (scrollX > overscrollRight) {
+5 −4
Original line number Diff line number Diff line
@@ -892,14 +892,15 @@ public class ScrollView extends FrameLayout {
     */
    @Override
    protected int computeVerticalScrollRange() {
        int count = getChildCount();
        final int count = getChildCount();
        final int contentHeight = getHeight() - mPaddingBottom - mPaddingTop;
        if (count == 0) {
            return getHeight();
            return contentHeight;
        }
        
        int scrollRange = getChildAt(0).getBottom();
        int scrollY = mScrollY;
        int overscrollBottom = scrollRange - getHeight() - mPaddingBottom - mPaddingTop;
        final int scrollY = mScrollY;
        final int overscrollBottom = Math.max(0, scrollRange - contentHeight);
        if (scrollY < 0) {
            scrollRange -= scrollY;
        } else if (scrollY > overscrollBottom) {