Bug 1350661 - Extract layout attributes into styles in order to separate api 15 and 17 style tree, r=sebastian draft
authormaliu <max@mxli.us>
Mon, 16 Jan 2017 15:32:59 +0800
changeset 554240 76da12238e56fc8280dd0bb0cecfea44f2ed78cf
parent 552146 5182b2c4b963ed87d038c7d9a4021463917076cd
child 622283 01252c916a2bd97b3824830cd5b157c2b3d20da2
push id51876
push userbmo:max@mxli.us
push dateFri, 31 Mar 2017 08:27:48 +0000
reviewerssebastian
bugs1350661
milestone55.0a1
Bug 1350661 - Extract layout attributes into styles in order to separate api 15 and 17 style tree, r=sebastian __Device_Configuration__|__o_Applied_Style_______________ ldrtl-v17 v17 v15 | o o o | UrlBar.Entry \ | | | -----o | | UrlBar.V17.Entry(start/end) \ | | \ o | UrlBar.V15.Entry(left/right) \ | | --o | UrlBar.Base.Entry(original style) Though Android support RTL since API level 17(JB_MR1), it's really buggy at that moment. This patch fix a severe UI layout attribute bug, which only happen on android 4.2 in RTL language context: If view attributes "start/end" and "left/right" are both written in a view layout xml, they will both be applied and cause UI abnormal. In API 18 and above, "left" will be ignored if "start" also exist. For example, as below show, alignLeft and alignStart are both exist in ImageView. On android 4.2 with RTL context, it's width will both align Left and Start(Right), cause the symptom that ImageView have the same width and cover on the view "back." ``` <ImageView android:id="@+id/url_bar_entry" android:layout_alignLeft="@+id/back" android:layout_alignStart="@+id/back" ``` MozReview-Commit-ID: JptLuWX2w15
mobile/android/base/resources/drawable-ldrtl-v17/url_bar_translating_edge.xml
mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
mobile/android/base/resources/layout/browser_toolbar.xml
mobile/android/base/resources/values-large-v17/styles.xml
mobile/android/base/resources/values-large/styles.xml
mobile/android/base/resources/values-v17/styles.xml
mobile/android/base/resources/values/styles.xml
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable-ldrtl-v17/url_bar_translating_edge.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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/. -->
+
+<clip xmlns:android="http://schemas.android.com/apk/res/android"
+      android:drawable="@drawable/url_bar_entry"
+      android:clipOrientation="horizontal"
+      android:gravity="left"/>
\ No newline at end of file
--- a/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
@@ -1,25 +1,19 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 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/. -->
 
-<merge xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:gecko="http://schemas.android.com/apk/res-auto">
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
 
     <ImageView android:id="@+id/url_bar_entry"
+               style="@style/UrlBar.Entry"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
-               android:layout_alignLeft="@+id/back"
-               android:layout_alignStart="@+id/back"
-               android:layout_toLeftOf="@id/menu_items"
-               android:layout_toStartOf="@id/menu_items"
-               android:layout_marginStart="@dimen/tablet_nav_button_width_half"
-               android:layout_marginLeft="@dimen/tablet_nav_button_width_half"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="10dp"
                android:duplicateParentState="true"
                android:clickable="false"
                android:focusable="false"
                android:background="@drawable/url_bar_entry"/>
 
     <!-- The attributes statically defined here are for the expanded
@@ -35,125 +29,87 @@
 	     to the right of the back button.
 
          (for layout_marginLeft) We left align with back,
          but only need to hide halfway underneath.
 
          (for paddingLeft) We use left padding to center the
          arrow in the visible area as opposed to the true width. -->
     <org.mozilla.gecko.toolbar.ForwardButton
-            style="@style/UrlBar.ImageButton.BrowserToolbarColors"
+            style="@style/UrlBar.ForwardButton"
             android:id="@+id/forward"
-            android:layout_alignLeft="@id/back"
-            android:layout_alignStart="@id/back"
             android:contentDescription="@string/forward"
             android:layout_height="match_parent"
             android:paddingTop="0dp"
             android:paddingBottom="0dp"
             android:layout_marginTop="11.5dp"
             android:layout_marginBottom="11.5dp"
             android:layout_gravity="center_vertical"
             android:layout_centerVertical="true"
             android:src="@drawable/ic_menu_forward"
             android:background="@drawable/url_bar_nav_button"
             android:alpha="0"
             android:layout_width="@dimen/tablet_nav_button_width_plus_half"
-            android:layout_marginLeft="@dimen/tablet_nav_button_width_half"
-            android:layout_marginStart="@dimen/tablet_nav_button_width_half"
-            android:paddingLeft="@dimen/tablet_fwd_button_padding_start"
-            android:paddingStart="@dimen/tablet_fwd_button_padding_start"
-            android:paddingRight="@dimen/tablet_fwd_button_padding_end"
-            android:paddingEnd="@dimen/tablet_fwd_button_padding_end"
         />
 
-    <org.mozilla.gecko.toolbar.BackButton android:id="@id/back"
-                                          style="@style/UrlBar.ImageButton.BrowserToolbarColors"
+    <org.mozilla.gecko.toolbar.BackButton android:id="@+id/back"
+                                          style="@style/UrlBar.BackButton"
                                           android:layout_width="@dimen/tablet_nav_button_width"
                                           android:layout_height="@dimen/tablet_nav_button_width"
                                           android:layout_centerVertical="true"
-                                          android:layout_marginLeft="12dp"
-                                          android:layout_marginStart="12dp"
-                                          android:layout_alignParentLeft="true"
-                                          android:layout_alignParentStart="true"
                                           android:src="@drawable/ic_menu_back"
                                           android:contentDescription="@string/back"
                                           android:background="@drawable/url_bar_nav_button"
         />
 
     <org.mozilla.gecko.toolbar.ToolbarEditLayout android:id="@+id/edit_layout"
-                  style="@style/UrlBar.Button"
-                  android:paddingRight="12dp"
-                  android:paddingEnd="12dp"
+                  style="@style/UrlBar.EditLayout"
                   android:visibility="gone"
                   android:orientation="horizontal"
-                  android:layout_toLeftOf="@id/menu_items"
-                  android:layout_toStartOf="@id/menu_items"
-                  android:layout_toRightOf="@id/back"
-                  android:layout_toEndOf="@id/back"/>
+        />
 
     <!-- Note: we set the padding on the site security icon to increase its tappable area. -->
     <org.mozilla.gecko.toolbar.ToolbarDisplayLayout android:id="@+id/display_layout"
-                  style="@style/UrlBar.Button.Container"
-            android:layout_toRightOf="@id/back"
-            android:layout_toEndOf="@id/back"
-            android:layout_toLeftOf="@id/menu_items"
-            android:layout_toStartOf="@id/menu_items"
-            android:paddingRight="4dip"
-            android:paddingEnd="4dip"/>
+        style="@style/UrlBar.DisplayLayout"
+        />
 
     <LinearLayout android:id="@+id/menu_items"
+                  style="@style/UrlBar.MenuItem"
                   android:layout_width="wrap_content"
                   android:layout_height="match_parent"
                   android:gravity="center_vertical"
-                  android:layout_marginLeft="6dp"
-                  android:layout_marginStart="6dp"
-                  android:layout_toLeftOf="@id/tabs"
-                  android:layout_toStartOf="@id/tabs"
                   android:orientation="horizontal"/>
 
     <org.mozilla.gecko.widget.themed.ThemedImageButton
             android:id="@+id/tabs"
-            style="@style/UrlBar.ImageButton"
-            android:layout_toLeftOf="@id/menu"
-            android:layout_toStartOf="@id/menu"
+            style="@style/UrlBar.Tabs"
             android:layout_alignWithParentIfMissing="true"
             android:background="@drawable/browser_toolbar_action_bar_button"/>
 
     <!-- In a 56x60dp space, centering 24dp image will leave 16x18dp. -->
     <org.mozilla.gecko.toolbar.TabCounter android:id="@+id/tabs_counter"
-                        style="@style/UrlBar.ImageButton"
-                        android:layout_alignLeft="@id/tabs"
-                        android:layout_alignStart="@id/tabs"
-                        android:layout_alignRight="@id/tabs"
-                        android:layout_alignEnd="@id/tabs"
+                        style="@style/UrlBar.TabCounter"
                         android:layout_alignTop="@id/tabs"
                         android:layout_alignBottom="@id/tabs"
                         android:layout_marginTop="18dp"
                         android:layout_marginBottom="18dp"
-                        android:layout_marginLeft="16dp"
-                        android:layout_marginStart="16dp"
-                        android:layout_marginRight="16dp"
-                        android:layout_marginEnd="16dp"
                         android:background="@drawable/tabs_count"/>
 
     <!-- Bug 1144707. Use clickable View instead of menu button margin to prevent
          edit mode actiivation when user clicks on the edge of the screen. -->
     <View android:id="@id/menu_margin"
+          style="@style/UrlBar.MenuMargin"
           android:layout_width="6dp"
           android:layout_height="match_parent"
-          android:layout_alignParentRight="true"
-          android:layout_alignParentEnd="true"
           android:clickable="true"
           android:visibility="gone"/>
 
     <org.mozilla.gecko.widget.themed.ThemedFrameLayout
             android:id="@+id/menu"
-            style="@style/UrlBar.ImageButton"
-            android:layout_toLeftOf="@id/menu_margin"
-            android:layout_toStartOf="@id/menu_margin"
+            style="@style/UrlBar.Menu"
             android:layout_alignWithParentIfMissing="true"
             android:contentDescription="@string/menu"
             android:background="@drawable/browser_toolbar_action_bar_button">
 
         <org.mozilla.gecko.widget.themed.ThemedImageView
                 android:id="@+id/menu_icon"
                 style="@style/UrlBar.ImageButton.BrowserToolbarColors"
                 android:layout_height="@dimen/browser_toolbar_menu_icon_height"
@@ -163,19 +119,17 @@
                 android:layout_gravity="center"/>
 
     </org.mozilla.gecko.widget.themed.ThemedFrameLayout>
 
     <!-- We draw after the menu items so when they are hidden, the cancel button,
          which is thus drawn on top, may be pressed. -->
     <org.mozilla.gecko.widget.themed.ThemedImageView
             android:id="@+id/edit_cancel"
-            style="@style/UrlBar.ImageButton"
+            style="@style/UrlBar.EditCancel"
             android:layout_width="@dimen/browser_toolbar_icon_width"
             android:layout_height="@dimen/browser_toolbar_height"
             android:layout_weight="0.0"
-            android:layout_alignParentRight="true"
-            android:layout_alignParentEnd="true"
             android:src="@drawable/close_edit_mode_selector"
             android:contentDescription="@string/edit_mode_cancel"
             android:visibility="gone"/>
 
 </merge>
--- a/mobile/android/base/resources/layout/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout/browser_toolbar.xml
@@ -3,128 +3,94 @@
    - 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">
 
     <!-- Note: any layout parameters setting the right edge of
          this View should be matched in the url_bar_translating_edge. -->
     <ImageView android:id="@+id/url_bar_entry"
-               style="@style/UrlBar.Button"
-               android:layout_marginLeft="8dp"
-               android:layout_marginStart="8dp"
-               android:layout_marginRight="-6dp"
-               android:layout_marginEnd="-6dp"
+               style="@style/UrlBar.Entry"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
-               android:layout_toLeftOf="@+id/tabs"
-               android:layout_toStartOf="@+id/tabs"
                android:duplicateParentState="true"
                android:clickable="false"
                android:focusable="false"
                android:src="@drawable/url_bar_entry"
                android:scaleType="fitXY"/>
 
     <!-- A View that clips with url_bar_entry and translates
          around it to animate growing the url bar,
          which occurs in the display/editing mode transitions. -->
     <ImageView android:id="@+id/url_bar_translating_edge"
-               style="@style/UrlBar.Button"
-               android:layout_alignLeft="@id/url_bar_entry"
-               android:layout_alignStart="@id/url_bar_entry"
-               android:layout_alignRight="@+id/url_bar_entry"
-               android:layout_alignEnd="@+id/url_bar_entry"
+               style="@style/UrlBar.Edge"
                android:layout_alignTop="@id/url_bar_entry"
                android:layout_alignBottom="@id/url_bar_entry"
                android:duplicateParentState="true"
                android:clickable="false"
                android:focusable="false"
                android:visibility="invisible"
                android:src="@drawable/url_bar_translating_edge"
                android:scaleType="fitXY"/>
 
     <org.mozilla.gecko.toolbar.ShapedButtonFrameLayout
             android:id="@+id/menu"
-            style="@style/UrlBar.ImageButton"
-            android:layout_alignParentRight="true"
-            android:layout_alignParentEnd="true"
+            style="@style/UrlBar.Menu"
             android:contentDescription="@string/menu"
             android:background="@drawable/shaped_button">
 
         <org.mozilla.gecko.widget.themed.ThemedImageView
                 android:id="@+id/menu_icon"
                 style="@style/UrlBar.ImageButton"
                 android:layout_height="@dimen/browser_toolbar_menu_icon_height"
                 android:layout_width="wrap_content"
                 android:scaleType="centerInside"
                 android:layout_gravity="center"
                 android:src="@drawable/menu"
                 android:tint="@color/tabs_tray_icon_grey"/>
 
     </org.mozilla.gecko.toolbar.ShapedButtonFrameLayout>
 
     <org.mozilla.gecko.toolbar.PhoneTabsButton android:id="@+id/tabs"
-                                               style="@style/UrlBar.ImageButton"
+                                               style="@style/UrlBar.Tabs"
                                                android:layout_width="64dip"
-                                               android:layout_toLeftOf="@id/menu"
-                                               android:layout_toStartOf="@id/menu"
                                                android:layout_alignWithParentIfMissing="true"
                                                android:background="@drawable/shaped_button"/>
 
     <!-- The TextSwitcher should be shifted 24dp on the left, to avoid
          the curve. On a 48dp space, centering 24dp image will leave
          12dp on all sides. However this image has a perception of
          2 layers. Hence to center this, an additional 4dp is added to the left.
          The margins will be 40dp on left, 8dp on right, instead of ideal 30dp
          and 12dp. -->
     <org.mozilla.gecko.toolbar.TabCounter android:id="@+id/tabs_counter"
-                        style="@style/UrlBar.ImageButton"
+                        style="@style/UrlBar.TabCounter"
                         android:layout_width="24dip"
                         android:layout_height="24dip"
                         android:layout_centerVertical="true"
-                        android:layout_marginRight="8dip"
-                        android:layout_marginEnd="8dip"
-                        android:layout_alignRight="@id/tabs"
-                        android:layout_alignEnd="@id/tabs"
                         android:background="@drawable/tabs_count"
                         android:gravity="center_horizontal"
                         android:clipChildren="false"
                         android:clipToPadding="false"/>
 
     <!-- Note that the edit components are invisible so that the views
          depending on their location can properly layout. -->
     <org.mozilla.gecko.widget.themed.ThemedImageView
             android:id="@+id/edit_cancel"
-            style="@style/UrlBar.ImageButton"
-            android:layout_alignParentRight="true"
-            android:layout_alignParentEnd="true"
+            style="@style/UrlBar.EditCancel"
             android:src="@drawable/close_edit_mode_selector"
             android:contentDescription="@string/edit_mode_cancel"
             android:background="@drawable/action_bar_button"
             android:visibility="invisible"/>
 
     <!-- The space to the left of the cancel button would be larger than the right because
          the url bar drawable contains some whitespace, so we compensate by removing
          some padding from the right (value determined through experimentation). -->
     <org.mozilla.gecko.toolbar.ToolbarEditLayout android:id="@+id/edit_layout"
-                  style="@style/UrlBar.Button"
-                  android:layout_alignLeft="@id/url_bar_entry"
-                  android:layout_alignStart="@id/url_bar_entry"
-                  android:layout_toLeftOf="@id/edit_cancel"
-                  android:layout_toStartOf="@id/edit_cancel"
+                  style="@style/UrlBar.EditLayout"
                   android:visibility="invisible"
-                  android:paddingLeft="8dp"
-                  android:paddingStart="8dp"
-                  android:paddingRight="8dp"
-                  android:paddingEnd="8dp"/>
+                  />
 
     <org.mozilla.gecko.toolbar.ToolbarDisplayLayout android:id="@+id/display_layout"
-                  style="@style/UrlBar.Button"
-                  android:layout_alignLeft="@id/url_bar_entry"
-                  android:layout_alignStart="@id/url_bar_entry"
-                  android:layout_alignRight="@id/url_bar_entry"
-                  android:layout_alignEnd="@id/url_bar_entry"
-                  android:paddingLeft="1dip"
-                  android:paddingStart="1dip"
-                  android:paddingRight="4dip"
-                  android:paddingEnd="4dip" />
+                  style="@style/UrlBar.DisplayLayout"
+                  />
 
 </merge>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/values-large-v17/styles.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <style name="UrlBar.MenuMargin" parent="UrlBar.V17.MenuMargin" />
+
+    <style name="UrlBar.V17.MenuMargin" parent="UrlBar.Base.MenuMargin">
+        <item name="android:layout_alignParentEnd">true</item>
+    </style>
+
+    <style name="UrlBar.Menu" parent="UrlBar.V17.Menu" />
+
+    <style name="UrlBar.V17.Menu" parent="UrlBar.Base.Menu">
+        <item name="android:layout_toStartOf">@id/menu_margin</item>
+    </style>
+
+    <style name="UrlBar.MenuItem" parent="UrlBar.V17.MenuItem" />
+
+    <style name="UrlBar.V17.MenuItem" parent="UrlBar.Base.MenuItem">
+        <item name="android:layout_marginStart">6dp</item>
+        <item name="android:layout_toStartOf">@id/tabs</item>
+    </style>
+
+    <style name="UrlBar.Tabs" parent="UrlBar.V17.Tabs" />
+
+    <style name="UrlBar.V17.Tabs" parent="UrlBar.Base.Tabs">
+        <item name="android:layout_toStartOf">@id/menu</item>
+    </style>
+
+    <style name="UrlBar.TabCounter" parent="UrlBar.V17.TabCounter" />
+
+    <style name="UrlBar.V17.TabCounter" parent="UrlBar.Base.TabCounter">
+        <item name="android:layout_alignStart">@id/tabs</item>
+        <item name="android:layout_alignEnd">@id/tabs</item>
+        <item name="android:layout_marginStart">16dp</item>
+        <item name="android:layout_marginEnd">16dp</item>
+    </style>
+
+    <style name="UrlBar.Entry" parent="UrlBar.V17.Entry" />
+
+    <style name="UrlBar.V17.Entry" parent="UrlBar.Base.Entry">
+        <item name="android:layout_alignStart">@id/back</item>
+        <item name="android:layout_toStartOf">@id/menu_items</item>
+        <item name="android:layout_marginStart">@dimen/tablet_nav_button_width_half</item>
+    </style>
+
+    <style name="UrlBar.ForwardButton" parent="UrlBar.V17.ForwardButton" />
+
+    <style name="UrlBar.V17.ForwardButton" parent="UrlBar.Base.ForwardButton">
+        <item name="android:layout_alignStart">@id/back</item>
+        <item name="android:layout_marginStart">@dimen/tablet_nav_button_width_half</item>
+        <item name="android:paddingStart">@dimen/tablet_fwd_button_padding_start</item>
+        <item name="android:paddingEnd">@dimen/tablet_fwd_button_padding_end</item>
+    </style>
+
+    <style name="UrlBar.BackButton" parent="UrlBar.V17.BackButton" />
+
+    <style name="UrlBar.V17.BackButton" parent="UrlBar.Base.BackButton">
+        <item name="android:layout_marginStart">12dp</item>
+        <item name="android:layout_alignParentStart">true</item>
+    </style>
+
+    <style name="UrlBar.EditLayout" parent="UrlBar.V17.EditLayout" />
+
+    <style name="UrlBar.V17.EditLayout" parent="UrlBar.Base.EditLayout">
+        <item name="android:paddingStart">0dp</item>
+        <item name="android:paddingEnd">12dp</item>
+        <item name="android:layout_toStartOf">@id/menu_items</item>
+        <item name="android:layout_toEndOf">@id/back</item>
+    </style>
+
+    <style name="UrlBar.DisplayLayout" parent="UrlBar.V17.DisplayLayout" />
+
+    <style name="UrlBar.V17.DisplayLayout" parent="UrlBar.Base.DisplayLayout">
+        <item name="android:layout_toStartOf">@id/menu_items</item>
+        <item name="android:layout_toEndOf">@id/back</item>
+        <item name="android:paddingStart">0dip</item>
+        <item name="android:paddingEnd">4dip</item>
+    </style>
+
+    <style name="UrlBar.EditCancel" parent="UrlBar.V17.EditCancel" />
+
+    <style name="UrlBar.V17.EditCancel" parent="UrlBar.Base.EditCancel">
+        <item name="android:layout_alignParentEnd">true</item>
+    </style>
+
+</resources>
--- a/mobile/android/base/resources/values-large/styles.xml
+++ b/mobile/android/base/resources/values-large/styles.xml
@@ -77,9 +77,115 @@
         <item name="android:paddingLeft">32dp</item>
         <item name="android:paddingRight">32dp</item>
     </style>
 
     <style name="TextAppearance.UrlBar.Title" parent="TextAppearance.Medium">
         <item name="android:textSize">16sp</item>
     </style>
 
+    <style name="UrlBar.Base" />
+
+    <style name="UrlBar.MenuMargin" parent="UrlBar.V15.MenuMargin" />
+
+    <style name="UrlBar.Base.MenuMargin" />
+
+    <style name="UrlBar.V15.MenuMargin" parent="UrlBar.Base.MenuMargin">
+        <item name="android:layout_alignParentRight">true</item>
+    </style>
+
+    <style name="UrlBar.Menu" parent="UrlBar.V15.Menu" />
+
+    <style name="UrlBar.Base.Menu" parent="UrlBar.ImageButton" />
+
+    <style name="UrlBar.V15.Menu" parent="UrlBar.Base.Menu">
+        <item name="android:layout_toLeftOf">@id/menu_margin</item>
+    </style>
+
+    <style name="UrlBar.MenuItem" parent="UrlBar.V15.MenuItem" />
+
+    <style name="UrlBar.Base.MenuItem" />
+
+    <style name="UrlBar.V15.MenuItem" parent="UrlBar.Base.MenuItem">
+        <item name="android:layout_marginLeft">6dp</item>
+        <item name="android:layout_toLeftOf">@id/tabs</item>
+    </style>
+
+    <style name="UrlBar.Tabs" parent="UrlBar.V15.Tabs" />
+
+    <style name="UrlBar.Base.Tabs" parent="UrlBar.ImageButton" />
+
+    <style name="UrlBar.V15.Tabs" parent="UrlBar.Base.Tabs">
+        <item name="android:layout_toLeftOf">@id/menu</item>
+    </style>
+
+    <style name="UrlBar.TabCounter" parent="UrlBar.V15.TabCounter" />
+
+    <style name="UrlBar.Base.TabCounter" parent="UrlBar.ImageButton" />
+
+    <style name="UrlBar.V15.TabCounter" parent="UrlBar.Base.TabCounter">
+        <item name="android:layout_alignLeft">@id/tabs</item>
+        <item name="android:layout_alignRight">@id/tabs</item>
+        <item name="android:layout_marginLeft">16dp</item>
+        <item name="android:layout_marginRight">16dp</item>
+        <item name="android:layout_toLeftOf">@id/menu</item>
+    </style>
+
+    <style name="UrlBar.Entry" parent="UrlBar.V15.Entry" />
+
+    <style name="UrlBar.Base.Entry" />
+
+    <style name="UrlBar.V15.Entry" parent="UrlBar.Base.Entry">
+        <item name="android:layout_alignLeft">@id/back</item>
+        <item name="android:layout_toLeftOf">@id/menu_items</item>
+        <item name="android:layout_marginLeft">@dimen/tablet_nav_button_width_half</item>
+    </style>
+
+    <style name="UrlBar.ForwardButton" parent="UrlBar.V15.ForwardButton" />
+
+    <style name="UrlBar.Base.ForwardButton" parent="UrlBar.ImageButton.BrowserToolbarColors" />
+
+    <style name="UrlBar.V15.ForwardButton" parent="UrlBar.Base.ForwardButton">
+        <item name="android:layout_alignLeft">@id/back</item>
+        <item name="android:layout_marginLeft">@dimen/tablet_nav_button_width_half</item>
+        <item name="android:paddingLeft">@dimen/tablet_fwd_button_padding_start</item>
+        <item name="android:paddingRight">@dimen/tablet_fwd_button_padding_end</item>
+    </style>
+
+    <style name="UrlBar.BackButton" parent="UrlBar.V15.BackButton" />
+
+    <style name="UrlBar.Base.BackButton" parent="UrlBar.ImageButton.BrowserToolbarColors" />
+
+    <style name="UrlBar.V15.BackButton" parent="UrlBar.Base.BackButton">
+        <item name="android:layout_marginLeft">12dp</item>
+        <item name="android:layout_alignParentLeft">true</item>
+    </style>
+
+    <style name="UrlBar.EditLayout" parent="UrlBar.V15.EditLayout" />
+
+    <style name="UrlBar.Base.EditLayout" parent="UrlBar.Button" />
+
+    <style name="UrlBar.V15.EditLayout" parent="UrlBar.Base.EditLayout">
+        <item name="android:paddingRight">12dp</item>
+        <item name="android:layout_toLeftOf">@id/menu_items</item>
+        <item name="android:layout_toRightOf">@id/back</item>
+    </style>
+
+    <style name="UrlBar.DisplayLayout" parent="UrlBar.V15.DisplayLayout" />
+
+    <style name="UrlBar.Base.DisplayLayout" parent="UrlBar.Button.Container" />
+
+    <style name="UrlBar.V15.DisplayLayout" parent="UrlBar.Base.DisplayLayout">
+        <item name="android:layout_toLeftOf">@id/menu_items</item>
+        <item name="android:layout_toRightOf">@id/back</item>
+        <item name="android:paddingLeft">0dip</item>
+        <item name="android:paddingRight">4dip</item>
+    </style>
+
+    <style name="UrlBar.EditCancel" parent="UrlBar.V15.EditCancel" />
+
+    <style name="UrlBar.Base.EditCancel" parent="UrlBar.ImageButton" />
+
+    <style name="UrlBar.V15.EditCancel" parent="UrlBar.Base.EditCancel">
+        <item name="android:layout_alignParentRight">true</item>
+    </style>
+
 </resources>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/values-v17/styles.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <style name="UrlBar.Entry" parent="UrlBar.V17.Entry" />
+
+    <style name="UrlBar.V17.Entry" parent="UrlBar.Base.Entry">
+        <item name="android:layout_marginStart">8dp</item>
+        <item name="android:layout_marginEnd">-6dp</item>
+        <item name="android:layout_toStartOf">@+id/tabs</item>
+    </style>
+
+    <style name="UrlBar.Edge" parent="UrlBar.V17.Edge" />
+
+    <style name="UrlBar.V17.Edge" parent="UrlBar.Base.Edge">
+        <item name="android:layout_alignStart">@id/url_bar_entry</item>
+        <item name="android:layout_alignEnd">@+id/url_bar_entry</item>
+    </style>
+
+    <style name="UrlBar.Menu" parent="UrlBar.V17.Menu" />
+
+    <style name="UrlBar.V17.Menu" parent="UrlBar.Base.Menu">
+        <item name="android:layout_alignParentEnd">true</item>
+    </style>
+
+    <style name="UrlBar.Tabs" parent="UrlBar.V17.Tabs" />
+
+    <style name="UrlBar.V17.Tabs" parent="UrlBar.Base.Tabs">
+        <item name="android:layout_toStartOf">@id/menu</item>
+    </style>
+
+    <style name="UrlBar.TabCounter" parent="UrlBar.V17.TabCounter" />
+
+    <style name="UrlBar.V17.TabCounter" parent="UrlBar.Base.TabCounter">
+        <item name="android:layout_marginEnd">8dip</item>
+        <item name="android:layout_alignEnd">@id/tabs</item>
+    </style>
+
+    <style name="UrlBar.EditCancel" parent="UrlBar.V17.EditCancel" />
+
+    <style name="UrlBar.V17.EditCancel" parent="UrlBar.Base.EditCancel">
+        <item name="android:layout_alignParentEnd">true</item>
+    </style>
+
+    <style name="UrlBar.EditLayout" parent="UrlBar.V17.EditLayout" />
+
+    <style name="UrlBar.V17.EditLayout" parent="UrlBar.Base.EditLayout">
+        <item name="android:layout_alignStart">@id/url_bar_entry</item>
+        <item name="android:layout_toStartOf">@id/edit_cancel</item>
+        <item name="android:paddingStart">8dp</item>
+        <item name="android:paddingEnd">8dp</item>
+    </style>
+
+    <style name="UrlBar.DisplayLayout" parent="UrlBar.V17.DisplayLayout" />
+
+    <style name="UrlBar.V17.DisplayLayout" parent="UrlBar.Base.DisplayLayout">
+        <item name="android:layout_alignStart">@id/url_bar_entry</item>
+        <item name="android:layout_alignEnd">@id/url_bar_entry</item>
+        <item name="android:paddingStart">1dip</item>
+        <item name="android:paddingEnd">4dip</item>
+    </style>
+
+</resources>
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -800,9 +800,68 @@
         <item name="android:listDivider">@drawable/as_contextmenu_divider</item>
     </style>
 
     <style name="ActivityStreamButton" parent="Widget.AppCompat.Button.Colored">
         <item name="colorButtonNormal">@color/link_blue</item>
         <item name="android:textColor">@android:color/white</item>
     </style>
 
+    <style name="UrlBar.Entry" parent="UrlBar.V15.Entry"/>
+    <style name="UrlBar.Base.Entry" parent="UrlBar.Button"/>
+    <style name="UrlBar.V15.Entry" parent="UrlBar.Base.Entry">
+        <item name="android:layout_marginLeft">8dp</item>
+        <item name="android:layout_marginRight">-6dp</item>
+        <item name="android:layout_toLeftOf">@+id/tabs</item>
+    </style>
+
+    <style name="UrlBar.Edge" parent="UrlBar.V15.Edge"/>
+    <style name="UrlBar.Base.Edge" parent="UrlBar.Button"/>
+    <style name="UrlBar.V15.Edge" parent="UrlBar.Base.Edge">
+        <item name="android:layout_alignLeft">@id/url_bar_entry</item>
+        <item name="android:layout_alignRight">@+id/url_bar_entry</item>
+    </style>
+
+    <style name="UrlBar.Menu" parent="UrlBar.V15.Menu"/>
+    <style name="UrlBar.Base.Menu" parent="UrlBar.ImageButton"/>
+    <style name="UrlBar.V15.Menu" parent="UrlBar.Base.Menu">
+        <item name="android:layout_alignParentRight">true</item>
+    </style>
+
+    <style name="UrlBar.Tabs" parent="UrlBar.V15.Tabs"/>
+    <style name="UrlBar.Base.Tabs" parent="UrlBar.ImageButton"/>
+    <style name="UrlBar.V15.Tabs" parent="UrlBar.Base.Tabs">
+        <item name="android:layout_toLeftOf">@id/menu</item>
+    </style>
+
+    <style name="UrlBar.TabCounter" parent="UrlBar.V15.TabCounter"/>
+    <style name="UrlBar.Base.TabCounter" parent="UrlBar.ImageButton"/>
+    <style name="UrlBar.V15.TabCounter" parent="UrlBar.Base.TabCounter">
+        <item name="android:layout_marginRight">8dip</item>
+        <item name="android:layout_alignRight">@id/tabs</item>
+    </style>
+
+    <style name="UrlBar.EditCancel" parent="UrlBar.V15.EditCancel"/>
+    <style name="UrlBar.Base.EditCancel" parent="UrlBar.ImageButton"/>
+    <style name="UrlBar.V15.EditCancel" parent="UrlBar.Base.EditCancel">
+        <item name="android:layout_alignParentRight">true</item>
+    </style>
+
+    <style name="UrlBar.EditLayout" parent="UrlBar.V15.EditLayout"/>
+    <style name="UrlBar.Base.EditLayout" parent="UrlBar.Button"/>
+    <style name="UrlBar.V15.EditLayout" parent="UrlBar.Base.EditLayout">
+        <item name="android:layout_alignLeft">@id/url_bar_entry</item>
+        <item name="android:layout_toLeftOf">@id/edit_cancel</item>
+        <item name="android:paddingLeft">8dp</item>
+        <item name="android:paddingRight">8dp</item>
+    </style>
+
+    <style name="UrlBar.DisplayLayout" parent="UrlBar.V15.DisplayLayout"/>
+    <style name="UrlBar.Base.DisplayLayout" parent="UrlBar.Button"/>
+
+    <style name="UrlBar.V15.DisplayLayout" parent="UrlBar.Base.DisplayLayout">
+        <item name="android:layout_alignLeft">@id/url_bar_entry</item>
+        <item name="android:layout_alignRight">@id/url_bar_entry</item>
+        <item name="android:paddingLeft">1dip</item>
+        <item name="android:paddingRight">4dip</item>
+    </style>
+
 </resources>