Bug 824469: New tab button based on the tabs-section. [r=mfinkle]

This commit is contained in:
Sriram Ramasubramanian 2013-01-02 13:43:01 -08:00
parent fa5edb7d3c
commit 4f682324de
3 changed files with 24 additions and 5 deletions

View File

@ -495,10 +495,14 @@ abstract public class BrowserApp extends GeckoApp
}
}
void addTab() {
public void addTab() {
showAwesomebar(AwesomeBar.Target.NEW_TAB);
}
public void addPrivateTab() {
Tabs.getInstance().loadUrl("about:home", Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE);
}
public void showNormalTabs() {
showTabs(TabsPanel.Panel.NORMAL_TABS);
}
@ -1116,7 +1120,7 @@ abstract public class BrowserApp extends GeckoApp
addTab();
return true;
case R.id.new_private_tab:
Tabs.getInstance().loadUrl("about:home", Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE);
addPrivateTab();
return true;
default:
return super.onOptionsItemSelected(item);

View File

@ -802,7 +802,9 @@ abstract public class GeckoApp
}
}
void addTab() { }
public void addTab() { }
public void addPrivateTab() { }
public void showNormalTabs() { }

View File

@ -164,8 +164,7 @@ public class TabsPanel extends TabHost
mAddTab = (ImageButton) mToolbar.findViewById(R.id.add_tab);
mAddTab.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
mActivity.addTab();
mActivity.autoHideTabs();
TabsPanel.this.addTab();
}
});
@ -188,6 +187,15 @@ public class TabsPanel extends TabHost
mPopupMenu.setAnchor(mMenuButton);
}
public void addTab() {
if (mCurrentPanel == Panel.NORMAL_TABS)
mActivity.addTab();
else
mActivity.addPrivateTab();
mActivity.autoHideTabs();
}
public void openTabsMenu() {
if (mCurrentPanel == Panel.REMOTE_TABS)
mMenu.findItem(R.id.close_all_tabs).setEnabled(false);
@ -396,6 +404,11 @@ public class TabsPanel extends TabHost
mPanel = (PanelView) getTabContentView().getChildAt(index);
mPanel.show();
if (mCurrentPanel == Panel.REMOTE_TABS)
mAddTab.setVisibility(View.INVISIBLE);
else
mAddTab.setVisibility(View.VISIBLE);
if (isSideBar()) {
if (showAnimation)
dispatchLayoutChange(getWidth(), getHeight());