Backed out changeset ea8134dfa481 (bug 843619) for robocop failures.

This commit is contained in:
Ryan VanderMeulen 2013-02-25 18:21:08 -05:00
parent 3733f91c39
commit 587a077557
15 changed files with 125 additions and 4 deletions

View File

@ -556,7 +556,9 @@ RES_DRAWABLE_MDPI = \
res/drawable-mdpi/ic_menu_close_all_tabs.png \
res/drawable-mdpi/ic_menu_forward.png \
res/drawable-mdpi/ic_menu_new_private_tab.png \
res/drawable-mdpi/ic_menu_new_private_tab_small.png \
res/drawable-mdpi/ic_menu_new_tab.png \
res/drawable-mdpi/ic_menu_new_tab_small.png \
res/drawable-mdpi/ic_menu_reload.png \
res/drawable-mdpi/ic_status_logo.png \
res/drawable-mdpi/progress_spinner_1.png \
@ -667,7 +669,9 @@ RES_DRAWABLE_HDPI = \
res/drawable-hdpi/ic_menu_close_all_tabs.png \
res/drawable-hdpi/ic_menu_forward.png \
res/drawable-hdpi/ic_menu_new_private_tab.png \
res/drawable-hdpi/ic_menu_new_private_tab_small.png \
res/drawable-hdpi/ic_menu_new_tab.png \
res/drawable-hdpi/ic_menu_new_tab_small.png \
res/drawable-hdpi/ic_menu_reload.png \
res/drawable-hdpi/ic_status_logo.png \
res/drawable-hdpi/tab_indicator_divider.9.png \
@ -758,7 +762,9 @@ RES_DRAWABLE_XHDPI = \
res/drawable-xhdpi/ic_menu_close_all_tabs.png \
res/drawable-xhdpi/ic_menu_forward.png \
res/drawable-xhdpi/ic_menu_new_private_tab.png \
res/drawable-xhdpi/ic_menu_new_private_tab_small.png \
res/drawable-xhdpi/ic_menu_new_tab.png \
res/drawable-xhdpi/ic_menu_new_tab_small.png \
res/drawable-xhdpi/ic_menu_reload.png \
res/drawable-xhdpi/ic_status_logo.png \
res/drawable-xhdpi/spinner_default.9.png \
@ -906,6 +912,7 @@ RES_DRAWABLE_LARGE_MDPI_V11 = \
res/drawable-large-mdpi-v11/tabs_carat.png \
res/drawable-large-mdpi-v11/tabs_carat_contracted.png \
res/drawable-large-mdpi-v11/tabs_carat_expanded.png \
res/drawable-large-mdpi-v11/tabs_menu.png \
$(NULL)
RES_DRAWABLE_LARGE_HDPI_V11 = \
@ -915,6 +922,7 @@ RES_DRAWABLE_LARGE_HDPI_V11 = \
res/drawable-large-hdpi-v11/tabs_carat.png \
res/drawable-large-hdpi-v11/tabs_carat_contracted.png \
res/drawable-large-hdpi-v11/tabs_carat_expanded.png \
res/drawable-large-hdpi-v11/tabs_menu.png \
$(NULL)
RES_DRAWABLE_LARGE_XHDPI_V11 = \
@ -924,6 +932,7 @@ RES_DRAWABLE_LARGE_XHDPI_V11 = \
res/drawable-large-xhdpi-v11/tabs_carat.png \
res/drawable-large-xhdpi-v11/tabs_carat_contracted.png \
res/drawable-large-xhdpi-v11/tabs_carat_expanded.png \
res/drawable-large-xhdpi-v11/tabs_menu.png \
$(NULL)
RES_DRAWABLE_XLARGE_MDPI_V11 = \
@ -958,8 +967,10 @@ RES_COLOR = \
RES_MENU = \
res/menu/awesomebar_contextmenu.xml \
res/menu/gecko_app_menu.xml \
res/menu/tabs_menu.xml \
res/menu/titlebar_contextmenu.xml \
res/menu/abouthome_topsites_contextmenu.xml \
res/menu-v11/tabs_menu.xml \
$(NULL)
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar

View File

@ -27,7 +27,8 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class TabsPanel extends LinearLayout
implements LightweightTheme.OnChangeListener,
implements GeckoPopupMenu.OnMenuItemClickListener,
LightweightTheme.OnChangeListener,
IconTabWidget.OnTabChangedListener {
private static final String LOGTAG = "GeckoTabsPanel";
@ -60,12 +61,16 @@ public class TabsPanel extends LinearLayout
private TabsLayoutChangeListener mLayoutChangeListener;
private IconTabWidget mTabWidget;
private static ImageButton mMenuButton;
private static ImageButton mAddTab;
private Panel mCurrentPanel;
private boolean mIsSideBar;
private boolean mVisible;
private GeckoPopupMenu mPopupMenu;
private Menu mMenu;
public TabsPanel(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
@ -80,6 +85,11 @@ public class TabsPanel extends LinearLayout
mIsSideBar = false;
mPopupMenu = new GeckoPopupMenu(context);
mPopupMenu.inflate(R.menu.tabs_menu);
mPopupMenu.setOnMenuItemClickListener(this);
mMenu = mPopupMenu.getMenu();
LayoutInflater.from(context).inflate(R.layout.tabs_panel, this);
initialize();
}
@ -110,6 +120,15 @@ public class TabsPanel extends LinearLayout
mTabWidget.addTab(R.drawable.tabs_private);
mTabWidget.addTab(R.drawable.tabs_synced);
mTabWidget.setTabSelectionListener(this);
mMenuButton = (ImageButton) findViewById(R.id.menu);
mMenuButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View view) {
TabsPanel.this.openTabsMenu();
}
});
mPopupMenu.setAnchor(mMenuButton);
}
public void addTab() {
@ -121,6 +140,15 @@ public class TabsPanel extends LinearLayout
mActivity.autoHideTabs();
}
public void openTabsMenu() {
if (mCurrentPanel == Panel.REMOTE_TABS)
mMenu.findItem(R.id.close_all_tabs).setEnabled(false);
else
mMenu.findItem(R.id.close_all_tabs).setEnabled(true);
mPopupMenu.show();
}
@Override
public void onTabChanged(int index) {
if (index == 0)
@ -131,6 +159,25 @@ public class TabsPanel extends LinearLayout
show(Panel.REMOTE_TABS, false);
}
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.close_all_tabs:
for (Tab tab : Tabs.getInstance().getTabsInOrder()) {
Tabs.getInstance().closeTab(tab);
}
autoHidePanel();
return true;
case R.id.new_tab:
case R.id.new_private_tab:
hide();
// fall through
default:
return mActivity.onOptionsItemSelected(item);
}
}
private static int getTabContainerHeight(TabsListContainer listContainer) {
Context context = listContainer.getContext();
@ -310,12 +357,14 @@ public class TabsPanel extends LinearLayout
mFooter.setVisibility(View.GONE);
mAddTab.setVisibility(View.INVISIBLE);
mMenuButton.setVisibility(View.INVISIBLE);
} else {
if (mFooter != null)
mFooter.setVisibility(View.VISIBLE);
mAddTab.setVisibility(View.VISIBLE);
mAddTab.setImageLevel(index);
mMenuButton.setVisibility(View.VISIBLE);
}
if (shouldResize) {
@ -333,6 +382,7 @@ public class TabsPanel extends LinearLayout
public void hide() {
if (mVisible) {
mVisible = false;
mPopupMenu.dismiss();
dispatchLayoutChange(0, 0);
if (mPanel != null) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

View File

@ -6,12 +6,23 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ImageButton android:id="@+id/add_tab"
android:layout_width="fill_parent"
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"
android:gravity="center"/>
android:background="@drawable/action_bar_button"/>
<View android:layout_width="0dip"
android:layout_height="@dimen/browser_toolbar_height"
android:layout_weight="1.0"/>
<ImageButton android:id="@+id/menu"
android:layout_width="@dimen/browser_toolbar_height"
android:layout_height="@dimen/browser_toolbar_height"
android:padding="14dip"
android:src="@drawable/tabs_menu"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"/>
</merge>

View File

@ -24,4 +24,13 @@
android:contentDescription="@string/new_tab"
android:background="@drawable/action_bar_button"/>
<ImageButton android:id="@+id/menu"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_height"
android:layout_height="@dimen/browser_toolbar_height"
android:padding="@dimen/browser_toolbar_button_padding"
android:src="@drawable/menu"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"/>
</merge>

View File

@ -0,0 +1,20 @@
<?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/. -->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/new_tab"
android:icon="@drawable/ic_menu_new_tab"
android:title="@string/new_tab"/>
<item android:id="@+id/new_private_tab"
android:icon="@drawable/ic_menu_new_private_tab"
android:title="@string/new_private_tab"/>
<item android:id="@+id/close_all_tabs"
android:icon="@drawable/ic_menu_close_all_tabs"
android:title="@string/close_all_tabs"/>
</menu>

View File

@ -0,0 +1,20 @@
<?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/. -->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/new_tab"
android:icon="@drawable/ic_menu_new_tab_small"
android:title="@string/new_tab"/>
<item android:id="@+id/new_private_tab"
android:icon="@drawable/ic_menu_new_private_tab_small"
android:title="@string/new_private_tab"/>
<item android:id="@+id/close_all_tabs"
android:icon="@drawable/ic_menu_close_all_tabs"
android:title="@string/close_all_tabs"/>
</menu>