am 4b941f00: Merge "Fix bug 6906134" into jb-mr1-dev

* commit '4b941f00cd832663a42c8cf0ddb0f97365bfe252':
  Fix bug 6906134
This commit is contained in:
Adam Powell
2012-07-31 11:37:02 -07:00
committed by Android Git Automerger

View File

@@ -141,19 +141,21 @@ public class ActionMenuItemView extends TextView
public void setIcon(Drawable icon) { public void setIcon(Drawable icon) {
mIcon = icon; mIcon = icon;
int width = icon.getIntrinsicWidth(); if (icon != null) {
int height = icon.getIntrinsicHeight(); int width = icon.getIntrinsicWidth();
if (width > mMaxIconSize) { int height = icon.getIntrinsicHeight();
final float scale = (float) mMaxIconSize / width; if (width > mMaxIconSize) {
width = mMaxIconSize; final float scale = (float) mMaxIconSize / width;
height *= scale; width = mMaxIconSize;
height *= scale;
}
if (height > mMaxIconSize) {
final float scale = (float) mMaxIconSize / height;
height = mMaxIconSize;
width *= scale;
}
icon.setBounds(0, 0, width, height);
} }
if (height > mMaxIconSize) {
final float scale = (float) mMaxIconSize / height;
height = mMaxIconSize;
width *= scale;
}
icon.setBounds(0, 0, width, height);
setCompoundDrawables(icon, null, null, null); setCompoundDrawables(icon, null, null, null);
updateTextButtonVisibility(); updateTextButtonVisibility();