From 50f0e098c0588c8f9262aa20b533b51b2f608ea4 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Thu, 2 Apr 2015 10:45:31 -0700 Subject: [PATCH] Bug 1106935 - Remove references to old tablet sidebar. r=mhaigh --HG-- extra : rebase_source : 3d9f84589872bfb74c1a1040b525f042c7c9cebb --- mobile/android/base/BaseGeckoInterface.java | 5 - mobile/android/base/BrowserApp.java | 51 +--------- mobile/android/base/GeckoAppShell.java | 1 - .../tabs_panel_sidebar.xml | 96 ------------------- .../resources/layout/tabs_panel_default.xml | 5 - .../android/base/resources/values/dimens.xml | 1 - mobile/android/base/tabs/TabsPanel.java | 82 ++-------------- .../android/base/toolbar/BrowserToolbar.java | 25 +++-- mobile/android/base/webapp/WebappImpl.java | 3 - 9 files changed, 25 insertions(+), 244 deletions(-) delete mode 100644 mobile/android/base/resources/layout-large-land-v11/tabs_panel_sidebar.xml diff --git a/mobile/android/base/BaseGeckoInterface.java b/mobile/android/base/BaseGeckoInterface.java index cc73e4a00b4e..002171a6852e 100644 --- a/mobile/android/base/BaseGeckoInterface.java +++ b/mobile/android/base/BaseGeckoInterface.java @@ -143,11 +143,6 @@ public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface { GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Update:CheckResult", result)); } - @Override - public boolean hasTabsSideBar() { - return false; - } - // Bug 908792: Implement this @Override public void invalidateOptionsMenu() {} diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index 256e33556182..7674831f359e 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -87,7 +87,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; -import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; @@ -1494,9 +1493,6 @@ public class BrowserApp extends GeckoApp mBrowserChrome.setVisibility(View.VISIBLE); } else { mBrowserChrome.setVisibility(View.GONE); - if (hasTabsSideBar()) { - hideTabs(); - } } } }); @@ -1521,7 +1517,6 @@ public class BrowserApp extends GeckoApp if (mTabsPanel != null) { mRootLayout.reset(); - updateSideBarState(); mTabsPanel.refresh(); } @@ -1532,38 +1527,6 @@ public class BrowserApp extends GeckoApp mBrowserToolbar.refresh(); } - @Override - public boolean hasTabsSideBar() { - return (mTabsPanel != null && mTabsPanel.isSideBar()); - } - - private boolean isSideBar() { - return (HardwareUtils.isTablet() && getOrientation() == Configuration.ORIENTATION_LANDSCAPE); - } - - private void updateSideBarState() { - if (NewTabletUI.isEnabled(this)) { - return; - } - - if (mMainLayoutAnimator != null) - mMainLayoutAnimator.stop(); - - boolean isSideBar = isSideBar(); - final int sidebarWidth = getResources().getDimensionPixelSize(R.dimen.tabs_sidebar_width); - - ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) mTabsPanel.getLayoutParams(); - lp.width = (isSideBar ? sidebarWidth : ViewGroup.LayoutParams.MATCH_PARENT); - mTabsPanel.requestLayout(); - - final boolean sidebarIsShown = (isSideBar && mTabsPanel.isShown()); - final int mainLayoutScrollX = (sidebarIsShown ? -sidebarWidth : 0); - mMainLayout.scrollTo(mainLayoutScrollX, 0); - - mTabsPanel.setIsSideBar(isSideBar); - mRootLayout.updateDragHelperParameters(); - } - @Override public void handleMessage(final String event, final NativeJSObject message, final EventCallback callback) { @@ -1921,7 +1884,6 @@ public class BrowserApp extends GeckoApp mTabsPanel = (TabsPanel) tabsPanelStub.inflate(); mTabsPanel.setTabsLayoutChangeListener(this); - updateSideBarState(); return true; } @@ -1992,16 +1954,9 @@ public class BrowserApp extends GeckoApp mMainLayoutAnimator = new PropertyAnimator(animationLength, sTabsInterpolator); mMainLayoutAnimator.addPropertyAnimationListener(this); - - if (hasTabsSideBar()) { - mMainLayoutAnimator.attach(mMainLayout, - PropertyAnimator.Property.SCROLL_X, - -width); - } else { - mMainLayoutAnimator.attach(mMainLayout, - PropertyAnimator.Property.SCROLL_Y, - -height); - } + mMainLayoutAnimator.attach(mMainLayout, + PropertyAnimator.Property.SCROLL_Y, + -height); mTabsPanel.prepareTabsAnimation(mMainLayoutAnimator); mBrowserToolbar.triggerTabsPanelTransition(mMainLayoutAnimator, areTabsShown()); diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index bf451b7a198d..ca3fe2818fd9 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -2156,7 +2156,6 @@ public class GeckoAppShell public boolean areTabsShown(); public AbsoluteLayout getPluginContainer(); public void notifyCheckUpdateResult(String result); - public boolean hasTabsSideBar(); public void invalidateOptionsMenu(); }; diff --git a/mobile/android/base/resources/layout-large-land-v11/tabs_panel_sidebar.xml b/mobile/android/base/resources/layout-large-land-v11/tabs_panel_sidebar.xml deleted file mode 100644 index 2399dec5ec13..000000000000 --- a/mobile/android/base/resources/layout-large-land-v11/tabs_panel_sidebar.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mobile/android/base/resources/layout/tabs_panel_default.xml b/mobile/android/base/resources/layout/tabs_panel_default.xml index e3f2212f3e09..297cff316176 100644 --- a/mobile/android/base/resources/layout/tabs_panel_default.xml +++ b/mobile/android/base/resources/layout/tabs_panel_default.xml @@ -81,9 +81,4 @@ - - diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml index 5962a75110b3..84226ba03c19 100644 --- a/mobile/android/base/resources/values/dimens.xml +++ b/mobile/android/base/resources/values/dimens.xml @@ -139,7 +139,6 @@ 60dp 16dip 2dp - 200dp 40dp 100dp 18dp diff --git a/mobile/android/base/tabs/TabsPanel.java b/mobile/android/base/tabs/TabsPanel.java index a2742ae83a14..53593688f027 100644 --- a/mobile/android/base/tabs/TabsPanel.java +++ b/mobile/android/base/tabs/TabsPanel.java @@ -7,7 +7,6 @@ package org.mozilla.gecko.tabs; import org.mozilla.gecko.AppConstants.Versions; import org.mozilla.gecko.GeckoApp; -import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoApplication; import org.mozilla.gecko.R; import org.mozilla.gecko.Telemetry; @@ -84,7 +83,6 @@ public class TabsPanel extends LinearLayout private PanelView mPanel; private PanelView mPanelNormal; private PanelView mPanelPrivate; - private RelativeLayout mFooter; private TabsLayoutChangeListener mLayoutChangeListener; private IconTabWidget mTabWidget; @@ -93,7 +91,6 @@ public class TabsPanel extends LinearLayout private ImageButton mNavBackButton; private Panel mCurrentPanel; - private boolean mIsSideBar; private boolean mVisible; private boolean mHeaderVisible; @@ -133,13 +130,6 @@ public class TabsPanel extends LinearLayout mPanelPrivate = (PanelView) findViewById(R.id.private_tabs_panel); mPanelPrivate.setTabsPanel(this); - // Only applies to v11+ in landscape. - // We ship a stub to avoid a compiler error when referencing the - // ID, so we conditionalize here. - if (Versions.feature11Plus) { - mFooter = (RelativeLayout) findViewById(R.id.tabs_panel_footer); - } - mAddTab = (ImageButton) findViewById(R.id.add_tab); mAddTab.setOnClickListener(new Button.OnClickListener() { @Override @@ -329,12 +319,8 @@ public class TabsPanel extends LinearLayout @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - if (!GeckoAppShell.getGeckoInterface().hasTabsSideBar()) { - int heightSpec = MeasureSpec.makeMeasureSpec(getTabContainerHeight(TabsLayoutContainer.this), MeasureSpec.EXACTLY); - super.onMeasure(widthMeasureSpec, heightSpec); - } else { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - } + int heightSpec = MeasureSpec.makeMeasureSpec(getTabContainerHeight(TabsLayoutContainer.this), MeasureSpec.EXACTLY); + super.onMeasure(widthMeasureSpec, heightSpec); } } @@ -390,16 +376,9 @@ public class TabsPanel extends LinearLayout } public void show(Panel panelToShow) { - final boolean showAnimation = !mVisible; prepareToShow(panelToShow); - if (isSideBar()) { - if (showAnimation) { - dispatchLayoutChange(getWidth(), getHeight()); - } - } else { - int height = getVerticalPanelHeight(); - dispatchLayoutChange(getWidth(), height); - } + int height = getVerticalPanelHeight(); + dispatchLayoutChange(getWidth(), height); mHeaderVisible = true; } @@ -411,9 +390,6 @@ public class TabsPanel extends LinearLayout prepareToShow(TabsPanel.Panel.NORMAL_TABS); } mHeaderVisible = true; - if (mIsSideBar) { - prepareSidebarAnimation(getWidth()); - } } public void prepareToShow(Panel panelToShow) { @@ -445,10 +421,6 @@ public class TabsPanel extends LinearLayout } mPanel.show(); - if (mFooter != null) { - mFooter.setVisibility(View.VISIBLE); - } - mAddTab.setVisibility(View.VISIBLE); mAddTab.setImageLevel(index); @@ -501,14 +473,6 @@ public class TabsPanel extends LinearLayout return mVisible; } - public boolean isSideBar() { - return mIsSideBar; - } - - public void setIsSideBar(boolean isSideBar) { - mIsSideBar = isSideBar; - } - public Panel getCurrentPanel() { return mCurrentPanel; } @@ -526,15 +490,6 @@ public class TabsPanel extends LinearLayout } } - public void prepareSidebarAnimation(int tabsPanelWidth) { - if (mVisible) { - ViewHelper.setTranslationX(mHeader, -tabsPanelWidth); - ViewHelper.setTranslationX(mTabsContainer, -tabsPanelWidth); - // The footer view is only present on the sidebar, v11+. - ViewHelper.setTranslationX(mFooter, -tabsPanelWidth); - } - } - public void prepareTabsAnimation(PropertyAnimator animator) { // Not worth doing this on pre-Honeycomb without proper // hardware accelerated animations. @@ -542,15 +497,7 @@ public class TabsPanel extends LinearLayout return; } - if (mIsSideBar) { - final int tabsPanelWidth = getWidth(); - prepareSidebarAnimation(tabsPanelWidth); - final int translationX = (mVisible ? 0 : -tabsPanelWidth); - animator.attach(mTabsContainer, PropertyAnimator.Property.TRANSLATION_X, translationX); - animator.attach(mHeader, PropertyAnimator.Property.TRANSLATION_X, translationX); - animator.attach(mFooter, PropertyAnimator.Property.TRANSLATION_X, translationX); - - } else if (!mHeaderVisible) { + if (!mHeaderVisible) { final Resources resources = getContext().getResources(); final int toolbarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height); final int translationY = (mVisible ? 0 : -toolbarHeight); @@ -569,20 +516,11 @@ public class TabsPanel extends LinearLayout public void translateInRange(float progress) { final Resources resources = getContext().getResources(); - if (!mIsSideBar) { - final int toolbarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height); - final int translationY = (int) - ((1 - progress) * toolbarHeight); - ViewHelper.setTranslationY(mHeader, translationY); - ViewHelper.setTranslationY(mTabsContainer, translationY); - mTabsContainer.setAlpha(progress); - } else { - final int tabsPanelWidth = getWidth(); - prepareSidebarAnimation(tabsPanelWidth); - final int translationX = (int) - ((1 - progress) * tabsPanelWidth); - ViewHelper.setTranslationX(mHeader, translationX); - ViewHelper.setTranslationX(mTabsContainer, translationX); - ViewHelper.setTranslationX(mFooter, translationX); - } + final int toolbarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height); + final int translationY = (int) - ((1 - progress) * toolbarHeight); + ViewHelper.setTranslationY(mHeader, translationY); + ViewHelper.setTranslationY(mTabsContainer, translationY); + mTabsContainer.setAlpha(progress); } public void finishTabsAnimation() { diff --git a/mobile/android/base/toolbar/BrowserToolbar.java b/mobile/android/base/toolbar/BrowserToolbar.java index 284116347f94..4b829f606a0e 100644 --- a/mobile/android/base/toolbar/BrowserToolbar.java +++ b/mobile/android/base/toolbar/BrowserToolbar.java @@ -562,20 +562,19 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout private void toggleTabs() { if (activity.areTabsShown()) { - if (activity.hasTabsSideBar()) - activity.hideTabs(); + return; + } + + if (hideVirtualKeyboard()) { + getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + getViewTreeObserver().removeGlobalOnLayoutListener(this); + showSelectedTabs(); + } + }); } else { - if (hideVirtualKeyboard()) { - getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - getViewTreeObserver().removeGlobalOnLayoutListener(this); - showSelectedTabs(); - } - }); - } else { - showSelectedTabs(); - } + showSelectedTabs(); } } diff --git a/mobile/android/base/webapp/WebappImpl.java b/mobile/android/base/webapp/WebappImpl.java index b31237ed0ae1..ecd9269d9066 100644 --- a/mobile/android/base/webapp/WebappImpl.java +++ b/mobile/android/base/webapp/WebappImpl.java @@ -60,9 +60,6 @@ public class WebappImpl extends GeckoApp implements InstallCallback { @Override public int getLayout() { return R.layout.web_app; } - @Override - public boolean hasTabsSideBar() { return false; } - public WebappImpl() { GeckoProfile.setBrowserDBFactory(new BrowserDB.Factory() { @Override