Updates to the browser's custom title bar.

Use an asset copied from the Market for the background.  Since this background is
dark, change the title's text to white, as well as the dividing line.  Changed
the functionality of the buttons on the title bar.  Also flipped the title and
the url, and fixed a bug where "Loading..." remained for too long.  Also added
the drop shadow below the title bar.
diff --git a/res/drawable/background_titlebar.png b/res/drawable/background_titlebar.png
index 0d7c562..1fdb078 100644
--- a/res/drawable/background_titlebar.png
+++ b/res/drawable/background_titlebar.png
Binary files differ
diff --git a/res/drawable/button_line.xml b/res/drawable/button_line.xml
index 03b5d35..67869d0 100644
--- a/res/drawable/button_line.xml
+++ b/res/drawable/button_line.xml
@@ -16,13 +16,12 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
     <item>
         <shape android:width="2dip">
-            <!-- Want it to have 90% alpha -->
-            <solid android:color="#ffdfdfdf"/>
+            <solid android:color="#ff000000"/>
         </shape>
     </item>
     <item android:left="1dip" android:width="1dip">
         <shape>
-            <solid android:color="#ffb6b6b6"/>
+            <solid android:color="#ffffffff"/>
         </shape>
     </item>
 </layer-list>
diff --git a/res/layout/custom_screen.xml b/res/layout/custom_screen.xml
new file mode 100644
index 0000000..95c8434
--- /dev/null
+++ b/res/layout/custom_screen.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    >
+    <com.android.browser.TitleBar android:id="@+id/title_bar"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        />
+    <FrameLayout android:id="@+id/main_content"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:foreground="?android:attr/windowContentOverlay"
+        />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/title_bar.xml b/res/layout/title_bar.xml
index fed4c6c..0f70519 100644
--- a/res/layout/title_bar.xml
+++ b/res/layout/title_bar.xml
@@ -59,25 +59,25 @@
                     android:layout_height="wrap_content" />
             </LinearLayout>
             <!-- need to make this no wider than the horizontal progress bar -->
-            <TextView android:id="@+id/url"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="4dip"
-                android:layout_marginLeft="6dip"
-                android:textSize="12dip"
-                android:textColor="#ff333333"
-                android:singleLine="true"
-                />
             <TextView android:id="@+id/title"
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:layout_marginLeft="6dip"
-                android:layout_below="@id/url"
+                android:layout_marginTop="4dip"
                 android:textSize="14dip"
-                android:textColor="#ff333333"
+                android:textColor="@color/white"
                 android:textStyle="bold"
                 android:singleLine="true"
                 />
+            <TextView android:id="@+id/url"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="6dip"
+                android:layout_below="@id/title"
+                android:textSize="12dip"
+                android:textColor="@color/white"
+                android:singleLine="true"
+                />
             <ImageView android:id="@+id/lock_icon"
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
@@ -86,23 +86,20 @@
                 android:visibility="gone"/>
         </RelativeLayout>
     </LinearLayout>
-    <!-- divider -->
-    <View
-        android:layout_height="fill_parent"
-        android:layout_width="2dip"
-        android:background="@drawable/button_line"/>
     <!-- These buttons will change look/functionality -->
-    <ImageView android:id="@+id/zoom_in"
+    <ImageView android:id="@+id/lft_button"
         android:layout_width="52dip"
         android:layout_height="wrap_content"
-        android:src="@drawable/ic_titlebar_zoom"/>
+        android:layout_gravity="center_vertical"
+        android:src="@android:drawable/btn_star"/>
     <!-- divider -->
     <View android:id="@+id/divider"
         android:layout_height="fill_parent"
         android:layout_width="2dip"
         android:background="@drawable/button_line"/>
-    <ImageView android:id="@+id/zoom_out"
+    <ImageView android:id="@+id/rt_button"
         android:layout_width="52dip"
         android:layout_height="wrap_content"
-        android:src="@drawable/ic_titlebar_zoom_out"/>
+        android:layout_gravity="center_vertical"
+        android:src="@*android:drawable/btn_browser_zoom_page_overview"/>
 </LinearLayout>
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 15e07f7..1966b8b 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -650,7 +650,6 @@
         super.onCreate(icicle);
         if (CUSTOM_BROWSER_BAR) {
             this.requestWindowFeature(Window.FEATURE_NO_TITLE);
-            mTitleBar = new TitleBar(this);
         } else {
             this.requestWindowFeature(Window.FEATURE_LEFT_ICON);
             this.requestWindowFeature(Window.FEATURE_RIGHT_ICON);
@@ -687,18 +686,14 @@
         FrameLayout frameLayout = (FrameLayout) getWindow().getDecorView()
                 .findViewById(com.android.internal.R.id.content);
         if (CUSTOM_BROWSER_BAR) {
-            mContentView = new FrameLayout(this);
             // This LinearLayout will hold the title bar and a FrameLayout, which
             // holds everything else.
-            LinearLayout linearLayout = new LinearLayout(this);
-            linearLayout.setOrientation(LinearLayout.VERTICAL);
-            linearLayout.addView(mTitleBar, new LinearLayout.LayoutParams(
-                    ViewGroup.LayoutParams.FILL_PARENT,
-                    ViewGroup.LayoutParams.WRAP_CONTENT));
-            linearLayout.addView(mContentView, new LinearLayout.LayoutParams(
-                    ViewGroup.LayoutParams.FILL_PARENT,
-                    ViewGroup.LayoutParams.FILL_PARENT));
-
+            LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this)
+                    .inflate(R.layout.custom_screen, null);
+            mTitleBar = (TitleBar) linearLayout.findViewById(R.id.title_bar);
+            mTitleBar.setBrowserActivity(this);
+            mContentView = (FrameLayout) linearLayout.findViewById(
+                    R.id.main_content);
             frameLayout.addView(linearLayout, COVER_SCREEN_PARAMS);
         } else {
             mContentView = frameLayout;
@@ -4627,7 +4622,7 @@
         mMenuState = EMPTY_MENU;
     }
 
-    private void bookmarksOrHistoryPicker(boolean startWithHistory) {
+    /* package */ void bookmarksOrHistoryPicker(boolean startWithHistory) {
         WebView current = mTabControl.getCurrentWebView();
         if (current == null) {
             return;
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index b512c78..f43058b 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -18,55 +18,42 @@
 
 import android.content.Context;
 import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
 import android.webkit.WebView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.TextView;
-import android.view.LayoutInflater;
-import android.view.View;
 
-/* package */ class TitleBar extends LinearLayout {
+public class TitleBar extends LinearLayout {
     private TextView        mTitle;
     private TextView        mUrl;
-    private ImageView       mZoomIn;
-    private View            mZoomOut;
+    private ImageView       mLftButton;
+    private Drawable        mBookmarkDrawable;
+    private View            mRtButton;
     private View            mDivider;
     private ProgressBar     mCircularProgress;
     private ProgressBar     mHorizontalProgress;
     private ImageView       mFavicon;
     private ImageView       mLockIcon;
     private boolean         mInLoad;
-    private CharSequence    mTitleOnceLoaded;
-    private BrowserActivity mActivity;
 
+    public TitleBar(Context context) {
+        this(context, null);
+    }
 
-    /* package */ TitleBar(BrowserActivity context) {
-        super(context);
-        mActivity = context;
+    public TitleBar(Context context, AttributeSet attrs) {
+        super(context, attrs);
         LayoutInflater factory = LayoutInflater.from(context);
         factory.inflate(R.layout.title_bar, this);
 
         mTitle = (TextView) findViewById(R.id.title);
         mUrl = (TextView) findViewById(R.id.url);
 
-        mZoomIn = (ImageView) findViewById(R.id.zoom_in);
-        mZoomIn.setOnClickListener(new View.OnClickListener() {
-                    public void onClick(View v) {
-                        if (mInLoad) {
-                            mActivity.getTopWindow().stopLoading();
-                        } else {
-                            mActivity.getTopWindow().zoomIn();
-                        }
-                    }
-                });
-        mZoomOut = findViewById(R.id.zoom_out);
-        // Make zoom out disappear while loading
-        mZoomOut.setOnClickListener(new View.OnClickListener() {
-                    public void onClick(View v) {
-                        mActivity.getTopWindow().zoomOut();
-                    }
-                });
+        mLftButton = (ImageView) findViewById(R.id.lft_button);
+        mRtButton = findViewById(R.id.rt_button);
 
         mCircularProgress = (ProgressBar) findViewById(R.id.progress_circular);
         mHorizontalProgress = (ProgressBar) findViewById(
@@ -74,9 +61,32 @@
         mFavicon = (ImageView) findViewById(R.id.favicon);
         mLockIcon = (ImageView) findViewById(R.id.lock_icon);
         mDivider = findViewById(R.id.divider);
+    }
+
+    /* package */ void setBrowserActivity(final BrowserActivity activity) {
+        mLftButton.setOnClickListener(new View.OnClickListener() {
+                    public void onClick(View v) {
+                        if (mInLoad) {
+                            WebView webView = activity.getTopWindow();
+                            if (webView != null) {
+                                webView.stopLoading();
+                            }
+                        } else {
+                            activity.bookmarksOrHistoryPicker(false);
+                        }
+                    }
+                });
+        mRtButton.setOnClickListener(new View.OnClickListener() {
+                    public void onClick(View v) {
+                        WebView webView = activity.getTopWindow();
+                        if (webView != null) {
+                            webView.zoomScrollOut();
+                        }
+                    }
+                });
         setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
-                mActivity.onSearchRequested();
+                activity.onSearchRequested();
             }
         });
     }
@@ -98,10 +108,9 @@
         if (newProgress == mCircularProgress.getMax()) {
             mCircularProgress.setVisibility(View.GONE);
             mHorizontalProgress.setVisibility(View.GONE);
-            mTitle.setText(mTitleOnceLoaded);
             mDivider.setVisibility(View.VISIBLE);
-            mZoomOut.setVisibility(View.VISIBLE);
-            mZoomIn.setImageResource(R.drawable.ic_titlebar_zoom);
+            mRtButton.setVisibility(View.VISIBLE);
+            mLftButton.setImageDrawable(mBookmarkDrawable);
             mInLoad = false;
         } else {
             mCircularProgress.setProgress(newProgress);
@@ -109,16 +118,21 @@
             mCircularProgress.setVisibility(View.VISIBLE);
             mHorizontalProgress.setVisibility(View.VISIBLE);
             mDivider.setVisibility(View.GONE);
-            mZoomOut.setVisibility(View.GONE);
-            mZoomIn.setImageResource(com.android.internal.R.drawable.ic_menu_stop);
+            mRtButton.setVisibility(View.GONE);
+            if (mBookmarkDrawable == null) {
+                // The drawable was assigned in the xml file, so it already
+                // exists.  Keep a pointer to it when we switch to the resource
+                // so we can easily switch back.
+                mBookmarkDrawable = mLftButton.getDrawable();
+            }
+            mLftButton.setImageResource(
+                    com.android.internal.R.drawable.ic_menu_stop);
             mInLoad = true;
         }
     }
 
     /* package */ void setTitleAndUrl(CharSequence title, CharSequence url) {
-        mTitleOnceLoaded = title;
-        if (null == title || mHorizontalProgress.getProgress() <
-                mHorizontalProgress.getMax()) {
+        if (null == title) {
             mTitle.setText(R.string.title_bar_loading);
         } else {
             mTitle.setText(title);