Bug 1204851 - Revert back button removal; r=mfinkle, a=lizzard
authorMartyn Haigh <mhaigh@mozilla.org>
Tue, 15 Sep 2015 13:00:02 +0100
changeset 297947 62a2e70914d52c8901ffb0dda6682ae5e7d2bf6c
parent 297946 b52adde0a6674da8a3b6e8c23454fec76914710f
child 297948 e4d519b591dd2dee8ee80363ef12cb0ad69a2637
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lizzard
bugs1204851
milestone43.0a2
Bug 1204851 - Revert back button removal; r=mfinkle, a=lizzard
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/tabs/TabsPanel.java
rename from mobile/android/base/resources/drawable-hdpi/tabs_panel_nav_back.png
rename to mobile/android/base/resources/drawable-large-hdpi-v11/tabs_panel_nav_back.png
rename from mobile/android/base/resources/drawable-xhdpi/tabs_panel_nav_back.png
rename to mobile/android/base/resources/drawable-large-xhdpi-v11/tabs_panel_nav_back.png
rename from mobile/android/base/resources/drawable-xxhdpi/tabs_panel_nav_back.png
rename to mobile/android/base/resources/drawable-large-xxhdpi-v11/tabs_panel_nav_back.png
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout-large-v11/tabs_panel_back_button.xml
@@ -0,0 +1,17 @@
+<?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,25 +13,20 @@
                     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">
 
-            <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"/>
+            <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.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/tab_panel_divider_vertical_padding"
                                                     android:layout="@layout/tabs_panel_indicator"/>
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -156,23 +156,26 @@ public class TabsPanel extends LinearLay
         mMenuButton = findViewById(R.id.menu);
         mMenuButton.setOnClickListener(new Button.OnClickListener() {
             @Override
             public void onClick(View view) {
                 showMenu();
             }
         });
 
-        mNavBackButton = (ImageButton) findViewById(R.id.nav_back);
-        mNavBackButton.setOnClickListener(new Button.OnClickListener() {
+        if (AppConstants.NIGHTLY_BUILD || HardwareUtils.isTablet()) {
+            ViewStub backButtonStub = (ViewStub) findViewById(R.id.nav_back_stub);
+            mNavBackButton = (ImageButton) backButtonStub.inflate( );
+            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