Bug 1269774 - Fix padding for context menu icons. r=sebastian, a=sledru
authorAndrzej Hunt <andrzej@ahunt.org>
Tue, 03 May 2016 10:09:28 -0700
changeset 333168 7f4050a2fb1ef0fce2df2142b66838c849d6818c
parent 333167 c713740d109c32a69a78ff2a00b41415d5e3f5dd
child 333169 f940e3a54aca6b48f25604c2ef03fd4e68d79121
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, sledru
bugs1269774
milestone48.0a2
Bug 1269774 - Fix padding for context menu icons. r=sebastian, a=sledru The icons in the first row require more padding. In the second row the share icons should have more padding, but only on phones, and all other icons should remain the same size. (On tablets the share icon can be shown beside the bookmark star, hence we use an inset drawable to add padding on phones, and then provide an alternative 0-inset on tablets to avoid any changes there.) MozReview-Commit-ID: 54NzYtUpzuV
mobile/android/base/java/org/mozilla/gecko/menu/MenuItemSwitcherLayout.java
mobile/android/base/resources/drawable-hdpi/ic_menu_share.png
mobile/android/base/resources/drawable-hdpi/ic_menu_share_icon.png
mobile/android/base/resources/drawable-large/ic_menu_share.xml
mobile/android/base/resources/drawable-xhdpi/ic_menu_share.png
mobile/android/base/resources/drawable-xhdpi/ic_menu_share_icon.png
mobile/android/base/resources/drawable-xxhdpi/ic_menu_share.png
mobile/android/base/resources/drawable-xxhdpi/ic_menu_share_icon.png
mobile/android/base/resources/drawable/ic_menu_share.xml
mobile/android/base/resources/values/attrs.xml
mobile/android/base/resources/values/styles.xml
mobile/android/base/resources/values/themes.xml
--- a/mobile/android/base/java/org/mozilla/gecko/menu/MenuItemSwitcherLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/MenuItemSwitcherLayout.java
@@ -139,17 +139,17 @@ public class MenuItemSwitcherLayout exte
     public void addActionButton(Drawable drawable, CharSequence label) {
         // If this is the first icon, retain the text.
         // If not, make the menu item an icon.
         final int count = mActionButtons.size();
         mMenuItem.setVisibility(View.GONE);
         mMenuButton.setVisibility(View.VISIBLE);
 
         if (drawable != null) {
-            ImageButton button = new ImageButton(getContext(), null, R.attr.menuItemShareActionButtonStyle);
+            ImageButton button = new ImageButton(getContext(), null, R.attr.menuItemSecondaryActionBarStyle);
             button.setImageDrawable(drawable);
             button.setContentDescription(label);
             button.setOnClickListener(this);
             button.setTag(count);
 
             final int height = (int) (getResources().getDimension(R.dimen.menu_item_row_height));
             LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, height);
             params.weight = 1.0f;
rename from mobile/android/base/resources/drawable-hdpi/ic_menu_share.png
rename to mobile/android/base/resources/drawable-hdpi/ic_menu_share_icon.png
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable-large/ic_menu_share.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/ic_menu_share_icon"/>
rename from mobile/android/base/resources/drawable-xhdpi/ic_menu_share.png
rename to mobile/android/base/resources/drawable-xhdpi/ic_menu_share_icon.png
rename from mobile/android/base/resources/drawable-xxhdpi/ic_menu_share.png
rename to mobile/android/base/resources/drawable-xxhdpi/ic_menu_share_icon.png
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable/ic_menu_share.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/ic_menu_share_icon"
+    android:insetTop="3dp"
+    android:insetRight="3dp"
+    android:insetBottom="3dp"
+    android:insetLeft="3dp"/>
--- a/mobile/android/base/resources/values/attrs.xml
+++ b/mobile/android/base/resources/values/attrs.xml
@@ -20,19 +20,16 @@
         <attr name="menuItemSwitcherLayoutStyle" format="reference"/>
 
         <!-- Style for MenuItemDefault -->
         <attr name="menuItemDefaultStyle" format="reference"/>
 
         <!-- Style for MenuItemActionBar when shown in SecondaryActionBar -->
         <attr name="menuItemSecondaryActionBarStyle" format="reference"/>
 
-        <!-- Style for MenuItemSwitcherLayout's ShareActionButton -->
-        <attr name="menuItemShareActionButtonStyle" format="reference"/>
-
         <!-- Default style for the BookmarksListView -->
         <attr name="bookmarksListViewStyle" format="reference" />
 
         <!-- Default style for the TopSitesGridItemView -->
         <attr name="topSitesGridItemViewStyle" format="reference" />
 
         <!-- Styles for dynamic panel grid views -->
         <attr name="panelIconViewStyle" format="reference" />
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -81,17 +81,17 @@
     </style>
 
     <style name="Widget.GeckoMenuListView" parent="Widget.ListView">
         <item name="android:listSelector">@drawable/menu_item_action_bar_bg</item>
         <item name="android:divider">@color/toolbar_divider_grey</item>
     </style>
 
     <style name="Widget.MenuItemActionBar">
-        <item name="android:padding">8dip</item>
+        <item name="android:padding">10dip</item>
         <item name="android:background">@drawable/menu_item_action_bar_bg</item>
         <item name="android:scaleType">fitCenter</item>
         <item name="drawableTintList">@color/action_bar_menu_item_colors</item>"
     </style>
 
     <style name="Widget.MenuItemSecondaryActionBar">
         <item name="android:padding">8dip</item>
         <item name="android:background">@drawable/menu_item_action_bar_bg</item>
--- a/mobile/android/base/resources/values/themes.xml
+++ b/mobile/android/base/resources/values/themes.xml
@@ -92,17 +92,16 @@
         <item name="android:spinnerStyle">@style/Widget.Spinner</item>
         <item name="android:windowBackground">@android:color/white</item>
         <item name="bookmarksListViewStyle">@style/Widget.BookmarksListView</item>
         <item name="tabGridLayoutViewStyle">@style/Widget.TabsGridLayout</item>
         <item name="geckoMenuListViewStyle">@style/Widget.GeckoMenuListView</item>
         <item name="homeListViewStyle">@style/Widget.HomeListView</item>
         <item name="menuItemActionBarStyle">@style/Widget.MenuItemActionBar</item>
         <item name="menuItemActionModeStyle">@style/GeckoActionBar.Button</item>
-        <item name="menuItemShareActionButtonStyle">@style/Widget.MenuItemSecondaryActionBar</item>
         <item name="topSitesGridItemViewStyle">@style/Widget.TopSitesGridItemView</item>
         <item name="topSitesGridViewStyle">@style/Widget.TopSitesGridView</item>
         <item name="topSitesThumbnailViewStyle">@style/Widget.TopSitesThumbnailView</item>
     </style>
 
     <style name="Gecko.Preferences" parent="GeckoPreferencesBase">
         <!-- This fixed bug 1233412 (Crash in GeckoPrefs due to missing colorAccent in JB) -->
         <item name="colorAccent">@color/action_orange</item>