Skip to content

Commit 4bf1b2e

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug 5394020 - Menus are pretty sluggish to bring up"
2 parents 2c4d954 + 8eeb4d1 commit 4bf1b2e

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

core/java/com/android/internal/view/menu/ExpandedMenuView.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ protected void onDetachedFromWindow() {
6363
setChildrenDrawingCacheEnabled(false);
6464
}
6565

66-
@Override
67-
protected boolean recycleOnMeasure() {
68-
return false;
69-
}
70-
7166
public boolean invokeItem(MenuItemImpl item) {
7267
return mMenu.performItemAction(item, 0);
7368
}

core/java/com/android/internal/view/menu/ListMenuItemView.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* The item view for each item in the ListView-based MenuViews.
3535
*/
3636
public class ListMenuItemView extends LinearLayout implements MenuView.ItemView {
37+
private static final String TAG = "ListMenuItemView";
3738
private MenuItemImpl mItemData;
3839

3940
private ImageView mIconView;
@@ -121,27 +122,25 @@ public MenuItemImpl getItemData() {
121122
}
122123

123124
public void setCheckable(boolean checkable) {
124-
125125
if (!checkable && mRadioButton == null && mCheckBox == null) {
126126
return;
127127
}
128128

129-
if (mRadioButton == null) {
130-
insertRadioButton();
131-
}
132-
if (mCheckBox == null) {
133-
insertCheckBox();
134-
}
135-
136129
// Depending on whether its exclusive check or not, the checkbox or
137130
// radio button will be the one in use (and the other will be otherCompoundButton)
138131
final CompoundButton compoundButton;
139132
final CompoundButton otherCompoundButton;
140133

141134
if (mItemData.isExclusiveCheckable()) {
135+
if (mRadioButton == null) {
136+
insertRadioButton();
137+
}
142138
compoundButton = mRadioButton;
143139
otherCompoundButton = mCheckBox;
144140
} else {
141+
if (mCheckBox == null) {
142+
insertCheckBox();
143+
}
145144
compoundButton = mCheckBox;
146145
otherCompoundButton = mRadioButton;
147146
}
@@ -155,12 +154,12 @@ public void setCheckable(boolean checkable) {
155154
}
156155

157156
// Make sure the other compound button isn't visible
158-
if (otherCompoundButton.getVisibility() != GONE) {
157+
if (otherCompoundButton != null && otherCompoundButton.getVisibility() != GONE) {
159158
otherCompoundButton.setVisibility(GONE);
160159
}
161160
} else {
162-
mCheckBox.setVisibility(GONE);
163-
mRadioButton.setVisibility(GONE);
161+
if (mCheckBox != null) mCheckBox.setVisibility(GONE);
162+
if (mRadioButton != null) mRadioButton.setVisibility(GONE);
164163
}
165164
}
166165

0 commit comments

Comments
 (0)