From 89d0d098f09e870297047d9b8db34bd0e60e3d47 Mon Sep 17 00:00:00 2001 From: Santiago Etchebehere Date: Wed, 21 Aug 2019 16:36:15 -0700 Subject: Use CenterCropBitmapTask for theme wallpapers Instead of just scaling the image, use CenterCropBitmapTask which scales and crops the image so that it's not distorted as much. Fixes: 139828164 Change-Id: Ic5649e3dc031c20365f250e1ed988708a905c666 --- src/com/android/customization/picker/theme/ThemeFragment.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java index f584dec9..e4682bb7 100644 --- a/src/com/android/customization/picker/theme/ThemeFragment.java +++ b/src/com/android/customization/picker/theme/ThemeFragment.java @@ -23,6 +23,7 @@ import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; +import android.graphics.Matrix; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; @@ -61,6 +62,7 @@ import com.android.customization.widget.OptionSelectorController; import com.android.customization.widget.PreviewPager; import com.android.wallpaper.R; import com.android.wallpaper.asset.Asset; +import com.android.wallpaper.asset.Asset.CenterCropBitmapTask; import com.android.wallpaper.model.WallpaperInfo; import com.android.wallpaper.module.CurrentWallpaperInfoFactory; import com.android.wallpaper.module.InjectorProvider; @@ -552,7 +554,9 @@ public class ThemeFragment extends ToolbarFragment { if (wallpaperPreviewAsset != null) { wallpaperPreviewAsset.decodeBitmap( targetWidth, targetHeight, - bitmap -> setWallpaperBitmap(view, bitmap)); + bitmap -> new CenterCropBitmapTask(bitmap, view, + croppedBitmap -> setWallpaperBitmap(view, croppedBitmap)) + .execute()); } view.removeOnLayoutChangeListener(this); } -- cgit v1.2.3