diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-04-04 23:25:33 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-04-04 23:25:33 +0000 |
commit | 436a4ee77807c8d394f5c0fcce557074e8112a34 (patch) | |
tree | d83774e2b6c7edc7e9222c1fa6c2541a35d29163 | |
parent | a74b5b38f9a7477812870941c96d4cf888d3b16c (diff) | |
parent | 4894e95179abe8d0329bc3afb51b49beaf2f29db (diff) | |
download | WallpaperPicker2-436a4ee77807c8d394f5c0fcce557074e8112a34.tar.gz |
Snap for 9883365 from 4894e95179abe8d0329bc3afb51b49beaf2f29db to tm-qpr3-release
Change-Id: Ic34f048e2b2807283224e87a2e22d75aa2ab74c6
-rw-r--r-- | res/layout/wallpaper_preview_card.xml | 2 | ||||
-rw-r--r-- | src/com/android/wallpaper/model/WallpaperSectionController.java | 22 | ||||
-rw-r--r-- | src/com/android/wallpaper/util/VideoWallpaperUtils.java | 2 |
3 files changed, 17 insertions, 9 deletions
diff --git a/res/layout/wallpaper_preview_card.xml b/res/layout/wallpaper_preview_card.xml index 085695e6..266bb386 100644 --- a/res/layout/wallpaper_preview_card.xml +++ b/res/layout/wallpaper_preview_card.xml @@ -61,7 +61,7 @@ android:layout_gravity="center" android:visibility="gone" /> - <View + <ImageView android:id="@+id/wallpaper_fadein_scrim" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/src/com/android/wallpaper/model/WallpaperSectionController.java b/src/com/android/wallpaper/model/WallpaperSectionController.java index c9e867e6..d61330e2 100644 --- a/src/com/android/wallpaper/model/WallpaperSectionController.java +++ b/src/com/android/wallpaper/model/WallpaperSectionController.java @@ -26,6 +26,8 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Resources; +import android.graphics.RenderEffect; +import android.graphics.Shader.TileMode; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; @@ -89,12 +91,12 @@ public class WallpaperSectionController implements private WorkspaceSurfaceHolderCallback mWorkspaceSurfaceCallback; private SurfaceView mHomeWallpaperSurface; private WallpaperSurfaceCallback mHomeWallpaperSurfaceCallback; - private View mHomeFadeInScrim; + private ImageView mHomeFadeInScrim; private SurfaceView mLockWallpaperSurface; private WallpaperSurfaceCallback mLockWallpaperSurfaceCallback; private CardView mLockscreenPreviewCard; private ViewGroup mLockPreviewContainer; - private View mLockFadeInScrim; + private ImageView mLockFadeInScrim; private ContentLoadingProgressBar mLockscreenPreviewProgress; private WallpaperConnection mHomeWallpaperConnection; private WallpaperConnection mLockWallpaperConnection; @@ -191,7 +193,7 @@ public class WallpaperSectionController implements mHomeWallpaperSurface, colorFuture, () -> { if (mHomePreviewWallpaperInfo != null) { maybeLoadThumbnail(mHomePreviewWallpaperInfo, mHomeWallpaperSurfaceCallback, - mDisplayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(mActivity)); + mDisplayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(mActivity), true); } }); @@ -207,7 +209,7 @@ public class WallpaperSectionController implements mLockscreenPreviewCard, mLockWallpaperSurface, colorFuture, () -> { if (mLockPreviewWallpaperInfo != null) { maybeLoadThumbnail(mLockPreviewWallpaperInfo, mLockWallpaperSurfaceCallback, - mDisplayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(mActivity)); + mDisplayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(mActivity), false); } }); mLockPreviewContainer = mLockscreenPreviewCard.findViewById( @@ -442,7 +444,7 @@ public class WallpaperSectionController implements // Load thumb regardless of live wallpaper to make sure we have a placeholder while // the live wallpaper initializes in that case. maybeLoadThumbnail(wallpaperInfo, surfaceCallback, - mDisplayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(mActivity)); + mDisplayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(mActivity), isHomeWallpaper); WallpaperManager wallpaperManager = WallpaperManager.getInstance(mActivity); if (wallpaperManager.isLockscreenLiveWallpaperEnabled()) { @@ -472,13 +474,19 @@ public class WallpaperSectionController implements @NonNull private Asset maybeLoadThumbnail(WallpaperInfo wallpaperInfo, - WallpaperSurfaceCallback surfaceCallback, boolean offsetToStart) { - ImageView imageView = surfaceCallback.getHomeImageWallpaper(); + WallpaperSurfaceCallback surfaceCallback, boolean offsetToStart, boolean isHome) { + ImageView liveThumbnailView = isHome ? mHomeFadeInScrim : mLockFadeInScrim; + ImageView imageView = VideoWallpaperUtils.needsFadeIn(wallpaperInfo) ? liveThumbnailView + : surfaceCallback.getHomeImageWallpaper(); Asset thumbAsset = wallpaperInfo.getThumbAsset(mAppContext); // Respect offsetToStart only for CurrentWallpaperAssetVN otherwise true. offsetToStart = !(thumbAsset instanceof CurrentWallpaperAssetVN) || offsetToStart; thumbAsset = new BitmapCachingAsset(mAppContext, thumbAsset); if (imageView != null && imageView.getDrawable() == null) { + if (VideoWallpaperUtils.needsFadeIn(wallpaperInfo)) { + imageView.setRenderEffect( + RenderEffect.createBlurEffect(50f, 50f, TileMode.CLAMP)); + } thumbAsset.loadPreviewImage(mActivity, imageView, ResourceUtils.getColorAttr(mActivity, android.R.attr.colorSecondary), offsetToStart); diff --git a/src/com/android/wallpaper/util/VideoWallpaperUtils.java b/src/com/android/wallpaper/util/VideoWallpaperUtils.java index 7acffda7..2093fe83 100644 --- a/src/com/android/wallpaper/util/VideoWallpaperUtils.java +++ b/src/com/android/wallpaper/util/VideoWallpaperUtils.java @@ -29,7 +29,7 @@ public class VideoWallpaperUtils { /** * Transition time for fade-in animation. */ - public static final int TRANSITION_MILLIS = 175; + public static final int TRANSITION_MILLIS = 250; /** * Returns true if the is a video wallpaper that requires the fade-in workaround. |