Skip to content

Commit 6200a4b

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "DO NOT MERGE Cherry pick from ics-mr1 - Bug 5275928 - Don't try to open an overflow menu under invalid circumstances." into ics-mr0
2 parents 5f8b726 + 63464c5 commit 6200a4b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ public boolean showOverflowMenu() {
300300
public boolean hideOverflowMenu() {
301301
if (mPostedOpenRunnable != null && mMenuView != null) {
302302
((View) mMenuView).removeCallbacks(mPostedOpenRunnable);
303+
mPostedOpenRunnable = null;
303304
return true;
304305
}
305306

@@ -653,10 +654,11 @@ public OpenOverflowRunnable(OverflowPopup popup) {
653654

654655
public void run() {
655656
mMenu.changeMenuMode();
656-
if (mPopup.tryShow()) {
657+
final View menuView = (View) mMenuView;
658+
if (menuView != null && menuView.getWindowToken() != null && mPopup.tryShow()) {
657659
mOverflowPopup = mPopup;
658-
mPostedOpenRunnable = null;
659660
}
661+
mPostedOpenRunnable = null;
660662
}
661663
}
662664
}

core/java/com/android/internal/widget/ActionBarContextView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ public void onClick(View v) {
216216
});
217217

218218
final MenuBuilder menu = (MenuBuilder) mode.getMenu();
219+
if (mActionMenuPresenter != null) {
220+
mActionMenuPresenter.dismissPopupMenus();
221+
}
219222
mActionMenuPresenter = new ActionMenuPresenter(mContext);
220223
mActionMenuPresenter.setReserveOverflow(true);
221224

0 commit comments

Comments
 (0)