Bug 1200619 - Implement back button to mobile tabs tray; r=mcomella
authorMartyn Haigh <mhaigh@mozilla.org>
Fri, 11 Sep 2015 15:22:46 +0100
changeset 294873 2aa3e68dec24086d678c2e544685f4b73bec6afd
parent 294872 93ab4d92079dc19bf60f00b752c968936ab7a888
child 294874 9e23f327657187fc2a38bd4220c75503e7a8a96d
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1200619
milestone43.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 1200619 - Implement back button to mobile tabs tray; r=mcomella
mobile/android/base/resources/drawable-hdpi/tabs_panel_nav_back.png
mobile/android/base/resources/drawable-large-hdpi-v11/tabs_panel_nav_back.png
mobile/android/base/resources/drawable-large-xhdpi-v11/tabs_panel_nav_back.png
mobile/android/base/resources/drawable-large-xxhdpi-v11/tabs_panel_nav_back.png
mobile/android/base/resources/drawable-xhdpi/tabs_panel_nav_back.png
mobile/android/base/resources/drawable-xxhdpi/tabs_panel_nav_back.png
mobile/android/base/resources/layout-large-v11/tabs_panel_back_button.xml
mobile/android/base/resources/layout/tabs_panel_default.xml
mobile/android/base/resources/values/dimens.xml
mobile/android/base/resources/values/layout.xml
mobile/android/base/tabs/TabsPanel.java
rename from mobile/android/base/resources/drawable-large-hdpi-v11/tabs_panel_nav_back.png
rename to mobile/android/base/resources/drawable-hdpi/tabs_panel_nav_back.png
rename from mobile/android/base/resources/drawable-large-xhdpi-v11/tabs_panel_nav_back.png
rename to mobile/android/base/resources/drawable-xhdpi/tabs_panel_nav_back.png
rename from mobile/android/base/resources/drawable-large-xxhdpi-v11/tabs_panel_nav_back.png
rename to mobile/android/base/resources/drawable-xxhdpi/tabs_panel_nav_back.png
deleted file mode 100644
--- a/mobile/android/base/resources/layout-large-v11/tabs_panel_back_button.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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/. -->
-
-<org.mozilla.gecko.tabs.TabPanelBackButton xmlns:android="http://schemas.android.com/apk/res/android"
-                                           xmlns:gecko="http://schemas.android.com/apk/res-auto"
-                                           android:id="@+id/nav_back"
-                                           android:layout_width="@dimen/tabs_panel_button_width"
-                                           android:layout_height="match_parent"
-                                           android:minWidth="@dimen/tabs_panel_button_width"
-                                           android:src="@drawable/tabs_panel_nav_back"
-                                           android:contentDescription="@string/back"
-                                           android:background="@drawable/action_bar_button_inverse"
-                                           gecko:dividerVerticalPadding="@dimen/tablet_tab_panel_divider_vertical_padding"
-                                           gecko:rightDivider="@drawable/tab_indicator_divider"/>
-
--- a/mobile/android/base/resources/layout/tabs_panel_default.xml
+++ b/mobile/android/base/resources/layout/tabs_panel_default.xml
@@ -13,27 +13,32 @@
                     android:layout_width="match_parent"
                     android:layout_height="@dimen/browser_toolbar_height">
 
         <view class="org.mozilla.gecko.tabs.TabsPanel$TabsPanelToolbar"
               android:layout_width="match_parent"
               android:layout_height="@dimen/browser_toolbar_height"
               android:background="@color/text_and_tabs_tray_grey">
 
-            <ViewStub android:id="@+id/nav_back_stub"
-                      android:layout="@layout/tabs_panel_back_button"
-                      android:layout_width="wrap_content"
-                      android:layout_height="match_parent"/>
+            <org.mozilla.gecko.tabs.TabPanelBackButton android:id="@+id/nav_back"
+                                                       android:layout_width="@dimen/tabs_panel_button_width"
+                                                       android:layout_height="match_parent"
+                                                       android:minWidth="@dimen/tabs_panel_button_width"
+                                                       android:src="@drawable/tabs_panel_nav_back"
+                                                       android:contentDescription="@string/back"
+                                                       android:background="@drawable/action_bar_button_inverse"
+                                                       gecko:dividerVerticalPadding="@dimen/tab_panel_divider_vertical_padding"
+                                                       gecko:rightDivider="@drawable/tab_indicator_divider"/>
 
             <org.mozilla.gecko.widget.IconTabWidget android:id="@+id/tab_widget"
                                                     android:layout_width="wrap_content"
                                                     android:layout_height="match_parent"
                                                     android:tabStripEnabled="false"
                                                     android:divider="@drawable/tab_indicator_divider"
-                                                    android:dividerPadding="@dimen/tablet_tab_panel_divider_vertical_padding"
+                                                    android:dividerPadding="@dimen/tab_panel_divider_vertical_padding"
                                                     android:layout="@layout/tabs_panel_indicator"/>
 
             <View android:layout_width="0dip"
                   android:layout_height="match_parent"
                   android:layout_weight="1.0"/>
 
             <ImageButton android:id="@+id/add_tab"
                          style="@style/UrlBar.ImageButton"
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -30,17 +30,17 @@
 
     <!-- If you update one of these values, update the others. -->
     <dimen name="tablet_nav_button_width">42dp</dimen>
     <dimen name="tablet_nav_button_width_half">21dp</dimen>
     <dimen name="tablet_nav_button_width_plus_half">63dp</dimen>
 
     <!-- This is the system default for the vertical padding for the divider of the TabWidget.
          Used to mimic the divider padding on the tablet tabs panel back button. -->
-    <dimen name="tablet_tab_panel_divider_vertical_padding">12dp</dimen>
+    <dimen name="tab_panel_divider_vertical_padding">12dp</dimen>
 
     <dimen name="tablet_tab_strip_height">48dp</dimen>
     <dimen name="tablet_tab_strip_item_width">208dp</dimen>
     <dimen name="tablet_tab_strip_item_margin">-28dp</dimen>
     <dimen name="tablet_tab_strip_fading_edge_size">15dp</dimen>
     <dimen name="tablet_browser_toolbar_menu_item_width">56dp</dimen>
     <!-- Padding combines with an 18dp image to form the menu item width and height. -->
     <dimen name="tablet_browser_toolbar_menu_item_padding_horizontal">19dp</dimen>
--- a/mobile/android/base/resources/values/layout.xml
+++ b/mobile/android/base/resources/values/layout.xml
@@ -4,10 +4,9 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <resources>
     <!-- These items are v11+ resources but are referenced in code shipped with
          API 9 builds. Since v11+ resources don't ship on API 9 builds, in order
          for the resource ID to be found (and thus compilation to succeed), we
          provide dummy values below. -->
     <item type="layout" name="tab_strip">@null</item>
-    <item type="layout" name="tabs_panel_back_button">@null</item>
 </resources>
\ No newline at end of file
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -156,26 +156,23 @@ public class TabsPanel extends LinearLay
         mMenuButton = findViewById(R.id.menu);
         mMenuButton.setOnClickListener(new Button.OnClickListener() {
             @Override
             public void onClick(View view) {
                 showMenu();
             }
         });
 
-        if (HardwareUtils.isTablet()) {
-            ViewStub backButtonStub = (ViewStub) findViewById(R.id.nav_back_stub);
-            mNavBackButton = (ImageButton) backButtonStub.inflate( );
-            mNavBackButton.setOnClickListener(new Button.OnClickListener() {
+        mNavBackButton = (ImageButton) findViewById(R.id.nav_back);
+        mNavBackButton.setOnClickListener(new Button.OnClickListener() {
                 @Override
                 public void onClick(View view) {
                     mActivity.onBackPressed();
                 }
             });
-        }
     }
 
     public void showMenu() {
         final Menu menu = mPopupMenu.getMenu();
 
         // Each panel has a "+" shortcut button, so don't show it for that panel.
         menu.findItem(R.id.new_tab).setVisible(mCurrentPanel != Panel.NORMAL_TABS);
         menu.findItem(R.id.new_private_tab).setVisible(mCurrentPanel != Panel.PRIVATE_TABS