Backed out changeset efe3c7a0091c (bug 1016613) for causing bug 1054623 again
authorEd Morley <emorley@mozilla.com>
Mon, 18 Aug 2014 08:19:39 +0100
changeset 200022 0aaa2d3d15cc6341a6723e4e0b7ca9d9e72b14a0
parent 200021 37ac55a2601427374cf281b732852d94a9040111
child 200049 6b75f748388a317fb7b088613b5990c62757f07b
push id27329
push useremorley@mozilla.com
push dateMon, 18 Aug 2014 07:19:56 +0000
treeherdermozilla-central@0aaa2d3d15cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1016613, 1054623
milestone34.0a1
backs outefe3c7a0091cc92474e8381fb7aa25f861d4bd31
first release with
nightly linux32
0aaa2d3d15cc / 34.0a1 / 20140818030205 / files
nightly linux64
0aaa2d3d15cc / 34.0a1 / 20140818030205 / files
nightly mac
0aaa2d3d15cc / 34.0a1 / 20140818030205 / files
nightly win32
0aaa2d3d15cc / 34.0a1 / 20140818030205 / files
nightly win64
0aaa2d3d15cc / 34.0a1 / 20140818030205 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset efe3c7a0091c (bug 1016613) for causing bug 1054623 again
mobile/android/base/resources/layout-large-land-v11/tabs_panel.xml
mobile/android/base/resources/layout/remote_tabs_panel_view.xml
mobile/android/base/resources/layout/tabs_panel.xml
mobile/android/base/tabs/TabsPanel.java
--- a/mobile/android/base/resources/layout-large-land-v11/tabs_panel.xml
+++ b/mobile/android/base/resources/layout-large-land-v11/tabs_panel.xml
@@ -41,20 +41,21 @@
                                          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"/>
 
-        <ViewStub android:id="@+id/remote_tabs_panel_stub"
-                  android:layout="@layout/remote_tabs_panel_view"
-                  android:layout_width="match_parent"
-                  android:layout_height="match_parent"/>
+        <org.mozilla.gecko.tabs.RemoteTabsPanel
+                android:id="@+id/remote_tabs"
+                android:layout_height="match_parent"
+                android:layout_width="match_parent"
+                android:visibility="gone"/>
 
     </view>
 
     <RelativeLayout android:id="@+id/tabs_panel_footer"
                     android:layout_width="match_parent"
                     android:layout_height="@dimen/browser_toolbar_height">
 
         <view class="org.mozilla.gecko.tabs.TabsPanel$TabsPanelToolbar"
deleted file mode 100644
--- a/mobile/android/base/resources/layout/remote_tabs_panel_view.xml
+++ /dev/null
@@ -1,9 +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.RemoteTabsPanel xmlns:android="http://schemas.android.com/apk/res/android"
-                                        android:id="@+id/remote_tabs_panel"
-                                        android:layout_width="match_parent"
-                                        android:layout_height="match_parent"/>
--- a/mobile/android/base/resources/layout/tabs_panel.xml
+++ b/mobile/android/base/resources/layout/tabs_panel.xml
@@ -40,16 +40,17 @@
                                          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"/>
 
-        <ViewStub android:id="@+id/remote_tabs_panel_stub"
-                  android:layout="@layout/remote_tabs_panel_view"
-                  android:layout_width="match_parent"
-                  android:layout_height="match_parent"/>
+        <org.mozilla.gecko.tabs.RemoteTabsPanel
+                android:id="@+id/remote_tabs"
+                android:layout_height="match_parent"
+                android:layout_width="match_parent"
+                android:visibility="gone"/>
 
     </view>
 
 </merge>
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -27,17 +27,16 @@ import android.content.res.Resources;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
-import android.view.ViewStub;
 import android.widget.Button;
 import android.widget.FrameLayout;
 import android.widget.ImageButton;
 import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 
 public class TabsPanel extends LinearLayout
                        implements GeckoPopupMenu.OnMenuItemClickListener,
@@ -109,56 +108,43 @@ public class TabsPanel extends LinearLay
         LayoutInflater.from(context).inflate(R.layout.tabs_panel, this);
         initialize();
 
         mAppStateListener = new AppStateListener() {
             @Override
             public void onResume() {
                 if (mPanel == mPanelRemote) {
                     // Refresh the remote panel.
-                    getRemotePanelView().show();
+                    mPanelRemote.show();
                 }
             }
 
             @Override
             public void onOrientationChanged() {
                 // Remote panel is already refreshed by chrome refresh.
             }
 
             @Override
             public void onPause() {}
         };
     }
 
-    /**
-     * Initializes views in tabs_panel layout
-     *
-     * @throws IllegalStateException
-     *             mCurrentPanel must have a non-null value
-     */
     private void initialize() {
-        if (mCurrentPanel == null) {
-            throw new IllegalStateException(
-                    "mCurrentPanel cannot be null in order for RemotePanelView to be initialized");
-        }
-
-        if (mCurrentPanel == Panel.REMOTE_TABS) {
-            // Initializes mPanelRemote
-            getRemotePanelView();
-        }
-
         mHeader = (RelativeLayout) findViewById(R.id.tabs_panel_header);
         mTabsContainer = (TabsListContainer) 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);
 
+        mPanelRemote = (PanelView) findViewById(R.id.remote_tabs);
+        mPanelRemote.setTabsPanel(this);
+
         mFooter = (RelativeLayout) findViewById(R.id.tabs_panel_footer);
 
         mAddTab = (ImageButton) findViewById(R.id.add_tab);
         mAddTab.setOnClickListener(new Button.OnClickListener() {
             @Override
             public void onClick(View v) {
                 TabsPanel.this.addTab();
             }
@@ -425,17 +411,17 @@ public class TabsPanel extends LinearLay
         switch (panelToShow) {
             case NORMAL_TABS:
                 mPanel = mPanelNormal;
                 break;
             case PRIVATE_TABS:
                 mPanel = mPanelPrivate;
                 break;
             case REMOTE_TABS:
-                mPanel = getRemotePanelView();
+                mPanel = mPanelRemote;
                 break;
 
             default:
                 throw new IllegalArgumentException("Unknown panel type " + panelToShow);
         }
         mPanel.show();
 
         if (mCurrentPanel == Panel.REMOTE_TABS) {
@@ -481,19 +467,16 @@ public class TabsPanel extends LinearLay
             mPopupMenu.dismiss();
             dispatchLayoutChange(0, 0);
         }
     }
 
     public void refresh() {
         removeAllViews();
 
-        // The View that mPanelRemote points to is invalidated because the layout is invalidated.
-        // mPanelRemote must be null in order to properly initialize RemotePanelView.
-        mPanelRemote = null;
         LayoutInflater.from(mContext).inflate(R.layout.tabs_panel, this);
         initialize();
 
         if (mVisible)
             show(mCurrentPanel);
     }
 
     public void autoHidePanel() {
@@ -582,23 +565,9 @@ public class TabsPanel extends LinearLay
      */
     public Drawable getIconDrawable(Panel panel) {
         return mTabWidget.getIconDrawable(panel.ordinal());
     }
 
     public void setIconDrawable(Panel panel, int resource) {
         mTabWidget.setIconDrawable(panel.ordinal(), resource);
     }
-
-    /**
-     * Initializes mPanelRemote if necessary and provides getter because you
-     * should probably not access mPanelRemote directly
-     *
-     * @return PanelView
-     */
-    private PanelView getRemotePanelView() {
-        if (mPanelRemote == null) {
-            mPanelRemote = (PanelView) ((ViewStub) findViewById(R.id.remote_tabs_panel_stub)).inflate();
-            mPanelRemote.setTabsPanel(TabsPanel.this);
-        }
-        return mPanelRemote;
-    }
 }