Bug 1195216 - Last tab is cut off in tab tray in portrait; r=mcomella
authorMartyn Haigh <mhaigh@mozilla.org>
Mon, 17 Aug 2015 15:16:42 +0100
changeset 258183 746ac829b15af5cd065d6866de6a7e074ad34a47
parent 258182 b220196bb58d0803666bb53aa46d9a1552cd3491
child 258184 1fe85780ea7cb156785f85241bf333940642428a
child 258361 73cc126362279317b85a4b2e595489c39d8cfb47
push id63843
push userryanvm@gmail.com
push dateTue, 18 Aug 2015 14:58:06 +0000
treeherdermozilla-inbound@d55e24c983aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1195216
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 1195216 - Last tab is cut off in tab tray in portrait; r=mcomella
mobile/android/base/resources/layout/private_tabs_panel.xml
mobile/android/base/resources/layout/tabs_panel_default.xml
mobile/android/base/tabs/PrivateTabsPanel.java
mobile/android/base/tabs/TabsPanel.java
--- a/mobile/android/base/resources/layout/private_tabs_panel.xml
+++ b/mobile/android/base/resources/layout/private_tabs_panel.xml
@@ -1,30 +1,21 @@
 <?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">
 
-    <FrameLayout android:id="@+id/private_tabs_empty"
-                 android:layout_width="match_parent"
-                 android:layout_height="match_parent">
-
-        <!-- TODO: Remove the negative marginTop once we get rid of the 
-                   browser chrome at the bottom of the tabs tray. 
-                   Bug 1161638 -->
-        <ImageView android:layout_height="wrap_content"
-                   android:layout_width="wrap_content"
-                   android:src="@drawable/private_masq"
-                   android:layout_gravity="center"
-                   android:layout_marginTop="-10dp"/>
-
-    </FrameLayout>
+    <ImageView android:id="@+id/private_tabs_empty"
+               android:layout_height="wrap_content"
+               android:layout_width="wrap_content"
+               android:src="@drawable/private_masq"
+               android:layout_gravity="center"/>
 
     <!-- Note: for an unknown reason, scrolling in the TabsLayout
          does not work unless it is laid out after the empty view. -->
     <view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayout"
           android:id="@+id/private_tabs_layout"
           style="@style/TabsLayout"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
--- a/mobile/android/base/resources/layout/tabs_panel_default.xml
+++ b/mobile/android/base/resources/layout/tabs_panel_default.xml
@@ -56,31 +56,31 @@
 
         <View android:layout_width="match_parent"
               android:layout_height="2dp"
               android:layout_alignParentBottom="true"
               android:background="#1A000000"/>
 
     </RelativeLayout>
 
-    <view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayoutContainer"
+    <FrameLayout
           android:id="@+id/tabs_container"
           android:layout_width="match_parent"
-          android:layout_height="wrap_content">
+          android:layout_height="match_parent">
 
         <view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayout"
               android:id="@+id/normal_tabs"
               style="@style/TabsLayout"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:choiceMode="singleChoice"
               android:visibility="gone"
               gecko:tabs="tabs_normal"/>
 
         <org.mozilla.gecko.tabs.PrivateTabsPanel
                 android:id="@+id/private_tabs_panel"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:visibility="gone"/>
 
-    </view>
+    </FrameLayout>
 
 </merge>
--- a/mobile/android/base/tabs/PrivateTabsPanel.java
+++ b/mobile/android/base/tabs/PrivateTabsPanel.java
@@ -27,17 +27,17 @@ class PrivateTabsPanel extends FrameLayo
     private final TabsLayout tabsLayout;
 
     public PrivateTabsPanel(Context context, AttributeSet attrs) {
         super(context, attrs);
 
         LayoutInflater.from(context).inflate(R.layout.private_tabs_panel, this);
         tabsLayout = (TabsLayout) findViewById(R.id.private_tabs_layout);
 
-        final ViewGroup emptyTabsFrame = (ViewGroup) findViewById(R.id.private_tabs_empty);
+        final View emptyTabsFrame = findViewById(R.id.private_tabs_empty);
         tabsLayout.setEmptyView(emptyTabsFrame);
     }
 
     @Override
     public void setTabsPanel(TabsPanel panel) {
         tabsLayout.setTabsPanel(panel);
     }
 
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -78,17 +78,17 @@ public class TabsPanel extends LinearLay
     public interface TabsLayoutChangeListener {
         void onTabsLayoutChange(int width, int height);
     }
 
     private final Context mContext;
     private final GeckoApp mActivity;
     private final LightweightTheme mTheme;
     private RelativeLayout mHeader;
-    private TabsLayoutContainer mTabsContainer;
+    private FrameLayout mTabsContainer;
     private PanelView mPanel;
     private PanelView mPanelNormal;
     private PanelView mPanelPrivate;
     private TabsLayoutChangeListener mLayoutChangeListener;
 
     private IconTabWidget mTabWidget;
     private static ImageButton mMenuButton;
     private static ImageButton mAddTab;
@@ -117,17 +117,17 @@ public class TabsPanel extends LinearLay
     }
 
     private void inflateLayout(Context context) {
         LayoutInflater.from(context).inflate(R.layout.tabs_panel_default, this);
     }
 
     private void initialize() {
         mHeader = (RelativeLayout) findViewById(R.id.tabs_panel_header);
-        mTabsContainer = (TabsLayoutContainer) findViewById(R.id.tabs_container);
+        mTabsContainer = (FrameLayout) findViewById(R.id.tabs_container);
 
         mPanelNormal = (PanelView) findViewById(R.id.normal_tabs);
         mPanelNormal.setTabsPanel(this);
 
         mPanelPrivate = (PanelView) findViewById(R.id.private_tabs_panel);
         mPanelPrivate.setTabsPanel(this);
 
         mAddTab = (ImageButton) findViewById(R.id.add_tab);
@@ -239,17 +239,17 @@ public class TabsPanel extends LinearLay
 
         if (itemId == R.id.new_tab || itemId == R.id.new_private_tab) {
             hide();
         }
 
         return mActivity.onOptionsItemSelected(item);
     }
 
-    private static int getTabContainerHeight(TabsLayoutContainer tabsContainer) {
+    private static int getTabContainerHeight(View tabsContainer) {
         Resources resources = tabsContainer.getContext().getResources();
 
         int screenHeight = resources.getDisplayMetrics().heightPixels;
 
         int actionBarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height);
 
         return screenHeight - actionBarHeight;
     }
@@ -284,28 +284,16 @@ public class TabsPanel extends LinearLay
     }
 
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         super.onLayout(changed, left, top, right, bottom);
         onLightweightThemeChanged();
     }
 
-    static class TabsLayoutContainer extends FrameLayout {
-        public TabsLayoutContainer(Context context, AttributeSet attrs) {
-            super(context, attrs);
-        }
-
-        @Override
-        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-            int heightSpec = MeasureSpec.makeMeasureSpec(getTabContainerHeight(TabsLayoutContainer.this), MeasureSpec.EXACTLY);
-            super.onMeasure(widthMeasureSpec, heightSpec);
-        }
-    }
-
     // Tabs Panel Toolbar contains the Buttons
     static class TabsPanelToolbar extends LinearLayout
                                   implements LightweightTheme.OnChangeListener {
         private final LightweightTheme mTheme;
 
         public TabsPanelToolbar(Context context, AttributeSet attrs) {
             super(context, attrs);
             mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();