Show a highlighted star for bookmarked pages.

Bug:3222677

Change-Id: Ifeb6e7a922c0defb1e4a88ded0c188b97e0a4a56
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index 0aa09db..cd3b230 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -26,9 +26,11 @@
 import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
+import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.widget.CheckBox;
 import android.widget.ImageView;
 import android.widget.TextView;
 
@@ -48,7 +50,7 @@
     private View mContainer;
     private View mBackButton;
     private View mForwardButton;
-    private View mStar;
+    private CheckBox mStar;
     private View mSearchButton;
     private View mFocusContainer;
     private View mUnfocusContainer;
@@ -82,7 +84,7 @@
         // back/forward.  Probably should be done inside onPageStarted.
         mBackButton = findViewById(R.id.back);
         mForwardButton = findViewById(R.id.forward);
-        mStar = findViewById(R.id.star);
+        mStar = (CheckBox) findViewById(R.id.star);
         mStopButton = (ImageView) findViewById(R.id.stop);
         mSearchButton = findViewById(R.id.search);
         mLockIcon = (ImageView) findViewById(R.id.lock);
@@ -106,6 +108,10 @@
         mUnfocusContainer.setOnClickListener(this);
     }
 
+    public void setCurrentUrlIsBookmark(boolean isBookmark) {
+        mStar.setChecked(isBookmark);
+    }
+
     @Override
     public void onClick(View v) {
         if (mUnfocusContainer == v) {
@@ -237,4 +243,25 @@
         mUrlUnfocused.setText(title);
     }
 
+    /**
+     * Custom CheckBox which does not toggle when pressed.  Used by mStar.
+     */
+    public static class CustomCheck extends CheckBox {
+        public CustomCheck(Context context) {
+            super(context);
+        }
+
+        public CustomCheck(Context context, AttributeSet attrs) {
+            super(context, attrs);
+        }
+
+        public CustomCheck(Context context, AttributeSet attrs, int defStyle) {
+            super(context, attrs, defStyle);
+        }
+
+        @Override
+        public void toggle() {
+            // Do nothing
+        }
+    }
 }