summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Poultney <poultney@google.com>2023-03-29 20:14:29 +0000
committerChris Poultney <poultney@google.com>2023-03-31 18:15:51 +0000
commit6a76e49e0c8e458d46846db35c3cbcfcd8062300 (patch)
tree16275996db41570f11d2d77014d71b294e8bf751
parent64c480f6e0c09d22cb9acfab0f1761da42b4caf0 (diff)
Shows blurred thumbnail before fading to live preview
Bug: 268066031 Test: manually verified blur display and fade to preview Change-Id: Idf6dc5a825f7541912a7bb891ce8f2b5b52aea9f
-rw-r--r--res/layout/grid_preview_card.xml2
-rw-r--r--src/com/android/customization/picker/WallpaperPreviewer.java14
2 files changed, 12 insertions, 4 deletions
diff --git a/res/layout/grid_preview_card.xml b/res/layout/grid_preview_card.xml
index 6df8508a..a2691df8 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 ef16895c..1b9ea9fc 100644
--- a/src/com/android/customization/picker/WallpaperPreviewer.java
+++ b/src/com/android/customization/picker/WallpaperPreviewer.java
@@ -19,6 +19,8 @@ import android.app.Activity;
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 @@ public class WallpaperPreviewer implements LifecycleObserver {
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 class WallpaperPreviewer implements LifecycleObserver {
}
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 @@ public class WallpaperPreviewer implements LifecycleObserver {
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);