Bug 1106935 - Remove references to old tablet sidebar. r=mhaigh

--HG--
extra : rebase_source : 3d9f84589872bfb74c1a1040b525f042c7c9cebb
This commit is contained in:
Michael Comella 2015-04-02 10:45:31 -07:00
Родитель f95ba8fd16
Коммит 50f0e098c0
9 изменённых файлов: 25 добавлений и 244 удалений

Просмотреть файл

@ -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() {}

Просмотреть файл

@ -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());

Просмотреть файл

@ -2156,7 +2156,6 @@ public class GeckoAppShell
public boolean areTabsShown();
public AbsoluteLayout getPluginContainer();
public void notifyCheckUpdateResult(String result);
public boolean hasTabsSideBar();
public void invalidateOptionsMenu();
};

Просмотреть файл

@ -1,96 +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/. -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto">
<RelativeLayout android:id="@+id/tabs_panel_header"
android:layout_width="match_parent"
android:layout_height="@dimen/browser_toolbar_height">
<view class="org.mozilla.gecko.tabs.TabsPanel$TabsPanelToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_tabs">
<org.mozilla.gecko.widget.IconTabWidget android:id="@+id/tab_widget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:tabStripEnabled="false"
android:divider="@drawable/tab_indicator_divider"
android:layout="@layout/tabs_panel_indicator"/>
</view>
<View android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="#1A000000"/>
</RelativeLayout>
<view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayoutContainer"
android:id="@+id/tabs_container"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
<view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayout"
android:id="@+id/normal_tabs"
style="@style/TabsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:visibility="gone"
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"/>
</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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_tabs">
<ImageButton android:id="@+id/add_tab"
android:layout_width="@dimen/browser_toolbar_height"
android:layout_height="@dimen/browser_toolbar_height"
android:padding="14dip"
android:src="@drawable/tab_new_level"
android:contentDescription="@string/new_tab"
android:background="@drawable/action_bar_button_inverse"/>
<View android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1.0"/>
<ImageButton android:id="@+id/menu"
style="@style/UrlBar.ImageButton"
android:padding="@dimen/browser_toolbar_button_padding"
android:src="@drawable/menu_tabs"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button_inverse"
android:visibility="gone"/>
</view>
<View android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentTop="true"
android:background="#1A000000"/>
</RelativeLayout>
</merge>

Просмотреть файл

@ -81,9 +81,4 @@
</view>
<!-- To preserve the ID, even when building for pre-11. -->
<RelativeLayout android:id="@+id/tabs_panel_footer"
android:layout_height="0dp"
android:layout_width="0dp"
android:visibility="gone"/>
</merge>

Просмотреть файл

@ -139,7 +139,6 @@
<dimen name="tabs_panel_indicator_width">60dp</dimen>
<dimen name="tabs_panel_list_padding">16dip</dimen>
<dimen name="tabs_list_divider_height">2dp</dimen>
<dimen name="tabs_sidebar_width">200dp</dimen>
<dimen name="tabs_strip_height">40dp</dimen>
<dimen name="tabs_strip_button_width">100dp</dimen>
<dimen name="tabs_strip_button_padding">18dp</dimen>

Просмотреть файл

@ -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() {

Просмотреть файл

@ -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();
}
}

Просмотреть файл

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