Add wallpaper zoom to areas that have blur
Whenever blurring, the wallpaper should also zoom out. This is the
mental model of our Depth System.
Test: manual
Bug: 149792636
Change-Id: I1783eb87fefeb6f917f0ba64f2c6ec8f1f2004fa
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1413a5c..921d34a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -124,7 +124,7 @@
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.AllAppsSwipeController;
import com.android.launcher3.touch.ItemClickHandler;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -326,14 +326,14 @@
private boolean mDeferOverlayCallbacks;
private final Runnable mDeferredOverlayCallbacks = this::checkIfOverlayStillDeferred;
- private BackgroundBlurController mBackgroundBlurController =
- new BackgroundBlurController(this);
+ private DepthController mDepthController =
+ new DepthController(this);
private final ViewTreeObserver.OnDrawListener mOnDrawListener =
new ViewTreeObserver.OnDrawListener() {
@Override
public void onDraw() {
- getBackgroundBlurController().setSurfaceToLauncher(mDragLayer);
+ getDepthController().setSurfaceToLauncher(mDragLayer);
mDragLayer.post(() -> mDragLayer.getViewTreeObserver().removeOnDrawListener(
this));
}
@@ -954,7 +954,7 @@
NotificationListener.removeNotificationsChangedListener();
getStateManager().moveToRestState();
- getBackgroundBlurController().setSurfaceToLauncher(null);
+ getDepthController().setSurfaceToLauncher(null);
// Workaround for b/78520668, explicitly trim memory once UI is hidden
onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
@@ -2708,7 +2708,7 @@
protected StateHandler[] createStateHandlers() {
return new StateHandler[] { getAllAppsController(), getWorkspace(),
- getBackgroundBlurController() };
+ getDepthController() };
}
public TouchController[] createTouchControllers() {
@@ -2745,8 +2745,8 @@
return Stream.of(APP_INFO, WIDGETS, INSTALL);
}
- public BackgroundBlurController getBackgroundBlurController() {
- return mBackgroundBlurController;
+ public DepthController getDepthController() {
+ return mDepthController;
}
public static Launcher getLauncher(Context context) {
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index df71f16..6ee82cd 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -271,11 +271,13 @@
}
/**
- * The amount of blur to apply to the background of either the app or Launcher surface in this
- * state.
+ * The amount of blur and wallpaper zoom to apply to the background of either the app
+ * or Launcher surface in this state. Should be a number between 0 and 1, inclusive.
+ *
+ * 0 means completely zoomed in, without blurs. 1 is zoomed out, with blurs.
*/
- public int getBackgroundBlurRadius(Context context) {
- return 0;
+ public float getDepth(Context context) {
+ return 0f;
}
public String getDescription(Launcher launcher) {
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index f72e674..b83609e 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -21,7 +21,6 @@
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import static com.android.launcher3.graphics.IconShape.getShape;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
-import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -47,7 +46,6 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PropertyResetListener;
import com.android.launcher3.dragndrop.DragLayer;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
import com.android.launcher3.util.Themes;
import java.util.List;
@@ -222,14 +220,6 @@
Animator z = getAnimator(mFolder, View.TRANSLATION_Z, -mFolder.getElevation(), 0);
play(a, z, mIsOpening ? midDuration : 0, midDuration);
- BackgroundBlurController blurController = mLauncher.getBackgroundBlurController();
- int stateBackgroundBlur = mLauncher.getStateManager().getState()
- .getBackgroundBlurRadius(mLauncher);
- int folderBackgroundBlurAdjustment = blurController.getFolderBackgroundBlurAdjustment();
- play(a, ObjectAnimator.ofInt(blurController, BACKGROUND_BLUR, mIsOpening
- ? stateBackgroundBlur + folderBackgroundBlurAdjustment
- : stateBackgroundBlur));
-
// Store clip variables
CellLayout cellLayout = mContent.getCurrentCellLayout();
boolean folderClipChildren = mFolder.getClipChildren();