Permalink
Browse files

Prevent empty overflow popup when there are no overflow items.

On a device with a hardware menu key, an empty overflow window can be displayed
if there are no items in said overflow menu. This leads to the next user touch
being swallowed in the action of dismissing the invisible window.

http://b.android.com/27986 & https://android-review.googlesource.com/34700
  • Loading branch information...
1 parent 2166221 commit 30c1ded12bfbbf2d7cc9708bbee9f1961cd81fdf @JakeWharton committed Mar 29, 2012
@@ -305,7 +305,7 @@ private View findViewForItem(MenuItem item) {
*/
public boolean showOverflowMenu() {
if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null &&
- mPostedOpenRunnable == null) {
+ mPostedOpenRunnable == null && !mMenu.getNonActionItems().isEmpty()) {
OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true);
mPostedOpenRunnable = new OpenOverflowRunnable(popup);
// Post this for later; we might still need a layout for the anchor to be right.

0 comments on commit 30c1ded

Please sign in to comment.