Merge "History UI update" into honeycomb
diff --git a/res/drawable-hdpi/appwidget_bg.9.png b/res/drawable-hdpi/appwidget_bg.9.png
deleted file mode 100644
index 3b29eae..0000000
--- a/res/drawable-hdpi/appwidget_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/frame_bookmark_thumb_pressed.9.png b/res/drawable-hdpi/frame_bookmark_thumb_pressed.9.png
deleted file mode 100644
index a1190d9..0000000
--- a/res/drawable-hdpi/frame_bookmark_thumb_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/header_bg_bookmark_widget_holo.png b/res/drawable-hdpi/header_bg_bookmark_widget_holo.png
deleted file mode 100644
index e709698..0000000
--- a/res/drawable-hdpi/header_bg_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/header_row_focused_bookmark_widget_holo.9.png b/res/drawable-hdpi/header_row_focused_bookmark_widget_holo.9.png
deleted file mode 100644
index b3406fd..0000000
--- a/res/drawable-hdpi/header_row_focused_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/row_activated_bookmark_widget_holo.9.png b/res/drawable-hdpi/row_activated_bookmark_widget_holo.9.png
deleted file mode 100644
index b6cfc4c..0000000
--- a/res/drawable-hdpi/row_activated_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/header_row_press_bookmark_widget_holo.9.png b/res/drawable-hdpi/suggest_item_press_holo.9.png
similarity index 100%
rename from res/drawable-hdpi/header_row_press_bookmark_widget_holo.9.png
rename to res/drawable-hdpi/suggest_item_press_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appwidget_bg.9.png b/res/drawable-mdpi/appwidget_bg.9.png
deleted file mode 100644
index afe41b6..0000000
--- a/res/drawable-mdpi/appwidget_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/frame_bookmark_thumb_pressed.9.png b/res/drawable-mdpi/frame_bookmark_thumb_pressed.9.png
deleted file mode 100755
index 8bae932..0000000
--- a/res/drawable-mdpi/frame_bookmark_thumb_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/header_row_focused_bookmark_widget_holo.9.png b/res/drawable-mdpi/header_row_focused_bookmark_widget_holo.9.png
deleted file mode 100644
index b745159..0000000
--- a/res/drawable-mdpi/header_row_focused_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/row_activated_bookmark_widget_holo.9.png b/res/drawable-mdpi/row_activated_bookmark_widget_holo.9.png
deleted file mode 100644
index ed8760f..0000000
--- a/res/drawable-mdpi/row_activated_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/header_row_press_bookmark_widget_holo.9.png b/res/drawable-mdpi/suggest_item_press_holo.9.png
similarity index 100%
rename from res/drawable-mdpi/header_row_press_bookmark_widget_holo.9.png
rename to res/drawable-mdpi/suggest_item_press_holo.9.png
Binary files differ
diff --git a/res/drawable/suggest_item_selector.xml b/res/drawable/suggest_item_selector.xml
index 777a8fb..1184e5b 100644
--- a/res/drawable/suggest_item_selector.xml
+++ b/res/drawable/suggest_item_selector.xml
@@ -17,6 +17,6 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
         android:exitFadeDuration="@android:integer/config_mediumAnimTime">
     <item android:state_pressed="true"
-        android:drawable="@drawable/header_row_press_bookmark_widget_holo" />
+        android:drawable="@drawable/suggest_item_press_holo" />
     <item android:state_pressed="false" android:drawable="@drawable/clear" />
 </selector>
diff --git a/res/drawable/widget_background.xml b/res/drawable/widget_background.xml
deleted file mode 100644
index 4c59d60..0000000
--- a/res/drawable/widget_background.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<layer-list
-    xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:drawable="@drawable/bg_bookmark_widget_holo">
-    </item>
-
-</layer-list>
diff --git a/res/drawable/widget_header_selector.xml b/res/drawable/widget_header_selector.xml
deleted file mode 100644
index 0e6bc47..0000000
--- a/res/drawable/widget_header_selector.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:exitFadeDuration="@android:integer/config_mediumAnimTime">
-    <item
-        android:state_window_focused="false"
-        android:drawable="@android:color/transparent" />
-    <item
-        android:state_focused="true"
-        android:state_pressed="true"
-        android:drawable="@drawable/header_row_press_bookmark_widget_holo" />
-    <item
-        android:state_focused="false"
-        android:state_pressed="true"
-        android:drawable="@drawable/header_row_press_bookmark_widget_holo" />
-    <item
-        android:state_focused="true"
-        android:drawable="@drawable/header_row_focused_bookmark_widget_holo" />
-</selector>
diff --git a/res/layout/bookmarkwidget.xml b/res/layout/bookmarkwidget.xml
deleted file mode 100644
index c7c2a90..0000000
--- a/res/layout/bookmarkwidget.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:padding="8dip"
-    android:orientation="vertical"
-    android:background="@drawable/appwidget_bg" >
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal" >
-
-        <ImageView
-            android:id="@+id/previous"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:padding="10dip"
-            android:src="@*android:drawable/ic_btn_find_prev" />
-
-        <TextView
-            android:id="@+id/title"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:layout_gravity="center"
-            android:text="@string/title_bar_loading"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textColor="?android:attr/textColorPrimary" />
-
-        <ImageView
-            android:id="@+id/next"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:padding="10dip"
-            android:src="@*android:drawable/ic_btn_find_next" />
-
-    </LinearLayout>
-
-    <ImageView
-        android:id="@+id/image"
-        android:visibility="gone"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:scaleType="fitXY"
-        android:padding="5dip"
-        android:gravity="center" />
-
-    <RelativeLayout
-        android:id="@+id/progress"
-        android:visibility="visible"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:gravity="center" >
-
-        <ProgressBar
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:indeterminateOnly="true" />
-
-    </RelativeLayout>
-
-</LinearLayout>
diff --git a/res/layout/suggestion_item.xml b/res/layout/suggestion_item.xml
index ab87dd4..d3a2404 100644
--- a/res/layout/suggestion_item.xml
+++ b/res/layout/suggestion_item.xml
@@ -57,7 +57,8 @@
                 style="@style/SuggestionLineSmall"
                 android:singleLine="true"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+                android:layout_height="wrap_content"
+                android:textColor="@color/urlTextColor" />
         </LinearLayout>
     </LinearLayout>
     <ImageView
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 835f3ba..84e5348 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -33,4 +33,5 @@
     <color name="qc_slice_active">#E02090FF</color>
     <color name="bookmarkWidgetFaviconBackground">#23ffffff</color>
     <color name="bookmarkListFaviconBackground">#23ffffff</color>
+    <color name="urlTextColor">#0E774A</color>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 05042db..02f94ce 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -254,6 +254,9 @@
     <!-- Context Menu item to save the webpage referred to by this link to the
             SD card (external storage) -->
     <string name="contextmenu_savelink">Save link</string>
+    <!-- Context Menu item to send the url of the selected link to someone else,
+            via Gmail or another app [CHAR LIMIT=50] -->
+    <string name="contextmenu_sharelink">Share link</string>
     <!-- Context Menu item -->
     <string name="contextmenu_copy">Copy</string>
     <!-- Context Menu item to copy the url of the selected link to the
diff --git a/res/xml/bookmarkwidget.xml b/res/xml/bookmarkwidget.xml
deleted file mode 100644
index adbe5f2..0000000
--- a/res/xml/bookmarkwidget.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- 4x4 Widget displaying the user's bookmarks as thumbnails. -->
-<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
-    android:minWidth="294dip"
-    android:minHeight="294dip"
-    android:updatePeriodMillis="3600000"
-    android:initialLayout="@layout/bookmarkwidget"
-    >
-</appwidget-provider>
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index a93a518..ee080ca 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -105,7 +105,7 @@
     private View mFolderNamerHolder;
     private View mAddNewFolder;
     private View mAddSeparator;
-    private long mCurrentFolder = 0;
+    private long mCurrentFolder;
     private FolderAdapter mAdapter;
     private BreadCrumbView mCrumbs;
     private TextView mFakeTitle;
@@ -218,8 +218,26 @@
             if (mSaveToHomeScreen) {
                 mFolder.setSelectionIgnoringSelectionChange(0);
             } else {
-                // FIXME: Need to find the actual folder.
-                mFolder.setSelectionIgnoringSelectionChange(mEditingFolder ? 0 : 1);
+                if (mCurrentFolder == mRootFolder) {
+                    mFolder.setSelectionIgnoringSelectionChange(mEditingFolder ? 0 : 1);
+                } else {
+                    Object data = mCrumbs.getTopData();
+                    if (data != null && ((Folder) data).Id == mCurrentFolder) {
+                        // We are showing the correct folder heirarchy. The
+                        // folder selector will say "Other folder..."  Change it
+                        // to say the name of the folder once again.
+                        ((TextView) mFolder.getSelectedView()).setText(((Folder) data).Name);
+                    } else {
+                        // We are not be showing the correct folder heirarchy.
+                        // Clear the Crumbs and find the proper folder
+                        mCrumbs.clear();
+                        setupTopCrumb();
+                        LoaderManager manager = getLoaderManager();
+                        manager.restartLoader(LOADER_ID_ALL_FOLDERS, null, this);
+                        manager.restartLoader(LOADER_ID_FOLDER_CONTENTS, null, this);
+
+                    }
+                }
             }
         }
     }
@@ -709,11 +727,7 @@
         if (mCurrentFolder == DEFAULT_FOLDER_ID) {
             mCurrentFolder = mRootFolder;
         }
-        String name = getString(R.string.bookmarks);
-        mTopLevelLabel = (TextView) mCrumbs.pushView(name, false,
-                new Folder(name, mRootFolder));
-        // To better match the other folders.
-        mTopLevelLabel.setCompoundDrawablePadding(6);
+        setupTopCrumb();
         if (mEditingExisting || TextUtils.isEmpty(mOriginalUrl)) {
             onCurrentFolderFound();
         } else {
@@ -724,6 +738,14 @@
         }
     }
 
+    private void setupTopCrumb() {
+        String name = getString(R.string.bookmarks);
+        mTopLevelLabel = (TextView) mCrumbs.pushView(name, false,
+                new Folder(name, mRootFolder));
+        // To better match the other folders.
+        mTopLevelLabel.setCompoundDrawablePadding(6);
+    }
+
     private void onCurrentFolderFound() {
         LoaderManager manager = getLoaderManager();
         if (mCurrentFolder != mRootFolder) {
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 5ccfdda..98fc349 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -430,7 +430,9 @@
                         CombinedBookmarkHistoryView.FRAGMENT_ID_HISTORY
                         : CombinedBookmarkHistoryView.FRAGMENT_ID_BOOKMARKS,
                 extras);
-        getEmbeddedTitleBar().setVisibility(View.GONE);
+        FrameLayout wrapper =
+            (FrameLayout) mContentView.findViewById(R.id.webview_wrapper);
+        wrapper.setVisibility(View.GONE);
         hideFakeTitleBar();
         dismissIME();
         if (mActiveTab != null) {
@@ -447,7 +449,9 @@
     public void hideComboView() {
         if (mComboView != null) {
             mContentView.removeView(mComboView);
-            getEmbeddedTitleBar().setVisibility(View.VISIBLE);
+            FrameLayout wrapper =
+                (FrameLayout) mContentView.findViewById(R.id.webview_wrapper);
+            wrapper.setVisibility(View.VISIBLE);
             mComboView = null;
         }
         if (mActiveTab != null) {
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index e4b3201..2a34aba 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -178,6 +178,8 @@
                         current.getWebView().dumpRenderTree(true);
                     } else if ("about:debug.display".equals(urlData.mUrl)) {
                         current.getWebView().dumpDisplayTree();
+                    } else if ("about:debug.nav".equals(urlData.mUrl)) {
+                        current.getWebView().debugDump();
                     } else {
                         mSettings.toggleDebugSettings();
                     }
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java
index abf9088..c2e203a 100644
--- a/src/com/android/browser/SuggestionsAdapter.java
+++ b/src/com/android/browser/SuggestionsAdapter.java
@@ -45,8 +45,8 @@
         OnClickListener {
 
     static final int TYPE_BOOKMARK = 0;
-    static final int TYPE_SUGGEST_URL = 1;
-    static final int TYPE_HISTORY = 2;
+    static final int TYPE_HISTORY = 1;
+    static final int TYPE_SUGGEST_URL = 2;
     static final int TYPE_SEARCH = 3;
     static final int TYPE_SUGGEST = 4;
     static final int TYPE_VOICE_SEARCH = 5;
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 9b344ec..d50d94e 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -20,6 +20,7 @@
 
 import android.app.ActionBar;
 import android.app.Activity;
+import android.os.Bundle;
 import android.util.Log;
 import android.view.ActionMode;
 import android.view.Gravity;
@@ -71,6 +72,14 @@
     }
 
     @Override
+    public void showComboView(boolean startWithHistory, Bundle extras) {
+        super.showComboView(startWithHistory, extras);
+        if (mUseQuickControls) {
+            mActionBar.show();
+        }
+    }
+
+    @Override
     public void hideComboView() {
         super.hideComboView();
         // ComboView changes the action bar, set it back up to what we want