Add functionality to DepthController to control wallpaper zoom indepedently of blur

Also add wallpaper zoom to folder motion

Bug: b/387543793
Flag: com.android.launcher3.enable_expressive_folder_expansion
Test: manually and DepthControllerTest
Change-Id: I94142806ffb6dfb93d363017ef4d13b3a5e74681
This commit is contained in:
Charlie Anderson authored and Pun Butrach committed 2026-10-26 00:08:46 +07:00
1 parent 0d40f78616
commit e9c655dbf6
8 files changed
+200 -16

No files matched your search

@@ -73,6 +73,8 @@ class FolderAnimationSpringBuilderManager(
workspace.scaleY = 1f
hotseat.scaleX = 1f
hotseat.scaleY = 1f
launcherDelegate.launcher?.depthController?.folderZoom?.value = 0f
scrim.alpha = 1f
scrim.setBackgroundColor(Color.TRANSPARENT)
if (Utilities.ATLEAST_S && launcher.stateManager.state.getDepth(launcher) == 0f) {
@@ -37,6 +37,8 @@ import com.android.launcher3.Utilities.isDarkTheme
import com.android.launcher3.anim.SpringAnimationBuilder
import com.android.launcher3.apppairs.AppPairIcon
import com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW
import com.android.launcher3.util.MultiPropertyFactory
import com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE
/** Holder for Animators created from [FolderAnimationSpringBuilderManager] */
class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
@@ -55,6 +57,7 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
private const val DAMPING_ALPHA = 0.9f
private const val STIFFNESS_LAUNCHER_SCRIM = 380f
private const val DAMPING_LAUNCHER_SCRIM = 0.98f
private const val WALLPAPER_ZOOM = 0.125f
/**
* Factory method to take data calculated from [FolderAnimationSpringBuilderManager], and
@@ -78,6 +81,14 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
folderAnimData.isOpening,
launcherDelegate,
)
launcherDelegate.launcher?.depthController?.folderZoom?.let {
addWallpaperZoomAnimator(
folder.context,
animatorSet,
folderAnimData.isOpening,
it,
)
}
iconAnimData.forEach { addContentIconAnimators(folder.context, animatorSet, it) }
return FolderSpringAnimatorSet(animatorSet)
}
@@ -224,6 +235,27 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
)
}
private fun addWallpaperZoomAnimator(
context: Context,
animatorSet: AnimatorSet,
isOpening: Boolean,
property: MultiPropertyFactory<*>.MultiProperty,
) {
playSpringAnimation(
context = context,
animatorSet = animatorSet,
isOpening = isOpening,
startDelay = 0,
stiffness = STIFFNESS_SHAPE_POSITION,
damping = DAMPING_SHAPE_POSITION,
startValue = 0f,
endValue = WALLPAPER_ZOOM,
minVisibleChange = MIN_VISIBLE_CHANGE_SCALE,
property = MULTI_PROPERTY_VALUE,
view = property,
)
}
private fun addAlphaAndColorAnimators(
folder: Folder,
animatorSet: AnimatorSet,
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.statehandlers
import android.content.Context
import com.android.launcher3.anim.AnimatedFloat
import com.android.launcher3.statemanager.BaseState
import com.android.launcher3.statemanager.StatefulContainer
import com.android.launcher3.util.MultiPropertyFactory
/**
* Base interface for controlling depth effects from Launcher3.
*/
interface BaseDepthController {
/**
* Property for state transitions depth.
*/
val stateDepth: MultiPropertyFactory<*>.MultiProperty?
/**
* Property for the widget picker depth.
*/
val widgetDepth: MultiPropertyFactory<*>.MultiProperty?
/**
* Property for folder expansion wallpaper zoom.
*/
val folderZoom: MultiPropertyFactory<*>.MultiProperty?
}
@@ -83,6 +83,7 @@ import com.android.launcher3.model.StringCache;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.statehandlers.BaseDepthController;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.util.ApplicationInfoWrapper;
import com.android.launcher3.util.LauncherBindableItemsContainer;
@@ -215,6 +216,10 @@ public interface ActivityContext extends SavedStateRegistryOwner {
return null;
}
default BaseDepthController getDepthController() {
return null;
}
/** @return {@code true} if all apps background blur is enabled */
default boolean isAllAppsBackgroundBlurEnabled() {
return false;