Merge change 26630 into eclair

* changes:
  Tweaks to improve the look of the bookmarks page.
diff --git a/res/layout/bookmark_thumbnail.xml b/res/layout/bookmark_thumbnail.xml
index 61ac50a..d53350b 100644
--- a/res/layout/bookmark_thumbnail.xml
+++ b/res/layout/bookmark_thumbnail.xml
@@ -17,17 +17,14 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:orientation="vertical"
-    android:padding="4dip"
+    android:padding="0dip"
     >
 
-    <!-- Keep the width in sync with BrowserBookmarksPage and
-            BrowserActivity.updateScreenshot -->
     <ImageView android:id="@+id/thumb"
         android:src="@drawable/ic_launcher_shortcut_browser_bookmark"
         android:scaleType="center"
-        android:layout_width="100dip"
-        android:layout_height="80dip"
-        android:background="@drawable/bookmark_shadow"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
         />
 
     <!-- FIXME: Want to have a gradient over the thumb -->
@@ -37,7 +34,7 @@
         android:layout_height="fill_parent"
         android:layout_width="fill_parent"
         android:orientation="horizontal"
-        android:background="#cc000000"
+        android:background="#99000000"
         android:gravity="center"
         android:layout_alignBottom="@+id/thumb"
         android:layout_alignTop="@+id/thumb"
@@ -45,8 +42,6 @@
         <ImageView
             android:layout_height="wrap_content"
             android:layout_width="wrap_content"
-            android:layout_marginTop="3dip"
-            android:layout_marginBottom="3dip"
             android:src="@drawable/ic_tab_browser_bookmark_selected"
             />
         <TextView
@@ -60,17 +55,19 @@
     </LinearLayout>
 
     <TextView android:id="@+id/label"
-        android:layout_width="100dip"
+        android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="bottom"
         android:textAppearance="?android:attr/textAppearanceSmall"
         android:textStyle="bold"
         android:textColor="@color/white"
         android:maxLines="1"
-        android:paddingTop="3dip"
-        android:paddingBottom="3dip"
         android:paddingLeft="2dip"
         android:paddingRight="2dip"
+        android:paddingTop="0dip"
+        android:paddingBottom="0dip"
+        android:layout_marginTop="0dip"
+        android:layout_marginBottom="16dip"
         android:scrollHorizontally="true"
         android:ellipsize="marquee"
         android:layout_below="@+id/thumb"
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index faf0e6b..ff8a589 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -2335,16 +2335,24 @@
         }
     }
 
+    /**
+     * Constants for the size of the thumbnail created when taking a screenshot
+     */
+    /* package */ static final int THUMBNAIL_WIDTH = 130;
+    /* package */ static final int THUMBNAIL_HEIGHT = 104;
+
     private Bitmap createScreenshot(WebView view) {
         Picture thumbnail = view.capturePicture();
-        // Keep width and height in sync with BrowserBookmarksPage
-        // and bookmark_thumb
-        Bitmap bm = Bitmap.createBitmap(100, 80,
+        Bitmap bm = Bitmap.createBitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT,
                 Bitmap.Config.ARGB_4444);
         Canvas canvas = new Canvas(bm);
         // May need to tweak these values to determine what is the
         // best scale factor
-        canvas.scale(.5f, .5f);
+        int contentWidth = view.getContentWidth();
+        if (contentWidth > 0) {
+            float scaleFactor = (float) THUMBNAIL_WIDTH / (float) contentWidth;
+            canvas.scale(scaleFactor, scaleFactor);
+        }
         thumbnail.draw(canvas);
         return bm;
     }
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 019806c..0f1754e 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -293,9 +293,7 @@
                 mGridPage.setAdapter(mBookmarksAdapter);
                 mGridPage.setOnItemClickListener(mListener);
                 mGridPage.setNumColumns(GridView.AUTO_FIT);
-                // Keep this in sync with bookmark_thumb and
-                // BrowserActivity.updateScreenshot
-                mGridPage.setColumnWidth(100);
+                mGridPage.setColumnWidth(BrowserActivity.THUMBNAIL_WIDTH);
                 mGridPage.setFocusable(true);
                 mGridPage.setFocusableInTouchMode(true);
                 mGridPage.setSelector(android.R.drawable.gallery_thumb);