Bug 831402: Tablets will have a split action-bar. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Wed, 16 Jan 2013 11:26:48 -0800
changeset 119171 154e9ce25e412ecc9df0c0ad50e8cbe25e40ef69
parent 119170 ce4d3552704d3bf08559510124da08eb52bbf6b7
child 119172 7b6b22881aaaa91da89e9a9f4642d24e911a5b0b
push id24195
push userMs2ger@gmail.com
push dateSat, 19 Jan 2013 16:10:11 +0000
treeherderautoland@02e12a80aef9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs831402
milestone21.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 831402: Tablets will have a split action-bar. [r=mfinkle]
mobile/android/base/Makefile.in
mobile/android/base/TabsPanel.java
mobile/android/base/resources/layout-xlarge-v11/tabs_panel.xml.in
mobile/android/base/resources/layout-xlarge-v11/tabs_panel_footer.xml
mobile/android/base/resources/layout-xlarge-v11/tabs_panel_header.xml
mobile/android/base/resources/layout-xlarge-v11/tabs_panel_toolbar_menu.xml
mobile/android/base/resources/layout/tabs_panel.xml.in
mobile/android/base/resources/layout/tabs_panel_header.xml
mobile/android/base/resources/layout/tabs_panel_toolbar_menu.xml
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -249,16 +249,17 @@ FENNEC_PP_XML_FILES = \
   res/layout-large-v11/browser_toolbar_menu.xml \
   res/layout-xlarge-v11/browser_toolbar_menu.xml \
   res/layout/gecko_app.xml \
   res/layout/tabs_panel.xml \
   res/layout/text_selection_handles.xml \
   res/layout-xlarge-land-v11/abouthome_content.xml \
   res/layout-xlarge-v11/awesomebar_search.xml \
   res/layout-xlarge-v11/gecko_app.xml \
+  res/layout-xlarge-v11/tabs_panel.xml \
   res/xml/preferences.xml \
   res/xml/searchable.xml \
   res/menu/browser_app_menu.xml \
   res/menu-v11/browser_app_menu.xml \
   res/menu-large-v11/browser_app_menu.xml \
   res/menu-xlarge-v11/browser_app_menu.xml \
   $(NULL)
 
@@ -401,17 +402,17 @@ RES_LAYOUT = \
   res/layout/site_setting_title.xml \
   res/layout/setup_screen.xml \
   res/layout/shared_ui_components.xml \
   res/layout/site_identity_popup.xml \
   res/layout/remote_tabs_child.xml \
   res/layout/remote_tabs_group.xml \
   res/layout/tabs_counter.xml \
   res/layout/tabs_panel_indicator.xml \
-  res/layout/tabs_panel_toolbar_menu.xml \
+  res/layout/tabs_panel_header.xml \
   res/layout/tabs_row.xml \
   res/layout/list_item_header.xml \
   res/layout/select_dialog_list.xml \
   res/layout/select_dialog_multichoice.xml \
   res/layout/abouthome_addon_row.xml \
   res/layout/abouthome_last_tabs_row.xml \
   res/layout/abouthome_section.xml \
   res/layout/abouthome_remote_tab_row.xml \
@@ -423,17 +424,18 @@ RES_LAYOUT_LARGE_V11 = \
   res/layout-large-v11/doorhangerpopup.xml \
   res/layout-large-v11/site_identity_popup.xml \
   $(NULL)
 
 RES_LAYOUT_XLARGE_V11 = \
   res/layout-xlarge-v11/font_size_preference.xml \
   res/layout-xlarge-v11/remote_tabs_child.xml \
   res/layout-xlarge-v11/remote_tabs_group.xml \
-  res/layout-xlarge-v11/tabs_panel_toolbar_menu.xml \
+  res/layout-xlarge-v11/tabs_panel_header.xml \
+  res/layout-xlarge-v11/tabs_panel_footer.xml \
   res/layout-xlarge-v11/tabs_row.xml \
   $(NULL)
 
 RES_VALUES = \
   $(SYNC_RES_VALUES) \
   res/values/attrs.xml \
   res/values/arrays.xml \
   res/values/colors.xml \
--- a/mobile/android/base/TabsPanel.java
+++ b/mobile/android/base/TabsPanel.java
@@ -47,17 +47,17 @@ public class TabsPanel extends TabHost
 
     public static interface TabsLayoutChangeListener {
         public void onTabsLayoutChange(int width, int height);
     }
 
     private Context mContext;
     private GeckoApp mActivity;
     private PanelView mPanel;
-    private TabsPanelToolbar mToolbar;
+    private TabsPanelToolbar mFooter;
     private TabsLayoutChangeListener mLayoutChangeListener;
 
     private static ImageButton mMenuButton;
     private static ImageButton mAddTab;
     private TabWidget mTabWidget;
     private Spinner mTabsSpinner;
 
     private Panel mCurrentPanel;
@@ -139,31 +139,31 @@ public class TabsPanel extends TabHost
                     panel = Panel.REMOTE_TABS;
 
                 TabsPanel.this.show(panel);
             }
         });
     }
 
     void initToolbar() {
-        mToolbar = (TabsPanelToolbar) findViewById(R.id.toolbar);
+        mFooter = (TabsPanelToolbar) findViewById(R.id.tabs_panel_footer);
 
         mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
 
-        mAddTab = (ImageButton) mToolbar.findViewById(R.id.add_tab);
+        mAddTab = (ImageButton) findViewById(R.id.add_tab);
         mAddTab.setOnClickListener(new Button.OnClickListener() {
             public void onClick(View v) {
                 TabsPanel.this.addTab();
             }
         });
 
-        mTabsSpinner = (Spinner) mToolbar.findViewById(R.id.tabs_menu);
+        mTabsSpinner = (Spinner) findViewById(R.id.tabs_menu);
         mTabsSpinner.setOnItemSelectedListener(this);
 
-        mMenuButton = (ImageButton) mToolbar.findViewById(R.id.menu);
+        mMenuButton = (ImageButton) findViewById(R.id.menu);
         mMenuButton.setOnClickListener(new Button.OnClickListener() {
             public void onClick(View view) {
                 TabsPanel.this.openTabsMenu();
             }
         });
 
         mPopupMenu.setAnchor(mMenuButton);
     }
@@ -299,18 +299,16 @@ public class TabsPanel extends TabHost
         public TabsPanelToolbar(Context context, AttributeSet attrs) {
             super(context, attrs);
             mActivity = (BrowserApp) context;
 
             setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                                                           (int) context.getResources().getDimension(R.dimen.browser_toolbar_height)));
 
             setOrientation(LinearLayout.HORIZONTAL);
-
-            LayoutInflater.from(context).inflate(R.layout.tabs_panel_toolbar_menu, this);
         }
 
         @Override
         public void onAttachedToWindow() {
             super.onAttachedToWindow();
             mActivity.getLightweightTheme().addListener(this);
         }
 
@@ -355,19 +353,25 @@ public class TabsPanel extends TabHost
         int index = panel.ordinal();
         setCurrentTab(index);
         mTabsSpinner.setSelection(index);
 
         mPanel = (PanelView) getTabContentView().getChildAt(index);
         mPanel.show();
 
         if (mCurrentPanel == Panel.REMOTE_TABS) {
+            if (mFooter != null)
+                mFooter.setVisibility(View.GONE);
+
             mAddTab.setVisibility(View.INVISIBLE);
             mMenuButton.setVisibility(View.INVISIBLE);
         } else {
+            if (mFooter != null)
+                mFooter.setVisibility(View.VISIBLE);
+
             mAddTab.setVisibility(View.VISIBLE);
             mAddTab.setImageLevel(index);
             mMenuButton.setVisibility(View.VISIBLE);
         }
 
         if (isSideBar()) {
             if (showAnimation)
                 dispatchLayoutChange(getWidth(), getHeight());
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout-xlarge-v11/tabs_panel.xml.in
@@ -0,0 +1,70 @@
+#filter substitution
+<?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/@ANDROID_PACKAGE_NAME@">
+
+    <LinearLayout android:layout_width="fill_parent"
+                  android:layout_height="fill_parent"
+                  android:orientation="vertical">
+
+        <view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
+              android:id="@+id/tabs_panel_header"
+              android:layout_width="fill_parent"
+              android:layout_height="@dimen/browser_toolbar_height">
+
+            <include layout="@layout/tabs_panel_header"/>
+
+        </view>
+
+        <View android:layout_width="fill_parent"
+              android:layout_height="2dp"
+              android:background="#FF313131"/>
+
+        <view class="org.mozilla.gecko.TabsPanel$TabsListContainer"
+              android:id="@android:id/tabcontent"
+              android:layout_width="fill_parent"
+              android:layout_height="0dip"
+              android:layout_weight="1.0">
+
+            <org.mozilla.gecko.TabsTray android:id="@+id/normal_tabs"
+                                        style="@style/TabsList"
+                                        android:layout_width="fill_parent"
+                                        android:layout_height="fill_parent"
+                                        gecko:tabs="tabs_normal"/>
+
+            <org.mozilla.gecko.TabsTray android:id="@+id/private_tabs"
+                                        style="@style/TabsList"
+                                        android:layout_width="fill_parent"
+                                        android:layout_height="fill_parent"
+                                        gecko:tabs="tabs_private"/>
+
+            <org.mozilla.gecko.RemoteTabs android:id="@+id/synced_tabs"
+                                          style="@style/RemoteTabsList"
+                                          android:layout_width="fill_parent"
+                                          android:layout_height="fill_parent"
+                                          android:paddingLeft="@dimen/tabs_panel_list_padding"
+                                          android:paddingRight="@dimen/tabs_panel_list_padding"
+                                          android:scrollbarStyle="outsideOverlay"/>
+
+        </view>
+
+        <View android:layout_width="fill_parent"
+              android:layout_height="2dp"
+              android:background="#FF313131"/>
+
+        <view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
+              android:id="@+id/tabs_panel_footer"
+              android:layout_width="fill_parent"
+              android:layout_height="@dimen/browser_toolbar_height">
+
+            <include layout="@layout/tabs_panel_footer"/>
+
+        </view>
+
+   </LinearLayout>
+
+</merge>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout-xlarge-v11/tabs_panel_footer.xml
@@ -0,0 +1,28 @@
+<?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">
+
+    <ImageButton android:id="@+id/add_tab"
+                 android:layout_width="@dimen/browser_toolbar_height"
+                 android:layout_height="@dimen/browser_toolbar_height"
+                 android:padding="14dip"
+                 android:src="@drawable/tab_new_level"
+                 android:contentDescription="@string/new_tab"
+                 android:background="@drawable/action_bar_button"/>
+
+    <View android:layout_width="0dip"
+          android:layout_height="@dimen/browser_toolbar_height"
+          android:layout_weight="1.0"/>
+
+    <ImageButton android:id="@+id/menu"
+                 android:layout_width="@dimen/browser_toolbar_height"
+                 android:layout_height="@dimen/browser_toolbar_height"
+                 android:padding="14dip"
+                 android:src="@drawable/tabs_menu"
+                 android:contentDescription="@string/menu"
+                 android:background="@drawable/action_bar_button"/>
+
+</merge>
rename from mobile/android/base/resources/layout-xlarge-v11/tabs_panel_toolbar_menu.xml
rename to mobile/android/base/resources/layout-xlarge-v11/tabs_panel_header.xml
--- a/mobile/android/base/resources/layout-xlarge-v11/tabs_panel_toolbar_menu.xml
+++ b/mobile/android/base/resources/layout-xlarge-v11/tabs_panel_header.xml
@@ -6,40 +6,19 @@
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
 
     <TabWidget android:id="@android:id/tabs"
                android:layout_width="0dip"
                android:layout_height="0dip"
                android:visibility="gone"/>
 
     <Spinner android:id="@+id/tabs_menu"
-             android:layout_width="0dip"
+             android:layout_width="fill_parent"
              android:layout_height="fill_parent"
-             android:layout_weight="1.0"
+             android:layout_marginLeft="12dp"
+             android:layout_marginRight="12dp"
              android:background="@drawable/spinner"
              android:popupBackground="@drawable/menu_popup_bg"
              android:dropDownHorizontalOffset="0dip"
              android:dropDownSelector="@drawable/action_bar_button"
              android:entries="@array/tabs_panel_spinner"/>
 
-    <ImageButton android:id="@+id/add_tab"
-                 android:layout_width="@dimen/browser_toolbar_height"
-                 android:layout_height="@dimen/browser_toolbar_height"
-                 android:paddingTop="15dip"
-                 android:paddingBottom="15dip"
-                 android:paddingLeft="20dip"
-                 android:paddingRight="20dip"
-                 android:src="@drawable/tab_new_level"
-                 android:contentDescription="@string/new_tab"
-                 android:background="@drawable/action_bar_button"/>
-
-    <ImageButton android:id="@+id/menu"
-                 android:layout_width="@dimen/browser_toolbar_height"
-                 android:layout_height="@dimen/browser_toolbar_height"
-                 android:paddingTop="15dip"
-                 android:paddingBottom="15dip"
-                 android:paddingLeft="20dip"
-                 android:paddingRight="20dip"
-                 android:src="@drawable/tabs_menu"
-                 android:contentDescription="@string/menu"
-                 android:background="@drawable/action_bar_button"/>
-
 </merge>
--- a/mobile/android/base/resources/layout/tabs_panel.xml.in
+++ b/mobile/android/base/resources/layout/tabs_panel.xml.in
@@ -7,19 +7,23 @@
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@">
 
     <LinearLayout android:layout_width="fill_parent"
                   android:layout_height="wrap_content"
                   android:orientation="vertical">
 
         <view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
-              android:id="@+id/toolbar"
+              android:id="@+id/tabs_panel_header"
               android:layout_width="fill_parent"
-              android:layout_height="@dimen/browser_toolbar_height"/>
+              android:layout_height="@dimen/browser_toolbar_height">
+
+            <include layout="@layout/tabs_panel_header"/>
+
+        </view>
 
         <View android:layout_width="fill_parent"
               android:layout_height="2dp"
               android:background="#FF313131"/>
 
         <view class="org.mozilla.gecko.TabsPanel$TabsListContainer"
               android:id="@android:id/tabcontent"
               android:layout_width="fill_parent"
rename from mobile/android/base/resources/layout/tabs_panel_toolbar_menu.xml
rename to mobile/android/base/resources/layout/tabs_panel_header.xml