summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-07-30 15:04:59 -0700
committerHyunyoung Song <hyunyoungs@google.com>2015-07-30 15:04:59 -0700
commitb9f932e08902c21020b6a98372c1a68548b8de59 (patch)
tree0a174302bec54a4cfcc4c5dcda7510b609414630
parent946609f0ea70e1361dbe979af0e054d4c18b929b (diff)
downloadandroid_packages_apps_Trebuchet-b9f932e08902c21020b6a98372c1a68548b8de59.tar.gz
android_packages_apps_Trebuchet-b9f932e08902c21020b6a98372c1a68548b8de59.tar.bz2
android_packages_apps_Trebuchet-b9f932e08902c21020b6a98372c1a68548b8de59.zip
Prevent from widget cell preview image from being cut off.
b/22541466 >TL;DR;; when introducing mProfileBadgeMargin to correctly place > work profile badge. Drawing origin of the preview image resulted > to the left of (0, 0). Change-Id: Ic52fc2e17c55c76f4f57aa833451ffa19bbbeb09
-rw-r--r--src/com/android/launcher3/WidgetPreviewLoader.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java
index 629387ed0..2a8053d52 100644
--- a/src/com/android/launcher3/WidgetPreviewLoader.java
+++ b/src/com/android/launcher3/WidgetPreviewLoader.java
@@ -386,7 +386,7 @@ public class WidgetPreviewLoader {
preScaledWidthOut[0] = previewWidth;
}
if (previewWidth > maxPreviewWidth) {
- scale = maxPreviewWidth / (float) previewWidth;
+ scale = (maxPreviewWidth - 2 * mProfileBadgeMargin) / (float) (previewWidth);
}
if (scale != 1f) {
previewWidth = (int) (scale * previewWidth);
@@ -405,7 +405,7 @@ public class WidgetPreviewLoader {
}
// Draw the scaled preview into the final bitmap
- int x = (preview.getWidth() - previewWidth - mProfileBadgeMargin) / 2;
+ int x = (preview.getWidth() - previewWidth) / 2;
if (widgetPreviewExists) {
drawable.setBounds(x, 0, x + previewWidth, previewHeight);
drawable.draw(c);