Bug 1106935 - Move BrowserToolbarTablet menu button right margin hack to xml. r=mhaigh draft
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 03 Feb 2015 16:54:39 -0800
changeset 243453 4b60fe6ca371e783c8cc648568b8af7ec8791396
parent 243452 10d7065f143f287737213c8de96f824a5ba776ac
child 243454 5a3e142c517c00c224c21f22f61271fc4ea36aac
push id724
push usermichael.l.comella@gmail.com
push dateWed, 18 Feb 2015 23:32:10 +0000
reviewersmhaigh
bugs1106935
milestone38.0a1
Bug 1106935 - Move BrowserToolbarTablet menu button right margin hack to xml. r=mhaigh We couldn't do this before because the button declaration was shared by old and new tablet - this is no longer a problem now that old tablet is no longer in use.
mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
mobile/android/base/resources/values/dimens.xml
mobile/android/base/toolbar/BrowserToolbarTablet.java
--- a/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
@@ -77,16 +77,17 @@
                         android:layout_marginLeft="16dp"
                         android:layout_marginRight="16dp"
                         android:layout="@layout/new_tablet_tabs_counter"/>
 
     <org.mozilla.gecko.widget.ThemedImageButton
             android:id="@+id/menu"
             style="@style/UrlBar.ImageButton.NewTablet"
             android:layout_alignParentRight="true"
+            android:layout_marginRight="6dp"
             android:contentDescription="@string/menu"
             android:background="@drawable/new_tablet_action_bar_button"
             android:visibility="gone"/>
 
     <org.mozilla.gecko.widget.ThemedImageView
             android:id="@+id/menu_icon"
             style="@style/UrlBar.ImageButton.NewTablet"
             android:layout_alignLeft="@id/menu"
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -32,17 +32,16 @@
     <dimen name="new_tablet_tab_strip_fading_edge_size">15dp</dimen>
     <dimen name="new_tablet_site_security_height">60dp</dimen>
     <dimen name="new_tablet_site_security_width">34dp</dimen>
     <!-- We primarily use padding (instead of margins) to increase the hit area. -->
     <dimen name="new_tablet_site_security_padding_vertical">21dp</dimen>
     <dimen name="new_tablet_site_security_padding_horizontal">8dp</dimen>
     <dimen name="new_tablet_site_security_right_margin">1dp</dimen>
     <dimen name="new_tablet_browser_toolbar_height">60dp</dimen>
-    <dimen name="new_tablet_browser_toolbar_menu_right_margin">6dp</dimen>
     <dimen name="new_tablet_browser_toolbar_menu_item_width">56dp</dimen>
     <!-- Padding combines with an 18dp image to form the menu item width and height. -->
     <dimen name="new_tablet_browser_toolbar_menu_item_padding_horizontal">19dp</dimen>
     <dimen name="new_tablet_browser_toolbar_menu_item_inset_vertical">5dp</dimen>
     <dimen name="new_tablet_browser_toolbar_menu_item_inset_horizontal">3dp</dimen>
     <dimen name="new_tablet_browser_toolbar_menu_item_corner_radius">5dp</dimen>
     <dimen name="new_tablet_tab_strip_button_inset">5dp</dimen>
     <dimen name="new_tablet_private_tabs_panel_empty_width">300dp</dimen>
--- a/mobile/android/base/toolbar/BrowserToolbarTablet.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTablet.java
@@ -5,17 +5,16 @@
 
 package org.mozilla.gecko.toolbar;
 
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.animation.PropertyAnimator;
 import org.mozilla.gecko.animation.ViewHelper;
 
 import android.content.Context;
-import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 
 /**
  * The toolbar implementation for tablet.
  */
 class BrowserToolbarTablet extends BrowserToolbarTabletBase {
 
@@ -46,26 +45,16 @@ class BrowserToolbarTablet extends Brows
 
         // TODO: Move this to *TabletBase when old tablet is removed.
         // We don't want users clicking the forward button in transitions, but we don't want it to
         // look disabled to avoid flickering complications (e.g. disabled in editing mode), so undo
         // the work of the super class' constructor.
         setButtonEnabled(forwardButton, true);
 
         updateForwardButtonState(ForwardButtonState.HIDDEN);
-
-        setRightMargin();
-    }
-
-    private void setRightMargin() {
-        // TODO: Remove this hack in favor of resources when old tablet is removed.
-        final Resources res = getContext().getResources();
-        final int rightMargin =
-                res.getDimensionPixelOffset(R.dimen.new_tablet_browser_toolbar_menu_right_margin);
-        setPadding(getPaddingLeft(), getPaddingTop(), rightMargin, getPaddingBottom());
     }
 
     private void updateForwardButtonState(final ForwardButtonState state) {
         forwardButtonState = state;
         forwardButton.setEnabled(forwardButtonState == ForwardButtonState.DISPLAYED);
     }
 
     @Override