new bookmark screen part 2

    specs here: https://docs.google.com/a/google.com/present/edit?id=0ARMpWryWB2oaY2RkbmZwdnBfODc0Y2diYnBoNDc&hl=en
    moved tabs to top
    added bread crumbs view for folder hierarchy
    changed thumbnail sizes for xlarge screens

Change-Id: I3035f299b343f9aa1ec0dd41772e5594cd6b21f5
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index a507daa..ec4a78a 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -67,6 +67,7 @@
 import android.os.Process;
 import android.os.SystemClock;
 import android.provider.Browser;
+import android.provider.BrowserContract;
 import android.provider.BrowserContract.Images;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.Intents.Insert;
@@ -949,7 +950,6 @@
         if (mActiveTabsPage != null) {
             removeActiveTabPage(true);
         }
-        removeComboView();
 
         cancelStopToast();
 
@@ -1289,8 +1289,11 @@
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
-        // menu remains active, so ensure comboview is dismissed
-        removeComboView();
+        if (item.getGroupId() != R.id.CONTEXT_MENU) {
+            // menu remains active, so ensure comboview is dismissed
+            // if main menu option is selected
+            removeComboView();
+        }
         // check the action bar button before mCanChord check, as the prepare call
         // doesn't come for action bar buttons
         if (item.getItemId() == R.id.newtab) {
@@ -1341,7 +1344,7 @@
                 break;
 
             case R.id.add_bookmark_menu_id:
-                bookmarkCurrentPage();
+                bookmarkCurrentPage(AddBookmarkPage.DEFAULT_FOLDER_ID);
                 break;
 
             case R.id.stop_reload_menu_id:
@@ -1497,7 +1500,11 @@
         return true;
     }
 
-    /* package */ void bookmarkCurrentPage() {
+    /**
+     * add the current page as a bookmark to the given folder id
+     * @param folderId use -1 for the default folder
+     */
+    /* package */ void bookmarkCurrentPage(long folderId) {
         Intent i = new Intent(BrowserActivity.this,
                 AddBookmarkPage.class);
         WebView w = getTopWindow();
@@ -1506,6 +1513,8 @@
         i.putExtra("touch_icon_url", w.getTouchIconUrl());
         i.putExtra("thumbnail", createScreenshot(w, getDesiredThumbnailWidth(this),
                 getDesiredThumbnailHeight(this)));
+        i.putExtra(BrowserContract.Bookmarks.PARENT,
+                folderId);
         // Put the dialog at the upper right of the screen, covering the
         // star on the title bar.
         i.putExtra("gravity", Gravity.RIGHT | Gravity.TOP);
@@ -2231,7 +2240,9 @@
                         // if tab page is showing, hide it
                         removeActiveTabPage(true);
                     } else if (mComboView != null) {
-                        removeComboView();
+                        if (!mComboView.onBackPressed()) {
+                            removeComboView();
+                        }
                     } else {
                         WebView subwindow = mTabControl.getCurrentSubWindow();
                         if (subwindow != null) {
@@ -3876,7 +3887,7 @@
     public boolean onMenuItemClick(MenuItem item) {
         switch(item.getItemId()) {
             case R.id.add_bookmark_menu_id:
-                bookmarkCurrentPage();
+                bookmarkCurrentPage(AddBookmarkPage.DEFAULT_FOLDER_ID);
                 return true;
             case R.id.shortcut_to_home_menu_id:
                 Tab current = mTabControl.getCurrentTab();
@@ -3920,7 +3931,7 @@
         builder.setItems(choices, new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int item) {
                 if (item == 0) {
-                    bookmarkCurrentPage();
+                    bookmarkCurrentPage(AddBookmarkPage.DEFAULT_FOLDER_ID);
                 } else if (item == 1) {
                 }
             }