summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard MacGregor <rmacgregor@cyngn.com>2015-08-27 00:28:23 (GMT)
committerRichard MacGregor <rmacgregor@cyngn.com>2015-08-27 20:51:34 (GMT)
commit4d8145d572803b288c2f2f0bd425575ced7bbcce (patch)
tree7e0d10d378081aa4e26c7dc017ef186e5c92352f
parente709bdd23575be9c951910ed2bea892f013afcc8 (diff)
downloadandroid_packages_apps_Trebuchet-4d8145d572803b288c2f2f0bd425575ced7bbcce.zip
android_packages_apps_Trebuchet-4d8145d572803b288c2f2f0bd425575ced7bbcce.tar.gz
android_packages_apps_Trebuchet-4d8145d572803b288c2f2f0bd425575ced7bbcce.tar.bz2
Fix wallpaperpreview for default wallpaper
Preview isn't scaled and cropped correctly when previewing wallpaper. Change-Id: Idfb42c321f8872e6ca49a2b59e16ea01067856be Ticket: QRDL-1019 (cherry picked from commit 5bae6967aedafe578f87f3233016601d08e76814)
-rwxr-xr-xWallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
index 27f1a53..2b253fd 100755
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -286,7 +286,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
CropView c = a.getCropView();
Drawable defaultWallpaper = WallpaperManager.getInstance(a).getBuiltInDrawable(
- c.getWidth(), c.getHeight(), false, 0.5f, 0.5f);
+ 0, 0, false, 0.5f, 0.5f);
if (defaultWallpaper == null) {
Log.w(TAG, "Null default wallpaper encountered.");
@@ -294,9 +294,14 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
return;
}
- c.setTileSource(
- new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE), null);
- c.setScale(1f);
+ c.setTileSource(new DrawableTileSource(
+ a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE), null);
+ Point wallpaperSize = WallpaperCropActivity.getDefaultWallpaperSize(
+ a.getResources(), a.getWindowManager());
+ RectF crop = WallpaperCropActivity.getMaxCropRect(
+ defaultWallpaper.getIntrinsicWidth(), defaultWallpaper.getIntrinsicHeight(),
+ wallpaperSize.x, wallpaperSize.y, false);
+ c.setScale(wallpaperSize.x / crop.width());
c.setTouchEnabled(false);
a.setSystemWallpaperVisiblity(false);
}