diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml
index 0ffd93b8e4..3f20fffc03 100644
--- a/quickstep/res/values/styles.xml
+++ b/quickstep/res/values/styles.xml
@@ -389,12 +389,17 @@
- ?attr/overviewScrimColorBlur
- @style/OverviewActionsContainerBlur
- @style/OverviewActionButton.Blur
+ - ?attr/overviewScrimForegroundPrimaryBlur
+ - ?attr/overviewScrimForegroundSecondaryBlur
+
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index 95a43f7d8e..553408afad 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -20,6 +20,7 @@ import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
import android.content.Context;
+import android.graphics.Color;
import com.android.internal.jank.Cuj;
import com.android.launcher3.DeviceProfile;
@@ -29,6 +30,7 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.ScrimColors;
import com.android.quickstep.util.BaseDepthController;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
@@ -203,14 +205,17 @@ public class AllAppsState extends LauncherState {
}
@Override
- public int getWorkspaceScrimColor(Launcher launcher) {
+ public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
+ int backgroundColor;
if (!launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) {
// Always use an opaque scrim if there's no sheet.
- return launcher.getResources().getColor(R.color.materialColorSurfaceDim);
+ backgroundColor = launcher.getResources().getColor(R.color.materialColorSurfaceDim);
} else if (!Flags.allAppsBlur()) {
// If there's a sheet but no blur, use the old scrim color.
- return launcher.getResources().getColor(R.color.widgets_picker_scrim);
+ backgroundColor = launcher.getResources().getColor(R.color.widgets_picker_scrim);
+ } else {
+ backgroundColor = Themes.getAttrColor(launcher, R.attr.allAppsScrimColor);
}
- return Themes.getAttrColor(launcher, R.attr.allAppsScrimColor);
+ return new ScrimColors(backgroundColor, /* foregroundColor */ Color.TRANSPARENT);
}
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index 9550933c40..a2c69167de 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -24,6 +24,7 @@ import android.graphics.Color;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
+import com.android.launcher3.views.ScrimColors;
import com.android.quickstep.util.BaseDepthController;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
@@ -108,8 +109,10 @@ public class BackgroundAppState extends OverviewState {
}
@Override
- public int getWorkspaceScrimColor(Launcher launcher) {
- return Color.TRANSPARENT;
+ public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
+ return new ScrimColors(
+ /* backgroundColor= */ Color.TRANSPARENT,
+ /* foregroundColor= */ Color.TRANSPARENT);
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/HintState.java b/quickstep/src/com/android/launcher3/uioverrides/states/HintState.java
index 2bb91c7806..20cddc1aa0 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/HintState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/HintState.java
@@ -26,6 +26,7 @@ import androidx.core.graphics.ColorUtils;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.ScrimColors;
/**
* Scale down workspace/hotseat to hint at going to either overview (on pause) or first home screen.
@@ -60,10 +61,14 @@ public class HintState extends LauncherState {
}
@Override
- public int getWorkspaceScrimColor(Launcher launcher) {
- int overviewStateColor = OVERVIEW.getWorkspaceScrimColor(launcher);
- return ColorUtils.setAlphaComponent(overviewStateColor,
- Math.round(Color.valueOf(overviewStateColor).alpha() * 100));
+ public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
+ ScrimColors overviewStateColor = OVERVIEW.getWorkspaceScrimColor(launcher);
+ return new ScrimColors(
+ /* backgroundColor */
+ ColorUtils.setAlphaComponent(overviewStateColor.getBackgroundColor(),
+ Math.round(Color.valueOf(overviewStateColor.getBackgroundColor()).alpha()
+ * 100)),
+ /* foregroundColor */ Color.TRANSPARENT);
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
index a8be0545ec..2c92e9b6f3 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -24,6 +24,8 @@ import android.content.Context;
import android.graphics.Rect;
import android.os.SystemProperties;
+import androidx.core.graphics.ColorUtils;
+
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
@@ -31,6 +33,7 @@ import com.android.launcher3.R;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.ScrimColors;
import com.android.quickstep.util.BaseDepthController;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
@@ -157,8 +160,12 @@ public class OverviewState extends LauncherState {
}
@Override
- public int getWorkspaceScrimColor(Launcher launcher) {
- return Themes.getAttrColor(launcher, R.attr.overviewScrimColor);
+ public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
+ return new ScrimColors(
+ /* backgroundColor */ Themes.getAttrColor(launcher, R.attr.overviewScrimColor),
+ /* foregroundColor */ ColorUtils.compositeColors(
+ Themes.getAttrColor(launcher, R.attr.overviewScrimForegroundPrimary),
+ Themes.getAttrColor(launcher, R.attr.overviewScrimForegroundSecondary)));
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
index 7140d0f010..8d907f4183 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
@@ -17,7 +17,7 @@
package com.android.launcher3.uioverrides.touchcontrollers;
import static com.android.app.animation.Interpolators.ACCELERATE_DECELERATE;
-import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
+import static com.android.launcher3.LauncherAnimUtils.SCRIM_COLORS;
import static com.android.launcher3.LauncherAnimUtils.newSingleUseCancelListener;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.HINT_STATE;
@@ -47,6 +47,7 @@ import com.android.launcher3.taskbar.LauncherTaskbarUIController;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.VibratorWrapper;
+import com.android.launcher3.views.ScrimColorsEvaluator;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.MotionPauseDetector;
@@ -86,7 +87,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
private AnimatorPlaybackController mOverviewResistYAnim;
// Normal to Hint animation has flag SKIP_OVERVIEW, so we update this scrim with this animator.
- private ObjectAnimator mNormalToHintOverviewScrimAnimator;
+ private ValueAnimator mNormalToHintOverviewScrimAnimator;
private final QuickstepLauncher mLauncher;
private boolean mIsTrackpadSwipe;
@@ -163,9 +164,10 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
}
if (mFromState == NORMAL && mToState == HINT_STATE) {
- mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofArgb(
+ mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofObject(
mLauncher.getScrimView(),
- VIEW_BACKGROUND_COLOR,
+ SCRIM_COLORS,
+ ScrimColorsEvaluator.INSTANCE,
mFromState.getWorkspaceScrimColor(mLauncher),
mToState.getWorkspaceScrimColor(mLauncher));
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
index 60bd54431f..416c8ab4fd 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
@@ -278,8 +278,9 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
xAnim.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1], LINEAR);
// Use QuickSwitchState instead of OverviewState to determine scrim color,
// since we need to take potential taskbar into account.
- xAnim.setViewBackgroundColor(mLauncher.getScrimView(),
- QUICK_SWITCH_FROM_HOME.getWorkspaceScrimColor(mLauncher), LINEAR);
+ xAnim.setScrimColors(mLauncher.getScrimView(),
+ QUICK_SWITCH_FROM_HOME.getWorkspaceScrimColor(mLauncher),
+ LINEAR);
if (!mRecentsView.hasTaskViews()) {
xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR);
}
diff --git a/quickstep/src/com/android/quickstep/BaseContainerInterface.java b/quickstep/src/com/android/quickstep/BaseContainerInterface.java
index 95c1aaf3a1..b3bf03da43 100644
--- a/quickstep/src/com/android/quickstep/BaseContainerInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseContainerInterface.java
@@ -17,7 +17,7 @@ package com.android.quickstep;
import static com.android.app.animation.Interpolators.INSTANT;
import static com.android.app.animation.Interpolators.LINEAR;
-import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
+import static com.android.launcher3.LauncherAnimUtils.SCRIM_COLORS;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.util.OverviewReleaseFlags.enableGridOnlyOverview;
import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK;
@@ -47,7 +47,9 @@ import com.android.launcher3.statemanager.StatefulContainer;
import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.WindowBounds;
+import com.android.launcher3.views.ScrimColors;
import com.android.launcher3.views.ScrimView;
+import com.android.launcher3.views.ScrimColorsEvaluator;
import com.android.quickstep.orientation.RecentsPagedOrientationHandler;
import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.ContextInitListener;
@@ -108,7 +110,7 @@ public abstract class BaseContainerInterface {
/**
* For this state, what color scrim should be drawn behind overview.
*/
- public int getScrimColor(Context context) {
- return hasFlag(FLAG_SCRIM)
+ public ScrimColors getScrimColor(Context context) {
+ return new ScrimColors(
+ /* backgroundColor */ hasFlag(FLAG_SCRIM)
? Themes.getAttrColor(context, R.attr.overviewScrimColor)
- : Color.TRANSPARENT;
+ : Color.TRANSPARENT,
+ /* foregroundColor */ Color.TRANSPARENT);
}
public float[] getOverviewScaleAndOffset(RecentsViewContainer container) {
diff --git a/res/color/overview_scrim_foreground_primary.xml b/res/color/overview_scrim_foreground_primary.xml
new file mode 100644
index 0000000000..68be32d4fa
--- /dev/null
+++ b/res/color/overview_scrim_foreground_primary.xml
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/res/color/overview_scrim_foreground_primary_dark.xml b/res/color/overview_scrim_foreground_primary_dark.xml
new file mode 100644
index 0000000000..2b46edc191
--- /dev/null
+++ b/res/color/overview_scrim_foreground_primary_dark.xml
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/res/color/overview_scrim_foreground_secondary.xml b/res/color/overview_scrim_foreground_secondary.xml
new file mode 100644
index 0000000000..f2555ccc0e
--- /dev/null
+++ b/res/color/overview_scrim_foreground_secondary.xml
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/res/color/overview_scrim_foreground_secondary_dark.xml b/res/color/overview_scrim_foreground_secondary_dark.xml
new file mode 100644
index 0000000000..79e8d8b4ec
--- /dev/null
+++ b/res/color/overview_scrim_foreground_secondary_dark.xml
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 631dfa9cfd..a3f38323d0 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -48,6 +48,10 @@
+
+
+
+
diff --git a/res/values/styles.xml b/res/values/styles.xml
index a5b3c17884..801c3d39d9 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -84,6 +84,8 @@
- @color/drop_target_hover_text_color_light
- @color/drop_target_hover_button_color_light
- @color/overview_scrim
+ - @color/overview_scrim_foreground_primary
+ - @color/overview_scrim_foreground_secondary
- #80FFFFFF
- @color/preload_icon_accent_color_light
- @color/preload_icon_background_color_light
@@ -149,6 +151,8 @@
- #B3FFFFFF
- #DD000000
- @color/overview_scrim_dark
+ - @color/overview_scrim_foreground_primary_dark
+ - @color/overview_scrim_foreground_secondary_dark
- #80000000
- @color/preload_icon_accent_color_dark
- @color/preload_icon_background_color_dark
diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java
index 6a9d170b2c..9157dab143 100644
--- a/src/com/android/launcher3/LauncherAnimUtils.java
+++ b/src/com/android/launcher3/LauncherAnimUtils.java
@@ -24,12 +24,15 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.FloatProperty;
import android.util.IntProperty;
+import android.util.Property;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.launcher3.util.MultiScalePropertyFactory;
+import com.android.launcher3.views.ScrimColors;
+import com.android.launcher3.views.ScrimView;
public class LauncherAnimUtils {
/**
@@ -201,6 +204,19 @@ public class LauncherAnimUtils {
}
};
+ public static final Property SCRIM_COLORS =
+ new Property(ScrimColors.class, "scrimColors") {
+ @Override
+ public void set(ScrimView scrimView, ScrimColors scrimColors) {
+ scrimView.setScrimColors(scrimColors);
+ }
+
+ @Override
+ public ScrimColors get(ScrimView scrimView) {
+ return scrimView.getScrimColors();
+ }
+ };
+
public static final FloatProperty ROTATION_DRAWABLE_PERCENT =
new FloatProperty("drawableRotationPercent") {
// RotateDrawable linearly interpolates the rotation degrees between fromDegrees
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 72b203a759..da26b88d9a 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -49,6 +49,7 @@ import com.android.launcher3.uioverrides.states.AllAppsState;
import com.android.launcher3.uioverrides.states.HintState;
import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.ScrimColors;
import java.util.Arrays;
@@ -317,8 +318,9 @@ public abstract class LauncherState implements BaseState {
* What color should the workspace scrim be in when at rest in this state.
* Return {@link Color#TRANSPARENT} for no scrim.
*/
- public int getWorkspaceScrimColor(Launcher launcher) {
- return Color.TRANSPARENT;
+ public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
+ return new ScrimColors(/* backgroundColor */ Color.TRANSPARENT,
+ /* foregroundColor */ Color.TRANSPARENT);
}
/**
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 2315111b3b..4043283c1e 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -207,7 +207,7 @@ public class WorkspaceStateTransitionAnimation {
propertySetter.setFloat(sysUiScrim.getSysUIProgress(), AnimatedFloat.VALUE,
state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
- propertySetter.setViewBackgroundColor(mLauncher.getScrimView(),
+ propertySetter.setScrimColors(mLauncher.getScrimView(),
state.getWorkspaceScrimColor(mLauncher),
config.getInterpolator(ANIM_SCRIM_FADE, ACCELERATE_2));
}
diff --git a/src/com/android/launcher3/anim/AnimatedPropertySetter.java b/src/com/android/launcher3/anim/AnimatedPropertySetter.java
index 0f1b8ad9c6..9bf479a6dd 100644
--- a/src/com/android/launcher3/anim/AnimatedPropertySetter.java
+++ b/src/com/android/launcher3/anim/AnimatedPropertySetter.java
@@ -16,7 +16,7 @@
package com.android.launcher3.anim;
-import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
+import static com.android.launcher3.LauncherAnimUtils.SCRIM_COLORS;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
@@ -25,13 +25,16 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
-import android.graphics.drawable.ColorDrawable;
import android.util.FloatProperty;
import android.util.IntProperty;
import android.view.View;
import androidx.annotation.NonNull;
+import com.android.launcher3.views.ScrimColors;
+import com.android.launcher3.views.ScrimView;
+import com.android.launcher3.views.ScrimColorsEvaluator;
+
import java.util.function.Consumer;
/**
@@ -63,15 +66,16 @@ public class AnimatedPropertySetter extends PropertySetter {
}
@Override
- public Animator setViewBackgroundColor(View view, int color, TimeInterpolator interpolator) {
- if (view == null || (view.getBackground() instanceof ColorDrawable
- && ((ColorDrawable) view.getBackground()).getColor() == color)) {
+ public Animator setScrimColors(ScrimView view, ScrimColors scrimColors,
+ TimeInterpolator interpolator) {
+ if (view == null || view.getScrimColors().equals(scrimColors)) {
return NO_OP;
}
- ObjectAnimator anim = ObjectAnimator.ofArgb(view, VIEW_BACKGROUND_COLOR, color);
- anim.setInterpolator(interpolator);
- add(anim);
- return anim;
+ ObjectAnimator animator = ObjectAnimator.ofObject(view, SCRIM_COLORS,
+ ScrimColorsEvaluator.INSTANCE, scrimColors);
+ animator.setInterpolator(interpolator);
+ add(animator);
+ return animator;
}
@Override
diff --git a/src/com/android/launcher3/anim/PropertySetter.java b/src/com/android/launcher3/anim/PropertySetter.java
index 6ba58b6a98..4ad828169d 100644
--- a/src/com/android/launcher3/anim/PropertySetter.java
+++ b/src/com/android/launcher3/anim/PropertySetter.java
@@ -19,12 +19,16 @@ package com.android.launcher3.anim;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.TimeInterpolator;
+import android.graphics.drawable.ColorDrawable;
import android.util.FloatProperty;
import android.util.IntProperty;
import android.view.View;
import androidx.annotation.NonNull;
+import com.android.launcher3.views.ScrimColors;
+import com.android.launcher3.views.ScrimView;
+
import java.util.function.Consumer;
/**
@@ -59,12 +63,14 @@ public abstract class PropertySetter {
}
/**
- * Sets the background color of the provided view using the provided interpolator.
+ * Sets the background and foreground color of the provided view using the provided
+ * interpolator.
*/
@NonNull
- public Animator setViewBackgroundColor(View view, int color, TimeInterpolator interpolator) {
+ public Animator setScrimColors(ScrimView view, ScrimColors scrimColors,
+ TimeInterpolator interpolator) {
if (view != null) {
- view.setBackgroundColor(color);
+ view.setScrimColors(scrimColors);
}
return NO_OP;
}
diff --git a/src/com/android/launcher3/views/ScrimColors.kt b/src/com/android/launcher3/views/ScrimColors.kt
new file mode 100644
index 0000000000..afbc17209f
--- /dev/null
+++ b/src/com/android/launcher3/views/ScrimColors.kt
@@ -0,0 +1,19 @@
+/*
+ * 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.views
+
+data class ScrimColors(val backgroundColor: Int, val foregroundColor: Int)
diff --git a/src/com/android/launcher3/views/ScrimColorsEvaluator.kt b/src/com/android/launcher3/views/ScrimColorsEvaluator.kt
new file mode 100644
index 0000000000..81e326a6fa
--- /dev/null
+++ b/src/com/android/launcher3/views/ScrimColorsEvaluator.kt
@@ -0,0 +1,46 @@
+/*
+ * 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.views
+
+import android.animation.ArgbEvaluator
+import android.animation.TypeEvaluator
+
+/** TypeEvaluator that interpolates between [ScrimColors]. */
+object ScrimColorsEvaluator : TypeEvaluator {
+
+ private val argbEvaluator = ArgbEvaluator()
+
+ override fun evaluate(
+ fraction: Float,
+ startValue: ScrimColors,
+ endValue: ScrimColors,
+ ): ScrimColors =
+ ScrimColors(
+ backgroundColor =
+ argbEvaluator.evaluate(
+ fraction,
+ startValue.backgroundColor,
+ endValue.backgroundColor,
+ ) as Int,
+ foregroundColor =
+ argbEvaluator.evaluate(
+ fraction,
+ startValue.foregroundColor,
+ endValue.foregroundColor,
+ ) as Int,
+ )
+}
diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java
index ec71f3118a..ea87e18703 100644
--- a/src/com/android/launcher3/views/ScrimView.java
+++ b/src/com/android/launcher3/views/ScrimView.java
@@ -183,6 +183,35 @@ public class ScrimView extends View implements Insettable {
mOpaquenessListeners.remove(listener);
}
+ /**
+ * Set foreground and background color to this ScrimView
+ */
+ public void setScrimColors(ScrimColors scrimColors) {
+ this.setBackgroundColor(scrimColors.getBackgroundColor());
+ setForeground(new ColorDrawable(scrimColors.getForegroundColor()));
+ }
+
+ /**
+ * returns foreground and background color of this ScrimView
+ */
+ public ScrimColors getScrimColors() {
+ int backgroundColor;
+ if (getBackground() instanceof ColorDrawable colorDrawable) {
+ backgroundColor = colorDrawable.getColor();
+ } else {
+ backgroundColor = Color.TRANSPARENT;
+ }
+
+ int foregroundColor;
+ if (getForeground() instanceof ColorDrawable colorDrawable) {
+ foregroundColor = colorDrawable.getColor();
+ } else {
+ foregroundColor = Color.TRANSPARENT;
+ }
+
+ return new ScrimColors(backgroundColor, foregroundColor);
+ }
+
/**
* A Utility interface allowing for other surfaces to draw on ScrimView
*/
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java
index 4882f83f6e..9d0816d5ba 100644
--- a/src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -18,11 +18,13 @@ package com.android.launcher3.uioverrides.states;
import static com.android.app.animation.Interpolators.DECELERATE;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
+import android.graphics.Color;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.ScrimColors;
/**
* Definition for AllApps state
@@ -96,9 +98,11 @@ public class AllAppsState extends LauncherState {
}
@Override
- public int getWorkspaceScrimColor(Launcher launcher) {
- return launcher.getDeviceProfile().getDeviceProperties().isTablet()
+ public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
+ return new ScrimColors(
+ /* backgroundColor */ launcher.getDeviceProfile().getDeviceProperties().isTablet()
? launcher.getResources().getColor(R.color.widgets_picker_scrim)
- : Themes.getAttrColor(launcher, R.attr.allAppsScrimColor);
+ : Themes.getAttrColor(launcher, R.attr.allAppsScrimColor),
+ /* foregroundColor */ Color.TRANSPARENT);
}
}
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java b/src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java
index 532a338237..9627932619 100644
--- a/src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -17,11 +17,13 @@ package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
+import android.graphics.Color;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.ScrimColors;
/**
* Definition for overview state
@@ -60,7 +62,9 @@ public class OverviewState extends LauncherState {
}
@Override
- public int getWorkspaceScrimColor(Launcher launcher) {
- return Themes.getAttrColor(launcher, R.attr.overviewScrimColor);
+ public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
+ return new ScrimColors(
+ /* backgroundColor */ Themes.getAttrColor(launcher, R.attr.overviewScrimColor),
+ /* foregroundColor */ Color.TRANSPARENT);
}
}