Merge "Fix adjustViewBounds handling for ImageView" into jb-mr1-dev
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user