Attach the title bar to the top of the page.
Remove the old notions of changing the viewing mode
resulting in changing the visibility of the title bar.
Instead, attach the title bar to the current WebView.
Requires a change to frameworks/base.
Change-Id: I65ba1182db040848700840e6229d7e1a7c6050d0
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 3553193..3706167 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -336,7 +336,6 @@
// holds everything else.
FrameLayout browserFrameLayout = (FrameLayout) LayoutInflater.from(this)
.inflate(R.layout.custom_screen, null);
- mTitleBar = (TitleBarSet) browserFrameLayout.findViewById(R.id.title_bar);
mContentView = (FrameLayout) browserFrameLayout.findViewById(
R.id.main_content);
mErrorConsoleContainer = (LinearLayout) browserFrameLayout.findViewById(
@@ -344,6 +343,7 @@
mCustomViewContainer = (FrameLayout) browserFrameLayout
.findViewById(R.id.fullscreen_custom_content);
frameLayout.addView(browserFrameLayout, COVER_SCREEN_PARAMS);
+ mTitleBar = new TitleBarSet(this);
} else {
mCustomViewContainer = new FrameLayout(this);
mCustomViewContainer.setBackgroundColor(Color.BLACK);
@@ -1243,8 +1243,6 @@
attachTabToContentView(tab);
if (CUSTOM_BROWSER_BAR) {
mTitleBar.setCurrentTab(index);
- WebView view = tab.getWebView();
- view.slideIntoFocus();
}
return true;
}
@@ -1624,6 +1622,8 @@
ViewGroup.LayoutParams.WRAP_CONTENT));
}
+ WebView view = t.getWebView();
+ view.addTitleBar(mTitleBar);
// Attach the sub window if necessary
attachSubWindow(t);
// Request focus on the top window.
@@ -1650,6 +1650,9 @@
mErrorConsoleContainer.removeView(mTabControl.getCurrentErrorConsole(false));
}
+ WebView view = t.getWebView();
+ view.addTitleBar(null);
+
// Remove the sub window if it exists.
if (t.getSubWebView() != null) {
mContentView.removeView(t.getSubWebViewContainer());
@@ -2318,9 +2321,6 @@
CookieSyncManager.getInstance().resetSync();
mInLoad = true;
- if (CUSTOM_BROWSER_BAR) {
- mTitleBar.setVisibility(View.VISIBLE);
- }
updateInLoadMenuItems();
if (!mIsNetworkUp) {
if ( mAlertDialog == null) {
@@ -2877,27 +2877,6 @@
}
@Override
- public void onChangeViewingMode(WebView view, int newViewingMode) {
- if (!CUSTOM_BROWSER_BAR || view != getTopWindow()) {
- return;
- }
- switch (newViewingMode) {
- case WebView.NO_VIEWING_MODE:
- break;
- case WebView.OVERVIEW_MODE:
- case WebView.READING_MODE_WITH_TITLE_BAR:
- case WebView.TITLE_BAR_DISMISS_MODE:
- mTitleBar.setVisibility(View.VISIBLE);
- break;
- case WebView.READING_MODE:
- mTitleBar.setVisibility(View.GONE);
- break;
- default:
- break;
- }
- }
-
- @Override
public boolean onCreateWindow(WebView view, final boolean dialog,
final boolean userGesture, final Message resultMsg) {
// Short-circuit if we can't create any more tabs or sub windows.