Bug 832433: Remove Android Tabs widget in tabs ui. [r=mfinkle] [needs-clobber]

--HG--
extra : rebase_source : a64bfad708d610e7c9ad78ed2d21132da45d80f4
This commit is contained in:
Sriram Ramasubramanian 2013-01-18 11:58:45 -08:00
parent 61f066339b
commit ae20ff569a
20 changed files with 127 additions and 250 deletions

View File

@ -406,7 +406,6 @@ RES_LAYOUT = \
res/layout/remote_tabs_child.xml \
res/layout/remote_tabs_group.xml \
res/layout/tabs_counter.xml \
res/layout/tabs_panel_indicator.xml \
res/layout/tabs_panel_header.xml \
res/layout/tabs_row.xml \
res/layout/list_item_header.xml \
@ -541,9 +540,6 @@ RES_DRAWABLE_BASE = \
res/drawable/spinner_default.9.png \
res/drawable/spinner_focused.9.png \
res/drawable/spinner_pressed.9.png \
res/drawable/tab_indicator_divider.9.png \
res/drawable/tab_indicator_selected.9.png \
res/drawable/tab_indicator_selected_focused.9.png \
res/drawable/tab_new.png \
res/drawable/tab_new_pb.png \
res/drawable/tab_close.png \
@ -637,9 +633,6 @@ RES_DRAWABLE_HDPI = \
res/drawable-hdpi/spinner_default.9.png \
res/drawable-hdpi/spinner_focused.9.png \
res/drawable-hdpi/spinner_pressed.9.png \
res/drawable-hdpi/tab_indicator_divider.9.png \
res/drawable-hdpi/tab_indicator_selected.9.png \
res/drawable-hdpi/tab_indicator_selected_focused.9.png \
res/drawable-hdpi/tab_new.png \
res/drawable-hdpi/tab_new_pb.png \
res/drawable-hdpi/tab_close.png \
@ -730,9 +723,6 @@ RES_DRAWABLE_XHDPI = \
res/drawable-xhdpi/spinner_default.9.png \
res/drawable-xhdpi/spinner_focused.9.png \
res/drawable-xhdpi/spinner_pressed.9.png \
res/drawable-xhdpi/tab_indicator_divider.9.png \
res/drawable-xhdpi/tab_indicator_selected.9.png \
res/drawable-xhdpi/tab_indicator_selected_focused.9.png \
res/drawable-xhdpi/tab_new.png \
res/drawable-xhdpi/tab_new_pb.png \
res/drawable-xhdpi/tab_close.png \
@ -1102,7 +1092,6 @@ MOZ_ANDROID_DRAWABLES += \
mobile/android/base/resources/drawable/tab_new_level.xml \
mobile/android/base/resources/drawable/tabs_button.xml \
mobile/android/base/resources/drawable/tabs_level.xml \
mobile/android/base/resources/drawable/tabs_panel_indicator.xml \
mobile/android/base/resources/drawable/tabs_tray_bg_repeat.xml \
mobile/android/base/resources/drawable/tabs_tray_selected_bg_repeat.xml \
mobile/android/base/resources/drawable/tabs_tray_active_selector.xml \

View File

@ -53,11 +53,13 @@ public class RemoteTabs extends ExpandableListView
@Override
public void show() {
setVisibility(View.VISIBLE);
TabsAccessor.getTabs(mContext, this);
}
@Override
public void hide() {
setVisibility(View.GONE);
}
private void autoHidePanel() {

View File

@ -22,11 +22,8 @@ import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
public class TabsPanel extends TabHost
public class TabsPanel extends LinearLayout
implements GeckoPopupMenu.OnMenuItemClickListener,
LightweightTheme.OnChangeListener,
AdapterView.OnItemSelectedListener {
@ -52,12 +49,14 @@ public class TabsPanel extends TabHost
private Context mContext;
private GeckoApp mActivity;
private PanelView mPanel;
private PanelView mPanelNormal;
private PanelView mPanelPrivate;
private PanelView mPanelRemote;
private LinearLayout mFooter;
private TabsLayoutChangeListener mLayoutChangeListener;
private static ImageButton mMenuButton;
private static ImageButton mAddTab;
private TabWidget mTabWidget;
private Button mTabsMenuButton;
private Spinner mTabsSpinner;
@ -77,6 +76,10 @@ public class TabsPanel extends TabHost
mContext = context;
mActivity = (GeckoApp) context;
setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.FILL_PARENT));
setOrientation(LinearLayout.VERTICAL);
mCurrentPanel = Panel.NORMAL_TABS;
mVisible = false;
@ -113,51 +116,18 @@ public class TabsPanel extends TabHost
initialize();
}
private void initialize() {
// This should be called before adding any tabs
// to the TabHost.
setup();
void initialize() {
mPanelNormal = (TabsTray) findViewById(R.id.normal_tabs);
mPanelNormal.setTabsPanel(this);
initToolbar();
addTab(R.string.tabs_normal, R.id.normal_tabs);
addTab(R.string.tabs_private, R.id.private_tabs);
addTab(R.string.tabs_synced, R.id.synced_tabs);
}
mPanelPrivate = (TabsTray) findViewById(R.id.private_tabs);
mPanelPrivate.setTabsPanel(this);
private void addTab(int resId, int contentId) {
String title = mContext.getString(resId);
TabSpec spec = newTabSpec(title);
GeckoTextView indicatorView = (GeckoTextView) LayoutInflater.from(mContext).inflate(R.layout.tabs_panel_indicator, null);
indicatorView.setText(title);
mPanelRemote = (RemoteTabs) findViewById(R.id.synced_tabs);
mPanelRemote.setTabsPanel(this);
spec.setIndicator(indicatorView);
spec.setContent(contentId);
final int index = mTabWidget.getTabCount();
PanelView panel = (PanelView) findViewById(contentId);
panel.setTabsPanel(this);
panel.show();
addTab(spec);
indicatorView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Panel panel = Panel.NORMAL_TABS;
if (index == 1)
panel = Panel.PRIVATE_TABS;
else if (index == 2)
panel = Panel.REMOTE_TABS;
TabsPanel.this.show(panel);
}
});
}
void initToolbar() {
mFooter = (LinearLayout) findViewById(R.id.tabs_panel_footer);
mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
mAddTab = (ImageButton) findViewById(R.id.add_tab);
mAddTab.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
@ -319,7 +289,7 @@ public class TabsPanel extends TabHost
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (!GeckoApp.mAppContext.hasTabsSideBar()) {
int heightSpec = MeasureSpec.makeMeasureSpec(getTabContainerHeight(this), MeasureSpec.EXACTLY);
int heightSpec = MeasureSpec.makeMeasureSpec(getTabContainerHeight(TabsListContainer.this), MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightSpec);
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@ -387,19 +357,19 @@ public class TabsPanel extends TabHost
mCurrentPanel = panel;
int index = panel.ordinal();
setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
setCurrentTab(index);
setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
mTabsSpinner.setSelection(index);
if (index == 0)
if (index == 0) {
mPanel = mPanelNormal;
mTabsMenuButton.setText(R.string.tabs_normal);
else if (index == 1)
} else if (index == 1) {
mPanel = mPanelPrivate;
mTabsMenuButton.setText(R.string.tabs_private);
else
} else {
mPanel = mPanelRemote;
mTabsMenuButton.setText(R.string.tabs_synced);
}
mPanel = (PanelView) getTabContentView().getChildAt(index);
mPanel.show();
if (mCurrentPanel == Panel.REMOTE_TABS) {
@ -422,7 +392,7 @@ public class TabsPanel extends TabHost
dispatchLayoutChange(getWidth(), getHeight());
} else {
int actionBarHeight = mContext.getResources().getDimensionPixelSize(R.dimen.browser_toolbar_height);
int height = actionBarHeight + getTabContainerHeight(getTabContentView());
int height = actionBarHeight + getTabContainerHeight(this);
dispatchLayoutChange(getWidth(), height);
}
}
@ -433,13 +403,14 @@ public class TabsPanel extends TabHost
mPopupMenu.dismiss();
dispatchLayoutChange(0, 0);
mPanel.hide();
mPanel = null;
if (mPanel != null) {
mPanel.hide();
mPanel = null;
}
}
}
public void refresh() {
clearAllTabs();
removeAllViews();
LayoutInflater.from(mContext).inflate(R.layout.tabs_panel, this);

View File

@ -92,6 +92,7 @@ public class TabsTray extends ListView
@Override
public void show() {
setVisibility(View.VISIBLE);
Tabs.getInstance().refreshThumbnails();
Tabs.registerOnTabsChangedListener(mTabsAdapter);
mTabsAdapter.refreshTabsData();
@ -99,6 +100,7 @@ public class TabsTray extends ListView
@Override
public void hide() {
setVisibility(View.GONE);
Tabs.unregisterOnTabsChangedListener(mTabsAdapter);
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Screenshot:Cancel",""));
mTabsAdapter.clear();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

View File

@ -1,48 +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/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="false"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@color/tab_indicator_unselected"/>
<item android:state_focused="false"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_indicator_selected"/>
<item android:state_focused="true"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@color/tab_indicator_unselected_focused"/>
<item android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_indicator_selected_focused"/>
<item android:state_focused="false"
android:state_selected="false"
android:state_pressed="true"
android:drawable="@drawable/highlight"/>
<item android:state_focused="false"
android:state_selected="true"
android:state_pressed="true"
android:drawable="@drawable/highlight"/>
<item android:state_focused="true"
android:state_selected="false"
android:state_pressed="true"
android:drawable="@drawable/highlight"/>
<item android:state_focused="true"
android:state_selected="true"
android:state_pressed="true"
android:drawable="@drawable/highlight"/>
</selector>

View File

@ -5,11 +5,6 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TabWidget android:id="@android:id/tabs"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="gone"/>
<Button android:id="@id/tabs_switcher_menu"
android:layout_width="0dip"
android:layout_height="0dip"

View File

@ -7,78 +7,75 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
<LinearLayout android:id="@+id/tabs_panel_header"
android:layout_width="fill_parent"
android:layout_height="@dimen/browser_toolbar_height"
android:orientation="vertical">
<LinearLayout android:id="@+id/tabs_panel_header"
android:layout_width="fill_parent"
android:layout_height="@dimen/browser_toolbar_height"
android:orientation="vertical">
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
<include layout="@layout/tabs_panel_header"/>
</view>
<View android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#FF313131"/>
</LinearLayout>
<view class="org.mozilla.gecko.TabsPanel$TabsListContainer"
android:id="@android:id/tabcontent"
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
<org.mozilla.gecko.TabsTray android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
gecko:tabs="tabs_normal"/>
<org.mozilla.gecko.TabsTray android:id="@+id/private_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
gecko:tabs="tabs_private"/>
<org.mozilla.gecko.RemoteTabs android:id="@+id/synced_tabs"
style="@style/RemoteTabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/tabs_panel_list_padding"
android:paddingRight="@dimen/tabs_panel_list_padding"
android:scrollbarStyle="outsideOverlay"/>
<include layout="@layout/tabs_panel_header"/>
</view>
<LinearLayout android:id="@+id/tabs_panel_footer"
android:layout_width="fill_parent"
android:layout_height="@dimen/browser_toolbar_height"
android:orientation="vertical">
<View android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#FF313131"/>
<View android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#FF313131"/>
</LinearLayout>
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
<view class="org.mozilla.gecko.TabsPanel$TabsListContainer"
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
<org.mozilla.gecko.TabsTray android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
gecko:tabs="tabs_normal"/>
<org.mozilla.gecko.TabsTray android:id="@+id/private_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
gecko:tabs="tabs_private"/>
<org.mozilla.gecko.RemoteTabs android:id="@+id/synced_tabs"
style="@style/RemoteTabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:paddingLeft="@dimen/tabs_panel_list_padding"
android:paddingRight="@dimen/tabs_panel_list_padding"
android:scrollbarStyle="outsideOverlay"/>
</view>
<LinearLayout android:id="@+id/tabs_panel_footer"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
android:layout_height="@dimen/browser_toolbar_height"
android:orientation="vertical">
<include layout="@layout/tabs_panel_footer"/>
<View android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#FF313131"/>
</view>
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
</LinearLayout>
<include layout="@layout/tabs_panel_footer"/>
</LinearLayout>
</view>
</LinearLayout>
</merge>

View File

@ -5,11 +5,6 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TabWidget android:id="@android:id/tabs"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="gone"/>
<Button android:id="@id/tabs_switcher_menu"
android:layout_width="0dip"
android:layout_height="0dip"

View File

@ -7,57 +7,53 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
<LinearLayout android:id="@+id/tabs_panel_header"
android:layout_width="fill_parent"
android:layout_height="@dimen/browser_toolbar_height"
android:orientation="vertical">
<LinearLayout android:id="@+id/tabs_panel_header"
android:layout_width="fill_parent"
android:layout_height="@dimen/browser_toolbar_height"
android:orientation="vertical">
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
<include layout="@layout/tabs_panel_header"/>
</view>
<View android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#FF313131"/>
</LinearLayout>
<view class="org.mozilla.gecko.TabsPanel$TabsListContainer"
android:id="@android:id/tabcontent"
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:layout_height="0dip"
android:layout_weight="1.0">
<org.mozilla.gecko.TabsTray android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
gecko:tabs="tabs_normal"/>
<org.mozilla.gecko.TabsTray android:id="@+id/private_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
gecko:tabs="tabs_private"/>
<org.mozilla.gecko.RemoteTabs android:id="@+id/synced_tabs"
style="@style/RemoteTabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/tabs_panel_list_padding"
android:paddingRight="@dimen/tabs_panel_list_padding"
android:scrollbarStyle="outsideOverlay"/>
<include layout="@layout/tabs_panel_header"/>
</view>
</LinearLayout>
<View android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#FF313131"/>
</LinearLayout>
<view class="org.mozilla.gecko.TabsPanel$TabsListContainer"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<org.mozilla.gecko.TabsTray android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
gecko:tabs="tabs_normal"/>
<org.mozilla.gecko.TabsTray android:id="@+id/private_tabs"
style="@style/TabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
gecko:tabs="tabs_private"/>
<org.mozilla.gecko.RemoteTabs android:id="@+id/synced_tabs"
style="@style/RemoteTabsList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:paddingLeft="@dimen/tabs_panel_list_padding"
android:paddingRight="@dimen/tabs_panel_list_padding"
android:scrollbarStyle="outsideOverlay"/>
</view>
</merge>

View File

@ -5,11 +5,6 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TabWidget android:id="@android:id/tabs"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="gone"/>
<Spinner android:id="@+id/tabs_menu"
android:layout_width="0dip"
android:layout_height="0dip"

View File

@ -1,17 +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/. -->
<Gecko.AllCapsTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="center"
android:background="@drawable/tabs_panel_indicator"
android:padding="10dp"
android:singleLine="true"
android:ellipsize="marquee"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="#FFFFFFFF"/>