Bug 881507: NoSuchMethodError on MenuItem. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Tue, 11 Jun 2013 10:47:30 -0700
changeset 146323 095b953d91b934c5d48d97e43cbb48b7346a3bbe
parent 146322 976ad4d018340260449bbb9967830d9396350bd8
child 146324 702e35c02b970dbb9bac23f93b684f4155e7cff7
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs881507
milestone24.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 881507: NoSuchMethodError on MenuItem. [r=mfinkle]
mobile/android/base/menu/GeckoMenu.java
mobile/android/base/menu/GeckoMenuItem.java
--- a/mobile/android/base/menu/GeckoMenu.java
+++ b/mobile/android/base/menu/GeckoMenu.java
@@ -239,17 +239,17 @@ public class GeckoMenu extends ListView
     }
 
     @Override
     public MenuItem findItem(int id) {
         for (GeckoMenuItem menuItem : mItems) {
             if (menuItem.getItemId() == id) {
                 return menuItem;
             } else if (menuItem.hasSubMenu()) {
-                if (menuItem.getActionProvider() == null) {
+                if (!menuItem.hasActionProvider()) {
                     SubMenu subMenu = menuItem.getSubMenu();
                     MenuItem item = subMenu.findItem(id);
                     if (item != null)
                         return item;
                 }
             }
         }
         return null;
--- a/mobile/android/base/menu/GeckoMenuItem.java
+++ b/mobile/android/base/menu/GeckoMenuItem.java
@@ -3,16 +3,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.menu;
 
 import org.mozilla.gecko.widget.GeckoActionProvider;
 
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
+import android.os.Build;
 import android.view.ActionProvider;
 import android.view.ContextMenu;
 import android.view.MenuItem;
 import android.view.SubMenu;
 import android.view.View;
 
 public class GeckoMenuItem implements MenuItem {
     private static final String LOGTAG = "GeckoMenuItem";
@@ -65,16 +66,24 @@ public class GeckoMenuItem implements Me
         return false;
     }
 
     @Override
     public boolean expandActionView() {
         return false;
     }
 
+    public boolean hasActionProvider() {
+        if (Build.VERSION.SDK_INT < 14) {
+            return false;
+        }
+
+        return (mActionProvider != null);
+    }
+
     @Override
     public ActionProvider getActionProvider() {
         return mActionProvider;
     }
 
     @Override
     public View getActionView() {
         if (mActionProvider != null && mActionProvider instanceof GeckoActionProvider) {