Bug 785246: Replace curves in menu button. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Fri, 31 Aug 2012 12:03:25 -0700
changeset 104047 19b684e81c71d0988c4f6bd5e771cee9c118d0e1
parent 104046 d58c3359c4220fabeea52c54c5b71ef006e855d5
child 104048 98e88977a4b86d354d6f69e0083a158b5da2b8b6
push id14311
push usersramasubramanian@mozilla.com
push dateFri, 31 Aug 2012 19:13:07 +0000
treeherdermozilla-inbound@98e88977a4b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs785246
milestone18.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 785246: Replace curves in menu button. [r=mfinkle]
mobile/android/base/GeckoViewsFactory.java
mobile/android/base/Makefile.in
mobile/android/base/MenuButton.java
mobile/android/base/resources/drawable-hdpi-v11/menu_normal.png
mobile/android/base/resources/drawable-hdpi-v11/menu_pressed.png
mobile/android/base/resources/drawable-land-hdpi-v14/menu_normal.png
mobile/android/base/resources/drawable-land-hdpi-v14/menu_pressed.png
mobile/android/base/resources/drawable-land-mdpi-v14/menu_normal.png
mobile/android/base/resources/drawable-land-mdpi-v14/menu_pressed.png
mobile/android/base/resources/drawable-land-xhdpi-v14/menu_normal.png
mobile/android/base/resources/drawable-land-xhdpi-v14/menu_pressed.png
mobile/android/base/resources/drawable-large-hdpi-v11/menu_normal.png
mobile/android/base/resources/drawable-large-hdpi-v11/menu_pressed.png
mobile/android/base/resources/drawable-large-mdpi-v11/menu_normal.png
mobile/android/base/resources/drawable-large-mdpi-v11/menu_pressed.png
mobile/android/base/resources/drawable-large-xhdpi-v11/menu_normal.png
mobile/android/base/resources/drawable-large-xhdpi-v11/menu_pressed.png
mobile/android/base/resources/drawable-mdpi-v11/menu_normal.png
mobile/android/base/resources/drawable-mdpi-v11/menu_pressed.png
mobile/android/base/resources/drawable-xhdpi-v11/menu_normal.png
mobile/android/base/resources/drawable-xhdpi-v11/menu_pressed.png
mobile/android/base/resources/drawable/menu_button.xml
mobile/android/base/resources/drawable/tabs_button.xml
mobile/android/base/resources/layout-land-v14/browser_toolbar.xml.in
mobile/android/base/resources/layout-land-v14/browser_toolbar_menu.xml.in
mobile/android/base/resources/layout-land-v14/tabs_panel_toolbar_menu.xml
mobile/android/base/resources/layout-large-v11/browser_toolbar_menu.xml.in
mobile/android/base/resources/layout-large-v11/tabs_panel_toolbar_menu.xml
mobile/android/base/resources/layout-xlarge-v11/awesomebar_search.xml.in
mobile/android/base/resources/layout-xlarge-v11/browser_toolbar_menu.xml.in
mobile/android/base/resources/layout/browser_toolbar.xml.in
mobile/android/base/resources/layout/browser_toolbar_menu.xml.in
mobile/android/base/resources/layout/tabs_panel_toolbar_menu.xml
--- a/mobile/android/base/GeckoViewsFactory.java
+++ b/mobile/android/base/GeckoViewsFactory.java
@@ -47,16 +47,18 @@ public final class GeckoViewsFactory imp
             else if (TextUtils.equals(viewName, "BrowserToolbarBackground"))
                 return new BrowserToolbarBackground(context, attrs);
             else if (TextUtils.equals(viewName, "FormAssistPopup"))
                 return new FormAssistPopup(context, attrs);
             else if (TextUtils.equals(viewName, "LinkTextView"))
                 return new LinkTextView(context, attrs);
             else if (TextUtils.equals(viewName, "FindInPageBar"))
                 return new FindInPageBar(context, attrs);
+            else if (TextUtils.equals(viewName, "MenuButton"))
+                return new MenuButton(context, attrs);
             else if (TextUtils.equals(viewName, "TabsButton"))
                 return new TabsButton(context, attrs);
             else if (TextUtils.equals(viewName, "TabsPanel"))
                 return new TabsPanel(context, attrs);
             else if (TextUtils.equals(viewName, "TextSelectionHandle"))
                 return new TextSelectionHandle(context, attrs);
             else if (TextUtils.equals(viewName, "gfx.LayerView"))
                 return new LayerView(context, attrs);
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -84,16 +84,17 @@ FENNEC_JAVA_FILES = \
   GeckoPreferences.java \
   GeckoProfile.java \
   GeckoThread.java \
   GlobalHistory.java \
   GeckoViewsFactory.java \
   InputMethods.java \
   LinkPreference.java \
   LinkTextView.java \
+  MenuButton.java \
   MenuItemActionBar.java \
   MenuItemDefault.java \
   MultiChoicePreference.java \
   NSSBridge.java \
   CustomEditText.java \
   OnInterceptTouchListener.java \
   PrivateDataPreference.java \
   PropertyAnimator.java \
@@ -636,18 +637,16 @@ RES_DRAWABLE_MDPI_V11 = \
   res/drawable-mdpi-v11/ic_menu_find_in_page.png \
   res/drawable-mdpi-v11/ic_menu_forward.png \
   res/drawable-mdpi-v11/ic_menu_reading_list_add.png \
   res/drawable-mdpi-v11/ic_menu_reading_list_remove.png \
   res/drawable-mdpi-v11/ic_menu_reload.png \
   res/drawable-mdpi-v11/ic_menu_save_as_pdf.png \
   res/drawable-mdpi-v11/ic_menu_share.png \
   res/drawable-mdpi-v11/menu.png \
-  res/drawable-mdpi-v11/menu_normal.png \
-  res/drawable-mdpi-v11/menu_pressed.png \
   res/drawable-mdpi-v11/menu_panel_bg.9.png \
   res/drawable-mdpi-v11/menu_popup_bg.9.png \
   res/drawable-mdpi-v11/menu_popup_arrow.png \
   res/drawable-mdpi-v11/menu_item_texture.png \
   res/drawable-mdpi-v11/menu_item_pressed_texture.png \
   res/drawable-mdpi-v11/menu_item_check.png \
   res/drawable-mdpi-v11/tab_new_normal.png \
   res/drawable-mdpi-v11/tab_new_pressed.png \
@@ -664,18 +663,16 @@ RES_DRAWABLE_HDPI_V11 = \
   res/drawable-hdpi-v11/ic_menu_find_in_page.png \
   res/drawable-hdpi-v11/ic_menu_forward.png \
   res/drawable-hdpi-v11/ic_menu_reading_list_add.png \
   res/drawable-hdpi-v11/ic_menu_reading_list_remove.png \
   res/drawable-hdpi-v11/ic_menu_reload.png \
   res/drawable-hdpi-v11/ic_menu_save_as_pdf.png \
   res/drawable-hdpi-v11/ic_menu_share.png \
   res/drawable-hdpi-v11/menu.png \
-  res/drawable-hdpi-v11/menu_normal.png \
-  res/drawable-hdpi-v11/menu_pressed.png \
   res/drawable-hdpi-v11/menu_panel_bg.9.png \
   res/drawable-hdpi-v11/menu_popup_bg.9.png \
   res/drawable-hdpi-v11/menu_popup_arrow.png \
   res/drawable-hdpi-v11/menu_item_texture.png \
   res/drawable-hdpi-v11/menu_item_pressed_texture.png \
   res/drawable-hdpi-v11/menu_item_check.png \
   res/drawable-hdpi-v11/tab_new_normal.png \
   res/drawable-hdpi-v11/tab_new_pressed.png \
@@ -692,18 +689,16 @@ RES_DRAWABLE_XHDPI_V11 = \
   res/drawable-xhdpi-v11/ic_menu_find_in_page.png \
   res/drawable-xhdpi-v11/ic_menu_forward.png \
   res/drawable-xhdpi-v11/ic_menu_reading_list_add.png \
   res/drawable-xhdpi-v11/ic_menu_reading_list_remove.png \
   res/drawable-xhdpi-v11/ic_menu_reload.png \
   res/drawable-xhdpi-v11/ic_menu_save_as_pdf.png \
   res/drawable-xhdpi-v11/ic_menu_share.png \
   res/drawable-xhdpi-v11/menu.png \
-  res/drawable-xhdpi-v11/menu_normal.png \
-  res/drawable-xhdpi-v11/menu_pressed.png \
   res/drawable-xhdpi-v11/menu_panel_bg.9.png \
   res/drawable-xhdpi-v11/menu_popup_bg.9.png \
   res/drawable-xhdpi-v11/menu_popup_arrow.png \
   res/drawable-xhdpi-v11/menu_item_texture.png \
   res/drawable-xhdpi-v11/menu_item_pressed_texture.png \
   res/drawable-xhdpi-v11/menu_item_check.png \
   res/drawable-xhdpi-v11/tab_new_normal.png \
   res/drawable-xhdpi-v11/tab_new_pressed.png \
@@ -722,18 +717,16 @@ RES_DRAWABLE_LAND_MDPI_V14 = \
   res/drawable-land-mdpi-v14/remote_tabs_off.png \
   res/drawable-land-mdpi-v14/remote_tabs_on.png \
   res/drawable-land-mdpi-v14/tab_new.png \
   res/drawable-land-mdpi-v14/tab_new_normal.png \
   res/drawable-land-mdpi-v14/tab_new_pressed.png \
   res/drawable-land-mdpi-v14/tabs_carat.png \
   res/drawable-land-mdpi-v14/urlbar_stop.png \
   res/drawable-land-mdpi-v14/menu.png \
-  res/drawable-land-mdpi-v14/menu_normal.png \
-  res/drawable-land-mdpi-v14/menu_pressed.png \
   res/drawable-land-mdpi-v14/reader.png \
   res/drawable-land-mdpi-v14/site_security_identified.png \
   res/drawable-land-mdpi-v14/site_security_verified.png \
   $(NULL)
 
 RES_DRAWABLE_LAND_HDPI_V14 = \
   res/drawable-land-hdpi-v14/ic_awesomebar_go.png \
   res/drawable-land-hdpi-v14/ic_awesomebar_search.png \
@@ -743,18 +736,16 @@ RES_DRAWABLE_LAND_HDPI_V14 = \
   res/drawable-land-hdpi-v14/remote_tabs_off.png \
   res/drawable-land-hdpi-v14/remote_tabs_on.png \
   res/drawable-land-hdpi-v14/tab_new.png \
   res/drawable-land-hdpi-v14/tab_new_normal.png \
   res/drawable-land-hdpi-v14/tab_new_pressed.png \
   res/drawable-land-hdpi-v14/tabs_carat.png \
   res/drawable-land-hdpi-v14/urlbar_stop.png \
   res/drawable-land-hdpi-v14/menu.png \
-  res/drawable-land-hdpi-v14/menu_normal.png \
-  res/drawable-land-hdpi-v14/menu_pressed.png \
   res/drawable-land-hdpi-v14/reader.png \
   res/drawable-land-hdpi-v14/site_security_identified.png \
   res/drawable-land-hdpi-v14/site_security_verified.png \
   $(NULL)
 
 RES_DRAWABLE_LAND_XHDPI_V14 = \
   res/drawable-land-xhdpi-v14/ic_awesomebar_go.png \
   res/drawable-land-xhdpi-v14/ic_awesomebar_search.png \
@@ -764,18 +755,16 @@ RES_DRAWABLE_LAND_XHDPI_V14 = \
   res/drawable-land-xhdpi-v14/remote_tabs_off.png \
   res/drawable-land-xhdpi-v14/remote_tabs_on.png \
   res/drawable-land-xhdpi-v14/tab_new.png \
   res/drawable-land-xhdpi-v14/tab_new_normal.png \
   res/drawable-land-xhdpi-v14/tab_new_pressed.png \
   res/drawable-land-xhdpi-v14/tabs_carat.png \
   res/drawable-land-xhdpi-v14/urlbar_stop.png \
   res/drawable-land-xhdpi-v14/menu.png \
-  res/drawable-land-xhdpi-v14/menu_normal.png \
-  res/drawable-land-xhdpi-v14/menu_pressed.png \
   res/drawable-land-xhdpi-v14/reader.png \
   res/drawable-land-xhdpi-v14/site_security_identified.png \
   res/drawable-land-xhdpi-v14/site_security_verified.png \
   $(NULL)
 
 RES_DRAWABLE_LARGE_MDPI_V11 = \
   res/drawable-large-mdpi-v11/address_bar_bg.xml \
   res/drawable-large-mdpi-v11/address_bar_texture_tablet.png \
@@ -794,18 +783,16 @@ RES_DRAWABLE_LARGE_MDPI_V11 = \
   res/drawable-large-mdpi-v11/tab_new.png \
   res/drawable-large-mdpi-v11/tab_new_normal.png \
   res/drawable-large-mdpi-v11/tab_new_pressed.png \
   res/drawable-large-mdpi-v11/urlbar_stop.png \
   res/drawable-large-mdpi-v11/reader.png \
   res/drawable-large-mdpi-v11/site_security_identified.png \
   res/drawable-large-mdpi-v11/site_security_verified.png \
   res/drawable-large-mdpi-v11/menu.png \
-  res/drawable-large-mdpi-v11/menu_normal.png \
-  res/drawable-large-mdpi-v11/menu_pressed.png \
   res/drawable-large-mdpi-v11/tabs_carat.png \
   $(NULL)
 
 RES_DRAWABLE_LARGE_HDPI_V11 = \
   res/drawable-large-hdpi-v11/address_bar_texture_tablet.png \
   res/drawable-large-hdpi-v11/address_bar_back_button_bg.png \
   res/drawable-large-hdpi-v11/address_bar_back_button_pressed_bg.png \
   res/drawable-large-hdpi-v11/address_bar_url_default.9.png \
@@ -821,18 +808,16 @@ RES_DRAWABLE_LARGE_HDPI_V11 = \
   res/drawable-large-hdpi-v11/tab_new.png \
   res/drawable-large-hdpi-v11/tab_new_normal.png \
   res/drawable-large-hdpi-v11/tab_new_pressed.png \
   res/drawable-large-hdpi-v11/urlbar_stop.png \
   res/drawable-large-hdpi-v11/reader.png \
   res/drawable-large-hdpi-v11/site_security_identified.png \
   res/drawable-large-hdpi-v11/site_security_verified.png \
   res/drawable-large-hdpi-v11/menu.png \
-  res/drawable-large-hdpi-v11/menu_normal.png \
-  res/drawable-large-hdpi-v11/menu_pressed.png \
   res/drawable-large-hdpi-v11/tabs_carat.png \
   $(NULL)
 
 RES_DRAWABLE_LARGE_XHDPI_V11 = \
   res/drawable-large-xhdpi-v11/address_bar_texture_tablet.png \
   res/drawable-large-xhdpi-v11/address_bar_back_button_bg.png \
   res/drawable-large-xhdpi-v11/address_bar_back_button_pressed_bg.png \
   res/drawable-large-xhdpi-v11/address_bar_url_default.9.png \
@@ -848,18 +833,16 @@ RES_DRAWABLE_LARGE_XHDPI_V11 = \
   res/drawable-large-xhdpi-v11/tab_new.png \
   res/drawable-large-xhdpi-v11/tab_new_normal.png \
   res/drawable-large-xhdpi-v11/tab_new_pressed.png \
   res/drawable-large-xhdpi-v11/urlbar_stop.png \
   res/drawable-large-xhdpi-v11/reader.png \
   res/drawable-large-xhdpi-v11/site_security_identified.png \
   res/drawable-large-xhdpi-v11/site_security_verified.png \
   res/drawable-large-xhdpi-v11/menu.png \
-  res/drawable-large-xhdpi-v11/menu_normal.png \
-  res/drawable-large-xhdpi-v11/menu_pressed.png \
   res/drawable-large-xhdpi-v11/tabs_carat.png \
   $(NULL)
 
 RES_DRAWABLE_XLARGE_MDPI_V11 = \
   res/drawable-xlarge-mdpi-v11/awesomebar_tab_center.9.png \
   res/drawable-xlarge-mdpi-v11/awesomebar_tab_left.9.png \
   res/drawable-xlarge-mdpi-v11/awesomebar_tab_right.9.png \
   res/drawable-xlarge-mdpi-v11/menu.png \
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/MenuButton.java
@@ -0,0 +1,79 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Path;
+import android.graphics.PorterDuff.Mode;
+import android.util.AttributeSet;
+import android.widget.ImageButton;
+
+public class MenuButton extends ImageButton
+                        implements CanvasDelegate.DrawManager { 
+    Path mPath;
+    CurveTowards mSide;
+    CanvasDelegate mCanvasDelegate;
+
+    private enum CurveTowards { NONE, LEFT, RIGHT };
+
+    public MenuButton(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BrowserToolbarCurve);
+        int curveTowards = a.getInt(R.styleable.BrowserToolbarCurve_curveTowards, 0x02);
+        a.recycle();
+
+        if (curveTowards == 0x00)
+            mSide = CurveTowards.NONE;
+        else if (curveTowards == 0x01)
+            mSide = CurveTowards.LEFT;
+        else
+            mSide = CurveTowards.RIGHT;
+
+        // Path is clipped.
+        mPath = new Path();
+        mCanvasDelegate = new CanvasDelegate(this, Mode.DST_OUT);
+    }
+
+    @Override
+    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+        int width = getMeasuredWidth();
+        int height = getMeasuredHeight();
+        float curve = height * 1.125f;
+
+        mPath.reset();
+
+        // Clipping happens on opposite side for menu.
+        if (mSide == CurveTowards.RIGHT) {
+            mPath.moveTo(0, 0);
+            mPath.cubicTo(curve * 0.75f, 0,
+                          curve * 0.25f, height,
+                          curve, height);
+            mPath.lineTo(0, height);
+            mPath.lineTo(0, 0);
+        } else if (mSide == CurveTowards.LEFT) {
+            mPath.moveTo(width, 0);
+            mPath.cubicTo((width - (curve * 0.75f)), 0,
+                          (width - (curve * 0.25f)), height,
+                          (width - curve), height);
+            mPath.lineTo(width, height);
+            mPath.lineTo(width, 0);
+        }
+    }
+
+    @Override
+    public void draw(Canvas canvas) {
+        mCanvasDelegate.draw(canvas, mPath, getWidth(), getHeight());
+    }
+
+    @Override
+    public void defaultDraw(Canvas canvas) {
+        super.draw(canvas);
+    }
+}
deleted file mode 100644
index 909ad15af3f8536af579df064887aea311e7be54..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index a6479aaad95af26186a85e4a98871bacfd6c43ef..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index c655ba11a7c21b000fbd393fa5af8e08044d122e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b1430110f84565580229517387023aba4f48b9a9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 8a50605a1cda66c01902c7dca2fcaa4f3f9a5b02..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 3c501e2c9d3d34e8d739728f771f52fc6e7e14c4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 137bbce4e91828792c898f7e7966c2fea5e8c206..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 51a8d24993d003757364f98c5447910c69fc13d5..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b2ed96760c08ca51cec09d88f5e2a695c03b4b93..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index efd8d5a4d2d240d5ae255adac145078a914e05b9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 25d6e4016d7bac7d2fad007dcfc24ab2cff3b9ea..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index c3cca45fffb646c673d2889f15c015d3eb9a3936..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index a8cfcae442c103bfb54bff4836a6aebe9400301e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 14d83b8e2264b84eb9b7dfd23165bddbebf1cfb5..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 17f0a94a54b41c6385647032b9e4d27564f3da17..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 9cd4aa65ac5689c88de8aac1e0ea2c643c4e2666..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 621676a882ef0615dcfbb055579e3ff913860fe3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 542bf2e1eb1d643fba7687b96917af789bc13fd3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/android/base/resources/drawable/menu_button.xml
+++ b/mobile/android/base/resources/drawable/menu_button.xml
@@ -2,16 +2,16 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <level-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item android:maxLevel="1">
         <selector>
-            <item android:state_pressed="true" android:drawable="@drawable/menu_pressed"/>
-            <item android:drawable="@drawable/menu_normal"/>
+            <item android:state_pressed="true" android:drawable="@drawable/highlight"/>
+            <item android:drawable="@android:color/black"/>
         </selector>
     </item>
 
     <item android:maxLevel="2" android:drawable="@android:color/transparent"/>
 
 </level-list>
--- a/mobile/android/base/resources/layout-land-v14/browser_toolbar.xml.in
+++ b/mobile/android/base/resources/layout-land-v14/browser_toolbar.xml.in
@@ -27,18 +27,18 @@
 
         <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
                                                     android:layout_height="fill_parent"
                                                     android:layout_marginRight="14dip"
                                                     android:layout_alignParentTop="true"
                                                     android:layout_alignParentRight="true"
                                                     android:background="@drawable/address_bar_bg"/>
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton.Unused"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <org.mozilla.gecko.TabsButton android:id="@+id/tabs"
                                       style="@style/AddressBar.ImageButton"
                                       android:layout_width="60dip"
                                       android:layout_alignParentRight="true"
                                       gecko:curveTowards="right"
                                       gecko:cropped="true"
                                       android:background="@drawable/tabs_button"
--- a/mobile/android/base/resources/layout-land-v14/browser_toolbar_menu.xml.in
+++ b/mobile/android/base/resources/layout-land-v14/browser_toolbar_menu.xml.in
@@ -27,26 +27,26 @@
 
         <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
                                                     android:layout_height="fill_parent"
                                                     android:layout_marginRight="50dip"
                                                     android:layout_alignParentTop="true"
                                                     android:layout_alignParentRight="true"
                                                     android:background="@drawable/address_bar_bg"/>
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton"
-                     android:layout_width="65dip"
-                     android:layout_alignParentRight="true"
-                     android:gravity="center_vertical"
-                     android:src="@drawable/menu_level"
-                     android:contentDescription="@string/menu"
-                     android:background="@drawable/menu_button"
-                     android:paddingLeft="35dip"
-                     android:paddingRight="10dip"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton"
+                                      android:layout_width="65dip"
+                                      android:layout_alignParentRight="true"
+                                      android:gravity="center_vertical"
+                                      android:src="@drawable/menu_level"
+                                      android:contentDescription="@string/menu"
+                                      android:background="@drawable/menu_button"
+                                      android:paddingLeft="35dip"
+                                      android:paddingRight="10dip"/>
 
         <org.mozilla.gecko.TabsButton android:id="@+id/tabs"
                                       style="@style/AddressBar.ImageButton"
                                       android:layout_width="80dip"
                                       android:layout_marginRight="15dip"
                                       android:layout_alignParentRight="true"
                                       gecko:curveTowards="right"
                                       android:background="@drawable/tabs_button"
--- a/mobile/android/base/resources/layout-land-v14/tabs_panel_toolbar_menu.xml
+++ b/mobile/android/base/resources/layout-land-v14/tabs_panel_toolbar_menu.xml
@@ -3,27 +3,27 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
 
     <RelativeLayout android:layout_width="fill_parent"
                     android:layout_height="fill_parent">
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton"
-                     android:layout_width="65dip"
-                     android:layout_alignParentRight="true"
-                     android:gravity="center_vertical"
-                     android:src="@drawable/menu"
-                     android:contentDescription="@string/menu"
-                     android:background="@drawable/menu_normal"
-                     android:paddingLeft="35dip"
-                     android:paddingRight="10dip"
-                     android:enabled="false"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton"
+                                      android:layout_width="65dip"
+                                      android:layout_alignParentRight="true"
+                                      android:gravity="center_vertical"
+                                      android:src="@drawable/menu"
+                                      android:contentDescription="@string/menu"
+                                      android:background="@android:color/black"
+                                      android:paddingLeft="35dip"
+                                      android:paddingRight="10dip"
+                                      android:enabled="false"/>
 
         <View android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:background="@drawable/tabs_tray_bg_repeat"
               android:layout_marginRight="75dip"/>
 
         <LinearLayout android:layout_width="fill_parent"
                       android:layout_height="fill_parent"
--- a/mobile/android/base/resources/layout-large-v11/browser_toolbar_menu.xml.in
+++ b/mobile/android/base/resources/layout-large-v11/browser_toolbar_menu.xml.in
@@ -14,27 +14,27 @@
 
         <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
                                                     android:layout_height="fill_parent"
                                                     android:layout_marginRight="75dip"
                                                     android:layout_alignParentTop="true"
                                                     android:layout_alignParentRight="true"
                                                     android:background="@drawable/address_bar_bg"/>
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton"
-                     android:layout_width="90dip"
-                     android:layout_alignParentRight="true"
-                     android:gravity="center_vertical"
-                     android:src="@drawable/menu_level"
-                     android:contentDescription="@string/menu"
-                     android:background="@drawable/menu_button"
-                     android:paddingLeft="48dip"
-                     android:paddingRight="14dip"
-                     android:visibility="gone"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton"
+                                      android:layout_width="90dip"
+                                      android:layout_alignParentRight="true"
+                                      android:gravity="center_vertical"
+                                      android:src="@drawable/menu_level"
+                                      android:contentDescription="@string/menu"
+                                      android:background="@drawable/menu_button"
+                                      android:paddingLeft="48dip"
+                                      android:paddingRight="14dip"
+                                      android:visibility="gone"/>
 
         <org.mozilla.gecko.TabsButton android:id="@+id/tabs"
                                       style="@style/AddressBar.ImageButton"
                                       android:layout_width="112dip"
                                       android:layout_marginRight="28dip"
                                       android:layout_alignParentRight="true"
                                       gecko:curveTowards="right"
                                       android:background="@drawable/tabs_button"
--- a/mobile/android/base/resources/layout-large-v11/tabs_panel_toolbar_menu.xml
+++ b/mobile/android/base/resources/layout-large-v11/tabs_panel_toolbar_menu.xml
@@ -3,27 +3,27 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
 
     <RelativeLayout android:layout_width="fill_parent"
                     android:layout_height="fill_parent">
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton"
-                     android:layout_width="90dip"
-                     android:layout_alignParentRight="true"
-                     android:gravity="center_vertical"
-                     android:src="@drawable/menu"
-                     android:contentDescription="@string/menu"
-                     android:background="@drawable/menu_normal"
-                     android:paddingLeft="48dip"
-                     android:paddingRight="14dip"
-                     android:enabled="false"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton"
+                                      android:layout_width="90dip"
+                                      android:layout_alignParentRight="true"
+                                      android:gravity="center_vertical"
+                                      android:src="@drawable/menu"
+                                      android:contentDescription="@string/menu"
+                                      android:background="@android:color/black"
+                                      android:paddingLeft="48dip"
+                                      android:paddingRight="14dip"
+                                      android:enabled="false"/>
 
         <View android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:background="@drawable/tabs_tray_bg_repeat"
               android:layout_marginRight="110dip"/>
 
         <LinearLayout android:layout_width="fill_parent"
                       android:layout_height="fill_parent"
--- a/mobile/android/base/resources/layout-xlarge-v11/browser_toolbar_menu.xml.in
+++ b/mobile/android/base/resources/layout-xlarge-v11/browser_toolbar_menu.xml.in
@@ -28,27 +28,28 @@
         <TextSwitcher android:id="@+id/tabs_count"
                      style="@style/AddressBar.ImageButton"
                      android:layout_width="52dip"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="8dp"
                      android:layout_alignLeft="@id/tabs"
                      android:gravity="center_horizontal"/>
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton"
-                     android:layout_width="56dip"
-                     android:layout_alignParentRight="true"
-                     android:gravity="center_vertical"
-                     android:src="@drawable/menu"
-                     android:contentDescription="@string/menu"
-                     android:background="@drawable/action_bar_button"
-                     android:paddingLeft="14dip"
-                     android:paddingRight="14dip"
-                     android:visibility="gone"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton"
+                                      android:layout_width="56dip"
+                                      android:layout_alignParentRight="true"
+                                      gecko:curveTowards="none"
+                                      android:gravity="center_vertical"
+                                      android:src="@drawable/menu"
+                                      android:contentDescription="@string/menu"
+                                      android:background="@drawable/action_bar_button"
+                                      android:paddingLeft="14dip"
+                                      android:paddingRight="14dip"
+                                      android:visibility="gone"/>
 
         <LinearLayout android:id="@+id/menu_items"
                       android:layout_width="wrap_content"
                       android:layout_height="fill_parent"
                       android:orientation="horizontal"
                       android:layout_toLeftOf="@id/menu"/>
 
         <FrameLayout style="@style/AddressBar.Button"
--- a/mobile/android/base/resources/layout/browser_toolbar.xml.in
+++ b/mobile/android/base/resources/layout/browser_toolbar.xml.in
@@ -27,18 +27,18 @@
 
         <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
                                                     android:layout_height="fill_parent"
                                                     android:layout_marginRight="17dip"
                                                     android:layout_alignParentTop="true"
                                                     android:layout_alignParentRight="true"
                                                     android:background="@drawable/address_bar_bg"/>
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton.Unused"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <org.mozilla.gecko.TabsButton android:id="@+id/tabs"
                                       style="@style/AddressBar.ImageButton"
                                       android:layout_width="72dip"
                                       android:layout_alignParentRight="true"
                                       gecko:curveTowards="right"
                                       gecko:cropped="true"
                                       android:background="@drawable/tabs_button"
--- a/mobile/android/base/resources/layout/browser_toolbar_menu.xml.in
+++ b/mobile/android/base/resources/layout/browser_toolbar_menu.xml.in
@@ -27,28 +27,28 @@
 
         <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
                                                     android:layout_height="fill_parent"
                                                     android:layout_marginRight="64dip"
                                                     android:layout_alignParentTop="true"
                                                     android:layout_alignParentRight="true"
                                                     android:background="@drawable/address_bar_bg"/>
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton"
-                     android:layout_width="78dip"
-                     android:layout_alignParentRight="true"
-                     gecko:curveTowards="right"
-                     android:gravity="center_vertical"
-                     android:src="@drawable/menu_level"
-                     android:contentDescription="@string/menu"
-                     android:background="@drawable/menu_button"
-                     android:paddingLeft="42dip"
-                     android:paddingRight="12dip"
-                     android:visibility="gone"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton"
+                                      android:layout_width="78dip"
+                                      android:layout_alignParentRight="true"
+                                      gecko:curveTowards="right"
+                                      android:gravity="center_vertical"
+                                      android:src="@drawable/menu_level"
+                                      android:contentDescription="@string/menu"
+                                      android:background="@drawable/menu_button"
+                                      android:paddingLeft="42dip"
+                                      android:paddingRight="12dip"
+                                      android:visibility="gone"/>
 
         <org.mozilla.gecko.TabsButton android:id="@+id/tabs"
                                       style="@style/AddressBar.ImageButton"
                                       android:layout_width="98dip"
                                       android:layout_marginRight="22dip"
                                       android:layout_alignParentRight="true"
                                       android:background="@drawable/tabs_button"
                                       android:gravity="center_vertical"
--- a/mobile/android/base/resources/layout/tabs_panel_toolbar_menu.xml
+++ b/mobile/android/base/resources/layout/tabs_panel_toolbar_menu.xml
@@ -3,27 +3,27 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
 
     <RelativeLayout android:layout_width="fill_parent"
                     android:layout_height="fill_parent">
 
-        <ImageButton android:id="@+id/menu"
-                     style="@style/AddressBar.ImageButton"
-                     android:layout_width="78dip"
-                     android:layout_alignParentRight="true"
-                     android:gravity="center_vertical"
-                     android:src="@drawable/menu"
-                     android:contentDescription="@string/menu"
-                     android:background="@drawable/menu_normal"
-                     android:paddingLeft="42dip"
-                     android:paddingRight="12dip"
-                     android:enabled="false"/>
+        <org.mozilla.gecko.MenuButton android:id="@+id/menu"
+                                      style="@style/AddressBar.ImageButton"
+                                      android:layout_width="78dip"
+                                      android:layout_alignParentRight="true"
+                                      android:gravity="center_vertical"
+                                      android:src="@drawable/menu"
+                                      android:contentDescription="@string/menu"
+                                      android:background="@android:color/black"
+                                      android:paddingLeft="42dip"
+                                      android:paddingRight="12dip"
+                                      android:enabled="false"/>
 
         <View android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:background="@drawable/tabs_tray_bg_repeat"
               android:layout_marginRight="95dip"/>
 
         <LinearLayout android:layout_width="fill_parent"
                       android:layout_height="fill_parent"