diff options
author | Adam Powell <adamp@google.com> | 2011-01-10 17:14:06 -0800 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2011-01-10 17:14:51 -0800 |
commit | f0ad6e6eaf48ac8f4007232ad0a8511a7b5cfc0e (patch) | |
tree | d3818280279c06f0811bc2f8850f647b2396b438 /policy | |
parent | 748ba9a9512dee65d5b09cfe26a34ded753f4aab (diff) | |
download | frameworks_base-f0ad6e6eaf48ac8f4007232ad0a8511a7b5cfc0e.zip frameworks_base-f0ad6e6eaf48ac8f4007232ad0a8511a7b5cfc0e.tar.gz frameworks_base-f0ad6e6eaf48ac8f4007232ad0a8511a7b5cfc0e.tar.bz2 |
Fix bug 3333015 - Overflow menu item submenus do not open
Submenus of action bar menus will open as new menus.
Change-Id: I924b87bbea91b0df5e3608ec894530302c0e1d8d
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 2fcd04e..38eed50 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -26,9 +26,11 @@ import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH; import com.android.internal.view.BaseSurfaceHolder; import com.android.internal.view.RootViewSurfaceTaker; import com.android.internal.view.StandaloneActionMode; +import com.android.internal.view.menu.ActionMenuView; import com.android.internal.view.menu.ContextMenuBuilder; import com.android.internal.view.menu.MenuBuilder; import com.android.internal.view.menu.MenuDialogHelper; +import com.android.internal.view.menu.MenuItemImpl; import com.android.internal.view.menu.MenuPopupHelper; import com.android.internal.view.menu.MenuView; import com.android.internal.view.menu.SubMenuBuilder; @@ -881,12 +883,16 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // The window manager will give us a valid window token new MenuDialogHelper(subMenu).show(null); } else if (hasFeature(FEATURE_ACTION_BAR)) { - mActionButtonPopup = new ActionButtonSubmenu(getContext(), subMenu); - mActionButtonPopup.show(); - Callback cb = getCallback(); - if (cb != null) { - cb.onMenuOpened(FEATURE_ACTION_BAR, subMenu); - } + mDecor.post(new Runnable() { + public void run() { + mActionButtonPopup = new ActionButtonSubmenu(getContext(), subMenu); + mActionButtonPopup.show(); + Callback cb = getCallback(); + if (cb != null) { + cb.onMenuOpened(FEATURE_ACTION_BAR, subMenu); + } + } + }); } return true; @@ -3009,6 +3015,20 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) { super(context, subMenu); mSubMenu = subMenu; + + MenuBuilder parentMenu = subMenu.getRootMenu(); + MenuItemImpl item = (MenuItemImpl) subMenu.getItem(); + if (!item.isActionButton()) { + // Give a reasonable anchor to nested submenus. + ActionMenuView amv = (ActionMenuView) parentMenu.getMenuView( + MenuBuilder.TYPE_ACTION_BUTTON, null); + + View anchor = amv.getOverflowButton(); + if (anchor == null) { + anchor = amv; + } + setAnchorView(anchor); + } } @Override |