commit | 578461344ce9a571f7dbacc47ee4f514f6fae927 | [log] [tgz] |
---|---|---|
author | Kunhung Li <kunhungli@google.com> | Thu Jun 17 08:49:11 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Jun 17 08:49:11 2021 +0000 |
tree | e75b88df9b2f748b59fd38b3b471c5a6cdd657d5 | |
parent | bac41621d8e5111defdb23f39c268258035f687f [diff] | |
parent | 2f1179b589454a9dad984f009f347eabd35e00a0 [diff] |
Merge "Fix glitchy animation in Settings" into sc-dev am: 686eff64e3 am: 2f1179b589 Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/WallpaperPicker2/+/14928657 Change-Id: I4066f9fb85fe9952f0b8d4eafccf4045b79fb369
diff --git a/src/com/android/wallpaper/model/CustomizationSectionController.java b/src/com/android/wallpaper/model/CustomizationSectionController.java index bfa3ec3..b01f098 100644 --- a/src/com/android/wallpaper/model/CustomizationSectionController.java +++ b/src/com/android/wallpaper/model/CustomizationSectionController.java
@@ -51,4 +51,7 @@ /** Releases the controller. */ default void release() {} + + /** Gets called when the section gets transitioned out. */ + default void onTransitionOut() {} }
diff --git a/src/com/android/wallpaper/model/WallpaperSectionController.java b/src/com/android/wallpaper/model/WallpaperSectionController.java index 7c43baa..7346cc3 100644 --- a/src/com/android/wallpaper/model/WallpaperSectionController.java +++ b/src/com/android/wallpaper/model/WallpaperSectionController.java
@@ -531,4 +531,23 @@ mLockPreviewContainer.setVisibility(visibility); } } + + @Override + public void onTransitionOut() { + if (mHomeWallpaperSurface != null) { + mHomeWallpaperSurface.setUseAlpha(); + mHomeWallpaperSurface.setAlpha(0f); + } + if (mLockWallpaperSurface != null) { + mLockWallpaperSurface.setUseAlpha(); + mLockWallpaperSurface.setAlpha(0f); + } + if (mWorkspaceSurface != null) { + mWorkspaceSurface.setUseAlpha(); + mWorkspaceSurface.setAlpha(0f); + } + if (mLockPreviewContainer != null) { + mLockPreviewContainer.setAlpha(0f); + } + } }
diff --git a/src/com/android/wallpaper/picker/CustomizationPickerFragment.java b/src/com/android/wallpaper/picker/CustomizationPickerFragment.java index 176ee1c..75f1b46 100644 --- a/src/com/android/wallpaper/picker/CustomizationPickerFragment.java +++ b/src/com/android/wallpaper/picker/CustomizationPickerFragment.java
@@ -116,6 +116,15 @@ } @Override + public boolean onBackPressed() { + // TODO(b/191120122) Improve glitchy animation in Settings. + if (ActivityUtils.isLaunchedFromSettingsSearch(getActivity().getIntent())) { + mSectionControllers.forEach(CustomizationSectionController::onTransitionOut); + } + return super.onBackPressed(); + } + + @Override public void onDestroyView() { mSectionControllers.forEach(CustomizationSectionController::release); mSectionControllers.clear();
diff --git a/src/com/android/wallpaper/util/ActivityUtils.java b/src/com/android/wallpaper/util/ActivityUtils.java index c4d49f8..eb2adb2 100755 --- a/src/com/android/wallpaper/util/ActivityUtils.java +++ b/src/com/android/wallpaper/util/ActivityUtils.java
@@ -83,7 +83,7 @@ * * @param intent activity intent. */ - private static boolean isLaunchedFromSettingsSearch(Intent intent) { + public static boolean isLaunchedFromSettingsSearch(Intent intent) { return (intent != null && intent.hasExtra(LAUNCH_SETTINGS_SEARCH)); }