diff options
author | Richard MacGregor <rmacgregor@cyngn.com> | 2015-08-26 17:28:23 -0700 |
---|---|---|
committer | Richard MacGregor <rmacgregor@cyngn.com> | 2015-08-27 13:50:35 -0700 |
commit | 5bae6967aedafe578f87f3233016601d08e76814 (patch) | |
tree | 2cbe80e9e9c95670bbf0b3a03b398be7bbb6123d /WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | |
parent | d7328345a365fcc541808d4ed716ce1e11c329ee (diff) | |
download | android_packages_apps_Trebuchet-5bae6967aedafe578f87f3233016601d08e76814.tar.gz android_packages_apps_Trebuchet-5bae6967aedafe578f87f3233016601d08e76814.tar.bz2 android_packages_apps_Trebuchet-5bae6967aedafe578f87f3233016601d08e76814.zip |
Fix wallpaperpreview for default wallpaper
Preview isn't scaled and cropped correctly when previewing wallpaper.
Change-Id: Idfb42c321f8872e6ca49a2b59e16ea01067856be
Ticket: QRDL-1019
Diffstat (limited to 'WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java')
-rwxr-xr-x | WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | 13 |
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 946ce4cfb..1c5cf6b39 100755 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -281,7 +281,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."); @@ -289,9 +289,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); } |