Merge "Shows blurred thumbnail before fading to live preview" into tm-qpr-dev
diff --git a/res/layout/grid_preview_card.xml b/res/layout/grid_preview_card.xml
index 6df8508..a2691df 100644
--- a/res/layout/grid_preview_card.xml
+++ b/res/layout/grid_preview_card.xml
@@ -39,7 +39,7 @@
android:layout_height="match_parent"
android:importantForAccessibility="noHideDescendants" />
- <View
+ <ImageView
android:id="@+id/grid_fadein_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/src/com/android/customization/picker/WallpaperPreviewer.java b/src/com/android/customization/picker/WallpaperPreviewer.java
index ef16895..1b9ea9f 100644
--- a/src/com/android/customization/picker/WallpaperPreviewer.java
+++ b/src/com/android/customization/picker/WallpaperPreviewer.java
@@ -19,6 +19,8 @@
import android.app.WallpaperColors;
import android.content.Intent;
import android.graphics.Rect;
+import android.graphics.RenderEffect;
+import android.graphics.Shader.TileMode;
import android.service.wallpaper.WallpaperService;
import android.view.Surface;
import android.view.SurfaceView;
@@ -54,7 +56,7 @@
private final Activity mActivity;
private final ImageView mHomePreview;
private final SurfaceView mWallpaperSurface;
- @Nullable private final View mFadeInScrim;
+ @Nullable private final ImageView mFadeInScrim;
private WallpaperSurfaceCallback mWallpaperSurfaceCallback;
private WallpaperInfo mWallpaper;
@@ -73,7 +75,7 @@
}
public WallpaperPreviewer(Lifecycle lifecycle, Activity activity, ImageView homePreview,
- SurfaceView wallpaperSurface, @Nullable View fadeInScrim) {
+ SurfaceView wallpaperSurface, @Nullable ImageView fadeInScrim) {
lifecycle.addObserver(this);
mActivity = activity;
@@ -170,10 +172,16 @@
mActivity, android.R.attr.colorSecondary),
/* offsetToStart= */ true);
if (mWallpaper instanceof LiveWallpaperInfo) {
+ ImageView preview = homeImageWallpaper;
+ if (VideoWallpaperUtils.needsFadeIn(mWallpaper) && mFadeInScrim != null) {
+ preview = mFadeInScrim;
+ preview.setRenderEffect(
+ RenderEffect.createBlurEffect(150f, 150f, TileMode.CLAMP));
+ }
mWallpaper.getThumbAsset(mActivity.getApplicationContext())
.loadPreviewImage(
mActivity,
- homeImageWallpaper,
+ preview,
ResourceUtils.getColorAttr(
mActivity, android.R.attr.colorSecondary),
/* offsetToStart= */ true);