OSDN Git Service

Attach the title bar to the top of the page.
authorLeon Scroggins <scroggo@google.com>
Thu, 3 Sep 2009 01:20:30 +0000 (21:20 -0400)
committerLeon Scroggins <scroggo@google.com>
Thu, 3 Sep 2009 01:20:30 +0000 (21:20 -0400)
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

res/layout/custom_screen.xml
src/com/android/browser/BrowserActivity.java

index f654a84..d1f1658 100644 (file)
     <LinearLayout android:orientation="vertical"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent">
-        <com.android.browser.TitleBarSet android:id="@+id/title_bar"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:background="@drawable/tab_unselected"
-        />
 
         <LinearLayout android:id="@+id/error_console"
             android:layout_width="fill_parent"
index 3553193..3706167 100644 (file)
@@ -336,7 +336,6 @@ public class BrowserActivity extends Activity
             // 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 @@ public class BrowserActivity extends Activity
             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 @@ public class BrowserActivity extends Activity
         attachTabToContentView(tab);
         if (CUSTOM_BROWSER_BAR) {
             mTitleBar.setCurrentTab(index);
-            WebView view = tab.getWebView();
-            view.slideIntoFocus();
         }
         return true;
     }
@@ -1624,6 +1622,8 @@ public class BrowserActivity extends Activity
                                                   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 @@ public class BrowserActivity extends Activity
             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 @@ public class BrowserActivity extends Activity
             CookieSyncManager.getInstance().resetSync();
 
             mInLoad = true;
-            if (CUSTOM_BROWSER_BAR) {
-                mTitleBar.setVisibility(View.VISIBLE);
-            }
             updateInLoadMenuItems();
             if (!mIsNetworkUp) {
                 if ( mAlertDialog == null) {
@@ -2877,27 +2877,6 @@ public class BrowserActivity extends Activity
         }
 
         @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.