Bug 997406 - Take into account padding when deciding whether to show Share icon. r=liuche, a=lsblakk
authorWes Johnston <wjohnston@mozilla.com>
Thu, 17 Apr 2014 09:44:51 -0700
changeset 192422 19b1649f060a1c285557b18d3410dc12d44763c5
parent 192421 4fd82c282519f5185a9e4282ad1f6eb47434d334
child 192423 df3506c7ad591a99fe8e2d537cbdd37bd41849ba
push id3615
push userryanvm@gmail.com
push dateFri, 30 May 2014 12:52:48 +0000
treeherdermozilla-beta@19b1649f060a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche, lsblakk
bugs997406
milestone30.0
Bug 997406 - Take into account padding when deciding whether to show Share icon. r=liuche, a=lsblakk
mobile/android/base/menu/MenuItemActionView.java
--- a/mobile/android/base/menu/MenuItemActionView.java
+++ b/mobile/android/base/menu/MenuItemActionView.java
@@ -57,17 +57,19 @@ public class MenuItemActionView extends 
         mMenuItem = (MenuItemDefault) findViewById(R.id.menu_item);
         mMenuButton = (MenuItemActionBar) findViewById(R.id.menu_item_button);
         mActionButtons = new ArrayList<ImageButton>();
     }
 
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         View parent = (View) getParent();
-        if ((right - left) < parent.getMeasuredWidth() || mActionButtons.size() != 0) {
+        final int padding = getPaddingLeft() + getPaddingRight();
+        final int parentPadding = parent.getPaddingLeft() + parent.getPaddingRight();
+        if ((right - left - padding) < (parent.getMeasuredWidth() - parentPadding) || mActionButtons.size() != 0) {
             // Use the icon.
             mMenuItem.setVisibility(View.GONE);
             mMenuButton.setVisibility(View.VISIBLE);
         } else {
             // Use the button.
             mMenuItem.setVisibility(View.VISIBLE);
             mMenuButton.setVisibility(View.GONE);
         }