Bug 1016613 - Replaced RemoteTabsPanel view with ViewStub in tabs_panel.xml and created new layout file to inflate the ViewStub when user clicks on 3rd button in TabsPanel. r=mcomella

This commit is contained in:
Ethan Pransky 2014-06-28 17:44:00 +02:00
parent 6cd38b6870
commit ed7596fec8
4 changed files with 27 additions and 13 deletions

View File

@ -46,11 +46,10 @@
android:layout_height="match_parent"
android:visibility="gone"/>
<org.mozilla.gecko.tabspanel.RemoteTabsPanel
android:id="@+id/remote_tabs"
android:layout_height="match_parent"
android:layout_width="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"/>
</view>

View File

@ -0,0 +1,9 @@
<?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.tabspanel.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,12 +45,11 @@
android:layout_height="match_parent"
android:visibility="gone"/>
<org.mozilla.gecko.tabspanel.RemoteTabsPanel
android:id="@+id/remote_tabs"
android:layout_height="match_parent"
android:layout_width="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"/>
</view>
</merge>

View File

@ -31,6 +31,7 @@ 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;
@ -117,6 +118,7 @@ public class TabsPanel extends LinearLayout
public void onResume() {
if (mPanel == mPanelRemote) {
// Refresh the remote panel.
initializeRemotePanelView();
mPanelRemote.show();
}
}
@ -141,9 +143,6 @@ 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);
@ -407,6 +406,7 @@ public class TabsPanel extends LinearLayout
mPanel = mPanelPrivate;
break;
case REMOTE_TABS:
initializeRemotePanelView();
mPanel = mPanelRemote;
break;
@ -555,4 +555,11 @@ public class TabsPanel extends LinearLayout
public void setIconDrawable(Panel panel, int resource) {
mTabWidget.setIconDrawable(panel.ordinal(), resource);
}
private void initializeRemotePanelView() {
if (mPanelRemote == null) {
mPanelRemote = (PanelView) ((ViewStub) findViewById(R.id.remote_tabs_panel_stub)).inflate();
mPanelRemote.setTabsPanel(TabsPanel.this);
}
}
}