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

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

Merge "Fix adjustViewBounds handling for ImageView" into jb-mr1-dev

parents be290dd8 d5edc772
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17208,7 +17208,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
         * @return the measure specification based on size and mode
         */
        public static int makeMeasureSpec(int size, int mode) {
            return size + mode;
            return (size & ~MODE_MASK) | (mode & MODE_MASK);
        }
        /**
+13 −0
Original line number Diff line number Diff line
@@ -789,6 +789,12 @@ public class ImageView extends View {
                    if (resizeWidth) {
                        int newWidth = (int)(desiredAspect * (heightSize - ptop - pbottom)) +
                                pleft + pright;

                        // Allow the width to outgrow its original estimate if height is fixed.
                        if (!resizeHeight) {
                            widthSize = resolveAdjustedSize(newWidth, mMaxWidth, widthMeasureSpec);
                        }

                        if (newWidth <= widthSize) {
                            widthSize = newWidth;
                            done = true;
@@ -799,6 +805,13 @@ public class ImageView extends View {
                    if (!done && resizeHeight) {
                        int newHeight = (int)((widthSize - pleft - pright) / desiredAspect) +
                                ptop + pbottom;

                        // Allow the height to outgrow its original estimate if width is fixed.
                        if (!resizeWidth) {
                            heightSize = resolveAdjustedSize(newHeight, mMaxHeight,
                                    heightMeasureSpec);
                        }

                        if (newHeight <= heightSize) {
                            heightSize = newHeight;
                        }