Replace old list widget with new thumbnail widget

 Bug: 3336562

Change-Id: Ic612b5309f185658f4515bbc90cc44d8b9ccf1e0
diff --git a/res/drawable-hdpi/bookmarks_widget_thumb_selector_pressed.9.png b/res/drawable-hdpi/bookmarks_widget_thumb_selector_pressed.9.png
new file mode 100644
index 0000000..a329b19
--- /dev/null
+++ b/res/drawable-hdpi/bookmarks_widget_thumb_selector_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi/border_thumb_bookmarks_widget_holo.9.png b/res/drawable-hdpi/border_thumb_bookmarks_widget_holo.9.png
new file mode 100644
index 0000000..ab0ece8
--- /dev/null
+++ b/res/drawable-hdpi/border_thumb_bookmarks_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/gradient_overlay_bg_bookmark_widget_holo.png b/res/drawable-hdpi/gradient_overlay_bg_bookmark_widget_holo.png
deleted file mode 100644
index c530cc5..0000000
--- a/res/drawable-hdpi/gradient_overlay_bg_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_bookmark_widget_bookmark_holo_dark.png b/res/drawable-hdpi/ic_bookmark_widget_bookmark_holo_dark.png
new file mode 100644
index 0000000..d7c9bd9
--- /dev/null
+++ b/res/drawable-hdpi/ic_bookmark_widget_bookmark_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/overlay_url_bookmark_widget_holo.9.png b/res/drawable-hdpi/overlay_url_bookmark_widget_holo.9.png
new file mode 100644
index 0000000..570d238
--- /dev/null
+++ b/res/drawable-hdpi/overlay_url_bookmark_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/thumb_bookmark_widget_folder_back_holo.png b/res/drawable-hdpi/thumb_bookmark_widget_folder_back_holo.png
new file mode 100644
index 0000000..9ca04c1
--- /dev/null
+++ b/res/drawable-hdpi/thumb_bookmark_widget_folder_back_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/thumb_bookmark_widget_folder_holo.png b/res/drawable-hdpi/thumb_bookmark_widget_folder_holo.png
new file mode 100644
index 0000000..e221fd2
--- /dev/null
+++ b/res/drawable-hdpi/thumb_bookmark_widget_folder_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/app_web_browser_sm.png b/res/drawable-mdpi/app_web_browser_sm.png
index dbb460a..21245c2 100644
--- a/res/drawable-mdpi/app_web_browser_sm.png
+++ b/res/drawable-mdpi/app_web_browser_sm.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_bookmark_widget_holo.9.png b/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
index ac56bbe..d95f8d3 100644
--- a/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
+++ b/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/bookmarks_widget_thumb_selector_pressed.9.png b/res/drawable-mdpi/bookmarks_widget_thumb_selector_pressed.9.png
new file mode 100644
index 0000000..6ec1576
--- /dev/null
+++ b/res/drawable-mdpi/bookmarks_widget_thumb_selector_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi/border_thumb_bookmarks_widget_holo.9.png b/res/drawable-mdpi/border_thumb_bookmarks_widget_holo.9.png
new file mode 100644
index 0000000..486e5e8
--- /dev/null
+++ b/res/drawable-mdpi/border_thumb_bookmarks_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/gradient_overlay_bg_bookmark_widget_holo.png b/res/drawable-mdpi/gradient_overlay_bg_bookmark_widget_holo.png
deleted file mode 100644
index 1673338..0000000
--- a/res/drawable-mdpi/gradient_overlay_bg_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/header_bg_bookmark_widget_holo.png b/res/drawable-mdpi/header_bg_bookmark_widget_holo.png
deleted file mode 100644
index 9c3f7a6..0000000
--- a/res/drawable-mdpi/header_bg_bookmark_widget_holo.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/header_row_press_bookmark_widget_holo.9.png b/res/drawable-mdpi/header_row_press_bookmark_widget_holo.9.png
deleted file mode 100644
index 2e8874e..0000000
--- a/res/drawable-mdpi/header_row_press_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_bookmark_widget_bookmark_holo_dark.png b/res/drawable-mdpi/ic_bookmark_widget_bookmark_holo_dark.png
new file mode 100644
index 0000000..70477aa
--- /dev/null
+++ b/res/drawable-mdpi/ic_bookmark_widget_bookmark_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/overlay_url_bookmark_widget_holo.9.png b/res/drawable-mdpi/overlay_url_bookmark_widget_holo.9.png
new file mode 100644
index 0000000..a72900d
--- /dev/null
+++ b/res/drawable-mdpi/overlay_url_bookmark_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png b/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png
index 8c9614b..6b387a0 100644
--- a/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png
+++ b/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/thumb_bookmark_widget_folder_back_holo.png b/res/drawable-mdpi/thumb_bookmark_widget_folder_back_holo.png
new file mode 100644
index 0000000..e75e53f
--- /dev/null
+++ b/res/drawable-mdpi/thumb_bookmark_widget_folder_back_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/thumb_bookmark_widget_folder_holo.png b/res/drawable-mdpi/thumb_bookmark_widget_folder_holo.png
new file mode 100644
index 0000000..58ad3a0
--- /dev/null
+++ b/res/drawable-mdpi/thumb_bookmark_widget_folder_holo.png
Binary files differ
diff --git a/res/drawable/bookmark_widget_thumb_selector.xml b/res/drawable/bookmark_widget_thumb_selector.xml
new file mode 100644
index 0000000..d9b8171
--- /dev/null
+++ b/res/drawable/bookmark_widget_thumb_selector.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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">
+    <item android:state_pressed="true" android:drawable="@drawable/bookmarks_widget_thumb_selector_pressed" />
+    <item android:drawable="@android:color/transparent" />
+</selector>
+
diff --git a/res/drawable/browser_widget_preview.png b/res/drawable/browser_widget_preview.png
old mode 100755
new mode 100644
index a3f48dd..4923978
--- a/res/drawable/browser_widget_preview.png
+++ b/res/drawable/browser_widget_preview.png
Binary files differ
diff --git a/res/drawable/widget_background.xml b/res/drawable/widget_background.xml
index de6c3f2..15f8a59 100644
--- a/res/drawable/widget_background.xml
+++ b/res/drawable/widget_background.xml
@@ -16,14 +16,16 @@
 
 <layer-list
     xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <bitmap
-            android:src="@drawable/gradient_overlay_bg_bookmark_widget_holo"
-            android:gravity="top|fill_horizontal" />
+    <item
+        android:drawable="@drawable/bg_bookmark_widget_holo">
     </item>
     <item>
         <bitmap
             android:src="@drawable/stripes_overlay_bg_bookmark_widget_holo"
-            android:gravity="top|fill_horizontal" />
+            android:gravity="top|left|clip_vertical|clip_horizontal"
+            android:left="3dip"
+            android:right="3dip"
+            android:top="3dip"
+            android:bottom="3dip" />
     </item>
 </layer-list>
diff --git a/res/layout/bookmarklistwidget.xml b/res/layout/bookmarklistwidget.xml
deleted file mode 100644
index f3857f8..0000000
--- a/res/layout/bookmarklistwidget.xml
+++ /dev/null
@@ -1,99 +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.
--->
-<FrameLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:paddingTop="4dip"
-    android:paddingBottom="20dip"
-    android:paddingLeft="12dip"
-    android:paddingRight="12dip">
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical"
-        android:background="@drawable/bg_bookmark_widget_holo"
-        android:paddingLeft="0dip"
-        android:paddingRight="0dip"
-        android:paddingBottom="0dip">
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="42dip"
-            android:orientation="horizontal"
-            android:background="@drawable/header_bg_bookmark_widget_holo"
-            android:layout_marginLeft="5dip"
-            android:layout_marginRight="5dip">
-            <LinearLayout
-                android:id="@+id/header_browser"
-                android:layout_width="0dip"
-                android:layout_height="match_parent"
-                android:layout_weight="1"
-                android:orientation="horizontal"
-                android:paddingLeft="16dip"
-                android:focusable="true"
-                android:clickable="true"
-                android:background="@drawable/widget_header_selector">
-                <ImageView
-                    android:id="@+id/logo"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_vertical"
-                    android:src="@drawable/ic_browser_bookmark_widget_holo" />
-                <TextView
-                    android:layout_width="0dip"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:layout_gravity="center_vertical"
-                    android:text="@string/application_name"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textStyle="bold"
-                    android:paddingLeft="8dip" />
-            </LinearLayout>
-            <ImageView
-                android:id="@+id/header_bookmarks"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:src="@drawable/btn_ic_bookmark_bookmark_widget_holo_dark"
-                android:scaleType="centerInside"
-                android:focusable="true"
-                android:clickable="true"
-                android:background="@drawable/widget_header_selector"
-                android:paddingLeft="8dip"
-                android:paddingRight="8dip" />
-        </LinearLayout>
-        <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:layout_marginLeft="2dip"
-            android:layout_marginRight="2dip" />
-        <ListView
-            android:id="@+id/bookmarks_list"
-            android:layout_width="match_parent"
-            android:layout_height="0dip"
-            android:layout_weight="1"
-            android:background="@drawable/widget_background"
-            android:cacheColorHint="@android:color/transparent"
-            android:divider="@drawable/list_div_bookmark_widget_holo"
-            android:layout_marginLeft="5dip"
-            android:layout_marginRight="5dip" />
-        <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:layout_marginLeft="2dip"
-            android:layout_marginRight="2dip"
-            android:layout_marginBottom="2dip" />
-    </LinearLayout>
-</FrameLayout>
diff --git a/res/layout/bookmarklistwidget_item.xml b/res/layout/bookmarklistwidget_item.xml
deleted file mode 100644
index 2f64054..0000000
--- a/res/layout/bookmarklistwidget_item.xml
+++ /dev/null
@@ -1,43 +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:id="@+id/list_item"
-    android:layout_width="match_parent"
-    android:layout_height="48dp"
-    android:orientation="horizontal"
-    android:background="@drawable/row_activated_bookmark_widget_holo">
-    <ImageView
-        android:id="@+id/thumb"
-        android:src="@drawable/browser_thumbnail"
-        android:layout_height="@dimen/bookmark_widget_thumb_size"
-        android:layout_width="@dimen/bookmark_widget_thumb_size"
-        android:layout_gravity="center_vertical"
-        android:layout_marginLeft="16dp"
-        android:scaleType="centerInside"/>
-    <TextView
-        android:id="@+id/label"
-        android:layout_width="0dip"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
-        android:layout_weight="1"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:paddingLeft="8dip"
-        android:maxLines="1"
-        android:scrollHorizontally="true"
-        android:ellipsize="marquee"/>
-</LinearLayout>
diff --git a/res/layout/bookmarkthumbnailwidget.xml b/res/layout/bookmarkthumbnailwidget.xml
new file mode 100644
index 0000000..581db5c
--- /dev/null
+++ b/res/layout/bookmarkthumbnailwidget.xml
@@ -0,0 +1,57 @@
+<?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.
+-->
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingTop="4dip"
+    android:paddingBottom="22dip"
+    android:paddingLeft="13dip"
+    android:paddingRight="13dip">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:padding="0dip"
+        android:background="@drawable/widget_background">
+        <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:layout_marginTop="2dip"
+            android:layout_marginLeft="1dip"
+            android:layout_marginRight="1dip" />
+        <GridView
+            android:id="@+id/bookmarks_list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+            android:layout_marginLeft="5dip"
+            android:layout_marginRight="5dip"
+            android:numColumns="2"
+            android:padding="1dip"
+            android:stretchMode="columnWidth"
+            android:horizontalSpacing="@dimen/widgetHorizontalSpacing"
+            android:verticalSpacing="@dimen/widgetVerticalSpacing"
+            android:drawSelectorOnTop="true"
+            android:listSelector="@drawable/bookmark_widget_thumb_selector" />
+        <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:layout_marginBottom="3dip"
+            android:layout_marginLeft="1dip"
+            android:layout_marginRight="1dip" />
+    </LinearLayout>
+</FrameLayout>
diff --git a/res/layout/bookmarkthumbnailwidget_item.xml b/res/layout/bookmarkthumbnailwidget_item.xml
new file mode 100644
index 0000000..b67b386
--- /dev/null
+++ b/res/layout/bookmarkthumbnailwidget_item.xml
@@ -0,0 +1,61 @@
+<?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.
+-->
+
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/list_item"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+    <ImageView
+        android:id="@+id/thumb"
+        android:src="@drawable/browser_thumbnail"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/widgetThumbnailHeight"
+        android:scaleType="centerCrop"
+        android:cropToPadding="true"
+        android:background="@drawable/border_thumb_bookmarks_widget_holo" />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignBottom="@id/thumb"
+        android:background="@drawable/overlay_url_bookmark_widget_holo"
+        android:layout_marginLeft="2dip"
+        android:layout_marginRight="2dip"
+        android:layout_marginBottom="2dip">
+        <ImageView
+            android:id="@+id/favicon"
+            android:src="@drawable/app_web_browser_sm"
+            android:layout_width="@dimen/favicon_size"
+            android:layout_height="@dimen/favicon_size"
+            android:layout_gravity="center_vertical"
+            android:layout_marginLeft="4dip"
+            android:layout_marginRight="8dip"
+            android:layout_marginTop="4dip"
+            android:layout_marginBottom="4dip"
+            android:scaleType="centerInside" />
+        <TextView
+            android:id="@+id/label"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:textSize="14sp"
+            android:typeface="sans"
+            android:textStyle="bold"
+            android:textColor="@android:color/white" />
+    </LinearLayout>
+</RelativeLayout>
diff --git a/res/values-xlarge-port/dimensions.xml b/res/values-xlarge-port/dimensions.xml
new file mode 100644
index 0000000..46e7272
--- /dev/null
+++ b/res/values-xlarge-port/dimensions.xml
@@ -0,0 +1,17 @@
+<?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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <dimen name="widgetThumbnailHeight">72dip</dimen>
+    <dimen name="widgetHorizontalSpacing">0dip</dimen>
+    <dimen name="widgetVerticalSpacing">4dip</dimen>
+</resources>
diff --git a/res/values-xlarge/dimensions.xml b/res/values-xlarge/dimensions.xml
index 9f5a602..43e1035 100644
--- a/res/values-xlarge/dimensions.xml
+++ b/res/values-xlarge/dimensions.xml
@@ -13,6 +13,9 @@
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <dimen name="bookmarkThumbnailWidth">180dip</dimen>
     <dimen name="bookmarkThumbnailHeight">120dip</dimen>
+    <dimen name="widgetThumbnailHeight">90dip</dimen>
+    <dimen name="widgetHorizontalSpacing">8dip</dimen>
+    <dimen name="widgetVerticalSpacing">8dip</dimen>
     <dimen name="favicon_padded_size">24dip</dimen>
     <!-- For the most visited page -->
     <dimen name="mv_max_width">1010dp</dimen>
diff --git a/res/xml/bookmarklistwidget_info.xml b/res/xml/bookmarkthumbnailwidget_info.xml
similarity index 94%
rename from res/xml/bookmarklistwidget_info.xml
rename to res/xml/bookmarkthumbnailwidget_info.xml
index c39ce8f..6797f85 100644
--- a/res/xml/bookmarklistwidget_info.xml
+++ b/res/xml/bookmarkthumbnailwidget_info.xml
@@ -21,5 +21,5 @@
     android:minHeight="219dip"
     android:updatePeriodMillis="0"
     android:previewImage="@drawable/browser_widget_preview"
-    android:initialLayout="@layout/bookmarklistwidget">
+    android:initialLayout="@layout/bookmarkthumbnailwidget">
 </appwidget-provider>