Backed out changeset efe3c7a0091c (bug 1016613) for causing bug 1054623 again

This commit is contained in:
Ed Morley 2014-08-18 08:19:39 +01:00
parent 2bc0ede161
commit 89c608961e
4 changed files with 15 additions and 53 deletions

View File

@ -46,10 +46,11 @@
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>

View File

@ -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"/>

View File

@ -45,10 +45,11 @@
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>

View File

@ -32,7 +32,6 @@ 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;
@ -114,7 +113,7 @@ public class TabsPanel extends LinearLayout
public void onResume() {
if (mPanel == mPanelRemote) {
// Refresh the remote panel.
getRemotePanelView().show();
mPanelRemote.show();
}
}
@ -128,23 +127,7 @@ public class TabsPanel extends LinearLayout
};
}
/**
* 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);
@ -154,6 +137,9 @@ public class TabsPanel extends LinearLayout
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);
@ -430,7 +416,7 @@ public class TabsPanel extends LinearLayout
mPanel = mPanelPrivate;
break;
case REMOTE_TABS:
mPanel = getRemotePanelView();
mPanel = mPanelRemote;
break;
default:
@ -486,9 +472,6 @@ public class TabsPanel extends LinearLayout
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();
@ -587,18 +570,4 @@ public class TabsPanel extends LinearLayout
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;
}
}