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

Commit df6ca3cd authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am efb49bd8: Merge "Constrain width and height to >= 0 in FastScroller layout" into mnc-dev

* commit 'efb49bd8':
  Constrain width and height to >= 0 in FastScroller layout
parents fb822963 efb49bd8
Loading
Loading
Loading
Loading
+11 −8
Original line number Original line Diff line number Diff line
@@ -660,10 +660,11 @@ class FastScroller {
            maxWidth = containerWidth - adjacent.getRight();
            maxWidth = containerWidth - adjacent.getRight();
        }
        }


        final int adjMaxHeight = Math.max(0, container.height());
        final int adjMaxWidth = Math.max(0, maxWidth - marginLeft - marginRight);
        final int adjMaxWidth = Math.max(0, maxWidth - marginLeft - marginRight);
        final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
        final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
        final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(container.height(),
        final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(
                MeasureSpec.UNSPECIFIED);
                adjMaxHeight, MeasureSpec.UNSPECIFIED);
        view.measure(widthMeasureSpec, heightMeasureSpec);
        view.measure(widthMeasureSpec, heightMeasureSpec);


        // Align to the left or right.
        // Align to the left or right.
@@ -700,10 +701,11 @@ class FastScroller {


        final Rect container = mContainerRect;
        final Rect container = mContainerRect;
        final int containerWidth = container.width();
        final int containerWidth = container.width();
        final int adjMaxWidth = containerWidth - marginLeft - marginRight;
        final int adjMaxHeight = Math.max(0, container.height());
        final int adjMaxWidth = Math.max(0, containerWidth - marginLeft - marginRight);
        final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
        final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
        final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(container.height(),
        final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(
                MeasureSpec.UNSPECIFIED);
                adjMaxHeight, MeasureSpec.UNSPECIFIED);
        preview.measure(widthMeasureSpec, heightMeasureSpec);
        preview.measure(widthMeasureSpec, heightMeasureSpec);


        // Align at the vertical center, 10% from the top.
        // Align at the vertical center, 10% from the top.
@@ -766,10 +768,11 @@ class FastScroller {
        final View track = mTrackImage;
        final View track = mTrackImage;
        final View thumb = mThumbImage;
        final View thumb = mThumbImage;
        final Rect container = mContainerRect;
        final Rect container = mContainerRect;
        final int maxWidth = container.width();
        final int maxWidth = Math.max(0, container.width());
        final int maxHeight = Math.max(0, container.height());
        final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST);
        final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST);
        final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(container.height(),
        final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(
                MeasureSpec.UNSPECIFIED);
                maxHeight, MeasureSpec.UNSPECIFIED);
        track.measure(widthMeasureSpec, heightMeasureSpec);
        track.measure(widthMeasureSpec, heightMeasureSpec);


        final int top;
        final int top;