Browser bookmark cleanup

- Option to remove bookmark on clicking "star"
  button
- Add bookmark dialog look cleanup
- Hide "account" in "add bookmark dialog" if only
  one account

Change-Id: I42fd4d54f119bb3bcdb784fd2f6f58570d019eee
diff --git a/src/com/android/browser/BreadCrumbView.java b/src/com/android/browser/BreadCrumbView.java
index 0cd8226..1501d21 100644
--- a/src/com/android/browser/BreadCrumbView.java
+++ b/src/com/android/browser/BreadCrumbView.java
@@ -60,6 +60,7 @@
     private int mMaxVisible = -1;
     private Context mContext;
     private int mCrumbPadding;
+    private TextView mOverflowView;
 
     /**
      * @param context
@@ -164,6 +165,16 @@
         return crumb.crumbView;
     }
 
+    public void addOverflowLabel(TextView view) {
+        mOverflowView = view;
+        if (view != null) {
+            view.setTextAppearance(mContext, R.style.BookmarkPathText);
+            view.setPadding(mCrumbPadding, 0, mCrumbPadding, 0);
+            view.setGravity(Gravity.CENTER_VERTICAL);
+            view.setText("... >");
+        }
+    }
+
     public void pushView(View view, Object data) {
         Crumb crumb = new Crumb(view, true, data);
         pushCrumb(crumb);
@@ -211,7 +222,7 @@
         params.setMargins(0, 0, 4 * mCrumbPadding, 0);
         mCrumbLayout.setLayoutParams(params);
         mCrumbLayout.setVisibility(View.VISIBLE);
-        addParentLabel();
+        //addParentLabel();
         addView(mCrumbLayout);
     }
 
@@ -275,11 +286,15 @@
 
     private void updateVisible() {
         // start at index 1 (0 == parent label)
-        int childIndex = 1;
+        int childIndex = 0;
         if (mMaxVisible >= 0) {
             int invisibleCrumbs = size() - mMaxVisible;
             if (invisibleCrumbs > 0) {
                 int crumbIndex = 0;
+                if (mOverflowView != null) {
+                    mOverflowView.setVisibility(VISIBLE);
+                    mOverflowView.setOnClickListener(this);
+                }
                 while (crumbIndex < invisibleCrumbs) {
                     // Set the crumb to GONE.
                     mCrumbLayout.getChildAt(childIndex).setVisibility(View.GONE);
@@ -287,6 +302,10 @@
                     // Move to the next crumb.
                     crumbIndex++;
                 }
+            } else {
+                if (mOverflowView != null) {
+                    mOverflowView.setVisibility(GONE);
+                }
             }
             // Make sure the last is visible.
             int childCount = mCrumbLayout.getChildCount();
@@ -333,6 +352,13 @@
         if (mBackButton == v) {
             popView();
             notifyController();
+        } else if (mOverflowView == v) {
+            int maxVisible = getMaxVisible();
+            while (maxVisible > 0) {
+                pop(false);
+                maxVisible--;
+            }
+            notifyController();
         } else {
             // pop until view matches crumb view
             while (v != getTopCrumb().crumbView) {
@@ -397,10 +423,10 @@
 
         private TextView makeCrumbView(String name) {
             TextView tv = new TextView(mContext);
-            tv.setTextAppearance(mContext, R.style.BookmarkText);
+            tv.setTextAppearance(mContext, R.style.BookmarkPathText);
             tv.setPadding(mCrumbPadding, 0, mCrumbPadding, 0);
             tv.setGravity(Gravity.CENTER_VERTICAL);
-            tv.setText(name);
+            tv.setText(name + " >");
             tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                     LayoutParams.MATCH_PARENT));
             tv.setSingleLine();