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) {
mIcon = icon;
int width = icon.getIntrinsicWidth();
int height = icon.getIntrinsicHeight();
if (width > mMaxIconSize) {
final float scale = (float) mMaxIconSize / width;
width = mMaxIconSize;
height *= scale;
if (icon != null) {
int width = icon.getIntrinsicWidth();
int height = icon.getIntrinsicHeight();
if (width > mMaxIconSize) {
final float scale = (float) mMaxIconSize / width;
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);
updateTextButtonVisibility();