Bug 1066546 - Part 2 - configure tabs panel to use correct layout for new tablet ui (r=lucasr)
rename from mobile/android/base/resources/layout-large-land-v11/tabs_panel.xml
rename to mobile/android/base/resources/layout-large-land-v11/tabs_panel_sidebar.xml
rename from mobile/android/base/resources/layout/tabs_panel.xml
rename to mobile/android/base/resources/layout/tabs_panel_default.xml
copy from mobile/android/base/resources/values/layout.xml
copy to mobile/android/base/resources/values-large-land-v11/layout.xml
--- a/mobile/android/base/resources/values/layout.xml
+++ b/mobile/android/base/resources/values-large-land-v11/layout.xml
@@ -1,10 +1,8 @@
<?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/. -->
<resources>
- <item type="layout" name="tabs_layout_item_view">@layout/tabs_item_row</item>
- <item type="layout" name="new_tablet_browser_toolbar">@null</item>
- <item type="layout" name="new_tablet_tab_strip">@null</item>
+ <item type="layout" name="tabs_panel">@layout/tabs_panel_sidebar</item>
</resources>
--- a/mobile/android/base/resources/values/layout.xml
+++ b/mobile/android/base/resources/values/layout.xml
@@ -1,10 +1,11 @@
<?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/. -->
<resources>
+ <item type="layout" name="tabs_panel">@layout/tabs_panel_default</item>
<item type="layout" name="tabs_layout_item_view">@layout/tabs_item_row</item>
<item type="layout" name="new_tablet_browser_toolbar">@null</item>
<item type="layout" name="new_tablet_tab_strip">@null</item>
</resources>
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -114,17 +114,17 @@ public class TabsPanel extends LinearLay
setOrientation(LinearLayout.VERTICAL);
mCurrentPanel = Panel.NORMAL_TABS;
mPopupMenu = new GeckoPopupMenu(context);
mPopupMenu.inflate(R.menu.tabs_menu);
mPopupMenu.setOnMenuItemClickListener(this);
- LayoutInflater.from(context).inflate(R.layout.tabs_panel, this);
+ inflateLayout(context);
initialize();
mAppStateListener = new AppStateListener() {
@Override
public void onResume() {
if (mPanel == mPanelRemote) {
// Refresh the remote panel.
mPanelRemote.show();
@@ -136,16 +136,25 @@ public class TabsPanel extends LinearLay
// Remote panel is already refreshed by chrome refresh.
}
@Override
public void onPause() {}
};
}
+
+ private void inflateLayout(Context context) {
+ if (NewTabletUI.isEnabled(context)) {
+ LayoutInflater.from(context).inflate(R.layout.tabs_panel_default, this);
+ } else {
+ LayoutInflater.from(context).inflate(R.layout.tabs_panel, this);
+ }
+ }
+
private void initialize() {
mHeader = (RelativeLayout) findViewById(R.id.tabs_panel_header);
mPanelsContainer = (PanelViewContainer) findViewById(R.id.tabs_container);
mPanelNormal = (PanelView) findViewById(R.id.normal_tabs);
mPanelNormal.setTabsPanel(this);
mPanelPrivate = (PanelView) findViewById(R.id.private_tabs_panel);