Update the appearance of the title bar in the browser.
Change the title bar to use the look of the search bar. Remove
the new tab button, which is now a part of the updated menu. Make
the title bar for each WebView span the width of the screen. Make
the title bar appear when pressing the menu button.
Change-Id: I7ad1c955412d422be0fc6f26ec8d286172a0a99a
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 0360a4f..5a27554 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -496,13 +496,13 @@
}
if (CUSTOM_BROWSER_BAR) {
+ mTitleBar.init(this);
// Create title bars for all of the tabs that have been created
for (int i = 0; i < mTabControl.getTabCount(); i ++) {
WebView view = mTabControl.getTab(i).getWebView();
mTitleBar.addTab(view, false);
}
- mTitleBar.setBrowserActivity(this);
mTitleBar.setCurrentTab(mTabControl.getCurrentIndex());
}
@@ -891,6 +891,12 @@
}
}
+ @Override
+ public boolean onMenuOpened(int featureId, Menu menu) {
+ mTitleBar.setVisibility(View.VISIBLE);
+ return true;
+ }
+
/**
* onSaveInstanceState(Bundle map)
* onSaveInstanceState is called right before onStop(). The map contains
@@ -1293,6 +1299,11 @@
}
switch (item.getItemId()) {
// -- Main menu
+ case R.id.new_tab_menu_id:
+ openTabAndShow(EMPTY_URL_DATA, false, null);
+ bookmarksOrHistoryPicker(false, true);
+ break;
+
case R.id.goto_menu_id:
bookmarksOrHistoryPicker(false, false);
break;
@@ -1463,6 +1474,9 @@
menu.findItem(R.id.forward_menu_id)
.setEnabled(canGoForward);
+ menu.findItem(R.id.new_tab_menu_id).setEnabled(
+ mTabControl.getTabCount() < TabControl.MAX_TABS);
+
// decide whether to show the share link option
PackageManager pm = getPackageManager();
Intent send = new Intent(Intent.ACTION_SEND);