Bug 857816: menu.remove() should remove a submenu's menu item too. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Wed, 03 Apr 2013 15:29:21 -0700
changeset 137713 342b14e63229a20547ff17a040bf4fa186a44a35
parent 137712 174d9a722a5a81db3c2a1b2546a3e53a941fadf8
child 137714 09a18d4a9c0e2bdfc35ca431de0b7b2d93fde5ed
push id30664
push usersramasubramanian@mozilla.com
push dateTue, 09 Jul 2013 06:00:03 +0000
treeherdermozilla-inbound@09a18d4a9c0e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs857816
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 857816: menu.remove() should remove a submenu's menu item too. [r=mfinkle]
mobile/android/base/menu/GeckoMenu.java
--- a/mobile/android/base/menu/GeckoMenu.java
+++ b/mobile/android/base/menu/GeckoMenu.java
@@ -293,16 +293,28 @@ public class GeckoMenu extends ListView
     }
 
     @Override
     public void removeItem(int id) {
         GeckoMenuItem item = (GeckoMenuItem) findItem(id);
         if (item == null)
             return;
 
+        // Remove it from any sub-menu.
+        for (GeckoMenuItem menuItem : mItems) {
+            if (menuItem.hasSubMenu()) {
+                SubMenu subMenu = menuItem.getSubMenu();
+                if (subMenu != null && subMenu.findItem(id) != null) {
+                    subMenu.removeItem(id);
+                    return;
+                }
+            }
+        }
+
+        // Remove it from own menu.
         if (mActionItems.containsKey(item)) {
             if (mActionItemBarPresenter != null)
                 mActionItemBarPresenter.removeActionItem(mActionItems.get(item));
 
             mActionItems.remove(item);
             mItems.remove(item);
 
             if (mActionItems.size() == 0 &&