Merge "Adds "Most Visited" group to history"
diff --git a/res/layout/bookmarklistwidget.xml b/res/layout/bookmarklistwidget.xml
index ffaa0c3..983854c 100644
--- a/res/layout/bookmarklistwidget.xml
+++ b/res/layout/bookmarklistwidget.xml
@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:background="#00000000"
+ android:background="@null"
android:focusable="true"
android:clickable="true">
<LinearLayout
@@ -28,7 +28,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dip"
- android:background="#383847">
+ android:background="@color/bookmarkWidgetHeader">
<ImageView
android:id="@+id/logo"
android:layout_width="32dp"
@@ -40,15 +40,14 @@
android:layout_gravity="center_vertical"
android:text="@string/tab_bookmarks"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/white"
android:paddingLeft="8dip" />
</LinearLayout>
<ListView
android:id="@+id/bookmarks_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#2b2b3c"
- android:cacheColorHint="#2b2b3c"
- android:dividerHeight="0dp"
- android:divider="#00000000" />
+ android:background="@color/bookmarkWidgetItemBackground"
+ android:cacheColorHint="@color/bookmarkWidgetItemBackground"
+ android:dividerHeight="1px"
+ android:divider="@color/bookmarkWidgetDivider" />
</LinearLayout>
diff --git a/res/layout/bookmarklistwidget_item.xml b/res/layout/bookmarklistwidget_item.xml
index 2257a26..9e41d39 100644
--- a/res/layout/bookmarklistwidget_item.xml
+++ b/res/layout/bookmarklistwidget_item.xml
@@ -19,9 +19,10 @@
android:id="@+id/list_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:minHeight="@dimen/widgetItemMinHeight"
android:orientation="horizontal"
android:padding="8dip"
- android:background="#383847">
+ android:background="@color/bookmarkWidgetFolderBackground">
<ImageView
android:id="@+id/thumb"
android:src="@drawable/browser_thumbnail"
@@ -35,7 +36,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/white"
android:paddingLeft="8dip"
android:maxLines="1"
android:scrollHorizontally="true"
diff --git a/res/raw/thumb_amazon.png b/res/raw/thumb_amazon.png
index eec1d77..4dd2f35 100644
--- a/res/raw/thumb_amazon.png
+++ b/res/raw/thumb_amazon.png
Binary files differ
diff --git a/res/raw/thumb_bbc.png b/res/raw/thumb_bbc.png
index 9cdd902..dff0424 100644
--- a/res/raw/thumb_bbc.png
+++ b/res/raw/thumb_bbc.png
Binary files differ
diff --git a/res/raw/thumb_cnn.png b/res/raw/thumb_cnn.png
index 70b7ea2..3d6fdc9 100644
--- a/res/raw/thumb_cnn.png
+++ b/res/raw/thumb_cnn.png
Binary files differ
diff --git a/res/raw/thumb_ebay.png b/res/raw/thumb_ebay.png
index 070fa6c..023f678 100644
--- a/res/raw/thumb_ebay.png
+++ b/res/raw/thumb_ebay.png
Binary files differ
diff --git a/res/raw/thumb_espn.png b/res/raw/thumb_espn.png
index 94918e2..c0882eb 100644
--- a/res/raw/thumb_espn.png
+++ b/res/raw/thumb_espn.png
Binary files differ
diff --git a/res/raw/thumb_facebook.png b/res/raw/thumb_facebook.png
index 6e295b1..a8c047f 100644
--- a/res/raw/thumb_facebook.png
+++ b/res/raw/thumb_facebook.png
Binary files differ
diff --git a/res/raw/thumb_google.png b/res/raw/thumb_google.png
index 1753788..c54e6ea 100644
--- a/res/raw/thumb_google.png
+++ b/res/raw/thumb_google.png
Binary files differ
diff --git a/res/raw/thumb_msn.png b/res/raw/thumb_msn.png
index 2240e12..4ad710f 100644
--- a/res/raw/thumb_msn.png
+++ b/res/raw/thumb_msn.png
Binary files differ
diff --git a/res/raw/thumb_myspace.png b/res/raw/thumb_myspace.png
index 3f39ac5..d6f6e76 100644
--- a/res/raw/thumb_myspace.png
+++ b/res/raw/thumb_myspace.png
Binary files differ
diff --git a/res/raw/thumb_picasa.png b/res/raw/thumb_picasa.png
index dca6a7d..5ec2d7a 100644
--- a/res/raw/thumb_picasa.png
+++ b/res/raw/thumb_picasa.png
Binary files differ
diff --git a/res/raw/thumb_weatherchannel.png b/res/raw/thumb_weatherchannel.png
index c91e54c..a190a0c 100644
--- a/res/raw/thumb_weatherchannel.png
+++ b/res/raw/thumb_weatherchannel.png
Binary files differ
diff --git a/res/raw/thumb_yahoo.png b/res/raw/thumb_yahoo.png
index 115d8bb..08dd759 100644
--- a/res/raw/thumb_yahoo.png
+++ b/res/raw/thumb_yahoo.png
Binary files differ
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 822c3b4..5a5d255 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -24,4 +24,9 @@
<color name="black">#ff000000</color>
<color name="geolocation_permissions_prompt_background">#ffdddddd</color>
+
+ <color name="bookmarkWidgetHeader">#383847</color>
+ <color name="bookmarkWidgetDivider">#383847</color>
+ <color name="bookmarkWidgetItemBackground">#2b2b3c</color>
+ <color name="bookmarkWidgetFolderBackground">#A0383847</color>
</resources>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index f550cf7..404b2ac 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -23,4 +23,5 @@
<dimen name="bookmarkThumbnailHeight">80dip</dimen>
<dimen name="add_bookmark_width">500dip</dimen>
<dimen name="folder_selector_height">300dip</dimen>
+ <dimen name="widgetItemMinHeight">48dip</dimen>
</resources>
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 6b0ab0e..7d183f6 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1776,25 +1776,23 @@
// best scale factor
int thumbnailWidth = thumbnail.getWidth();
int thumbnailHeight = thumbnail.getHeight();
- float scaleFactorX = 1.0f;
- float scaleFactorY = 1.0f;
+ float scaleFactor = 1.0f;
if (thumbnailWidth > 0) {
- scaleFactorX = (float) width / (float)thumbnailWidth;
+ scaleFactor = (float) width / (float)thumbnailWidth;
} else {
return null;
}
+
if (view.getWidth() > view.getHeight() &&
thumbnailHeight < view.getHeight() && thumbnailHeight > 0) {
// If the device is in landscape and the page is shorter
- // than the height of the view, stretch the thumbnail to fill the
- // space.
- scaleFactorY = (float) height / (float)thumbnailHeight;
- } else {
- // In the portrait case, this looks nice.
- scaleFactorY = scaleFactorX;
+ // than the height of the view, center the thumnail and crop the sides
+ scaleFactor = (float) height / (float)thumbnailHeight;
+ float wx = (thumbnailWidth * scaleFactor) - width;
+ canvas.translate((int) -(wx / 2), 0);
}
- canvas.scale(scaleFactorX, scaleFactorY);
+ canvas.scale(scaleFactor, scaleFactor);
thumbnail.draw(canvas);
return bm;
diff --git a/src/com/android/browser/widget/BookmarkListWidgetService.java b/src/com/android/browser/widget/BookmarkListWidgetService.java
index 1120536..14b52b7 100644
--- a/src/com/android/browser/widget/BookmarkListWidgetService.java
+++ b/src/com/android/browser/widget/BookmarkListWidgetService.java
@@ -233,7 +233,7 @@
views.setDrawableParameters(R.id.list_item, true, 0, -1, null, -1);
if (res.mIsFolder) {
if (folder != null && res.mId == folder.mId) {
- views.setDrawableParameters(R.id.list_item, true, 140, -1, null, -1);
+ views.setDrawableParameters(R.id.list_item, true, 255, -1, null, -1);
views.setImageViewResource(R.id.thumb, R.drawable.ic_back_normal);
} else {
views.setImageViewResource(R.id.thumb, R.drawable.ic_folder);