diff options
author | Adam Powell <adamp@google.com> | 2012-09-28 16:15:35 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-28 16:15:36 -0700 |
commit | 4984ec7222d86a9b507a9961363bf50d2b72df1b (patch) | |
tree | 93e840daaee25dc4c6b9b26f5a08b929930e2329 /core/java | |
parent | be290dd850c8e2c31830e2a87205499586f55353 (diff) | |
parent | d5edc7721791ad807b9a8fbd923b8d6e73c399cc (diff) | |
download | frameworks_base-4984ec7222d86a9b507a9961363bf50d2b72df1b.zip frameworks_base-4984ec7222d86a9b507a9961363bf50d2b72df1b.tar.gz frameworks_base-4984ec7222d86a9b507a9961363bf50d2b72df1b.tar.bz2 |
Merge "Fix adjustViewBounds handling for ImageView" into jb-mr1-dev
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/view/View.java | 2 | ||||
-rw-r--r-- | core/java/android/widget/ImageView.java | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index f9ff865..1c12738 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -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); } /** diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 87396fb..1d465ce 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -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; } |