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/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);