diff --git a/res/layout-sw720dp/apps_customize_widget.xml b/res/layout-sw720dp/apps_customize_widget.xml
deleted file mode 100644
index e707ef7745..0000000000
--- a/res/layout-sw720dp/apps_customize_widget.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/layout/apps_customize_widget.xml b/res/layout/apps_customize_widget.xml
index 2c11c1db90..704401a83a 100644
--- a/res/layout/apps_customize_widget.xml
+++ b/res/layout/apps_customize_widget.xml
@@ -68,6 +68,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:padding="8dp"
+ android:paddingTop="@dimen/app_widget_preview_padding_top"
+ android:paddingLeft="@dimen/app_widget_preview_padding_left"
android:scaleType="matrix" />
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
new file mode 100644
index 0000000000..0373295d4f
--- /dev/null
+++ b/res/values-sw720dp/dimens.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ 0dp
+ 10dp
+
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 124cf16b27..9ba77a98a0 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -108,6 +108,8 @@
16dp
16dp
16dp
+ 8dp
+ 8dp
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 5a54c78978..4d8a9cf719 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -949,18 +949,22 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
Log.w(LOG_TAG, "Can't load icon drawable 0x" + Integer.toHexString(info.icon)
+ " for provider: " + info.provider);
} else {
- // Scale down the preview to something that is closer to the cellWidth/Height
- int imageWidth = drawable.getIntrinsicWidth();
- int imageHeight = drawable.getIntrinsicHeight();
- int bitmapWidth = imageWidth;
- int bitmapHeight = imageHeight;
- if (imageWidth > imageHeight) {
- bitmapWidth = cellWidth;
- bitmapHeight = (int) (imageHeight * ((float) bitmapWidth / imageWidth));
+ // Map the target width/height to the cell dimensions
+ int targetWidth = mWidgetSpacingLayout.estimateCellWidth(cellHSpan);
+ int targetHeight = mWidgetSpacingLayout.estimateCellHeight(cellVSpan);
+ int targetCellWidth;
+ int targetCellHeight;
+ if (targetWidth >= targetHeight) {
+ targetCellWidth = Math.min(targetWidth, cellWidth);
+ targetCellHeight = (int) (cellHeight * ((float) targetCellWidth / cellWidth));
} else {
- bitmapHeight = cellHeight;
- bitmapWidth = (int) (imageWidth * ((float) bitmapHeight / imageHeight));
+ targetCellHeight = Math.min(targetHeight, cellHeight);
+ targetCellWidth = (int) (cellWidth * ((float) targetCellHeight / cellHeight));
}
+ // Map the preview to the target cell dimensions
+ int bitmapWidth = Math.min(targetCellWidth, drawable.getIntrinsicWidth());
+ int bitmapHeight = (int) (drawable.getIntrinsicHeight() *
+ ((float) bitmapWidth / drawable.getIntrinsicWidth()));
preview = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Config.ARGB_8888);
renderDrawableToBitmap(drawable, preview, 0, 0, bitmapWidth, bitmapHeight);
@@ -989,7 +993,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
} else {
// Otherwise, ensure that we are properly sized within the cellWidth/Height
- if (targetWidth > targetHeight) {
+ if (targetWidth >= targetHeight) {
bitmapWidth = Math.min(targetWidth, cellWidth);
bitmapHeight = (int) (targetHeight * ((float) bitmapWidth / targetWidth));
iconScale = Math.min((float) bitmapHeight / (mAppIconSize + 2 * minOffset), 1f);