From 88dd86bda9642b5c3c90280d11cc0d209075bebb Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Thu, 15 Jun 2023 22:27:28 +0000 Subject: [PATCH] Revert "Switch ScrimView to use view alpha" This reverts commit 99c4becf246726dcfeea16bd65c134f4fc875293. Reason for revert: b/287488354 Change-Id: Ic4db08ca771f1d744ba2c19eb55b9f2d277ad529 --- .../NoButtonQuickSwitchTouchController.java | 3 +- .../FallbackRecentsStateController.java | 2 +- .../android/launcher3/LauncherAnimUtils.java | 5 ---- .../WorkspaceStateTransitionAnimation.java | 2 +- .../anim/AnimatedPropertySetter.java | 9 +++--- .../launcher3/anim/PropertySetter.java | 5 +--- .../android/launcher3/views/ScrimView.java | 30 ++++++++++++------- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 9f9cb00c07..d3ef58936e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -16,6 +16,7 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static android.view.MotionEvent.ACTION_DOWN; +import static android.view.MotionEvent.ACTION_MOVE; import static com.android.app.animation.Interpolators.ACCELERATE_0_75; import static com.android.app.animation.Interpolators.DECELERATE_3; @@ -261,7 +262,7 @@ 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.setScrimViewBackgroundColor(mLauncher.getScrimView(), + xAnim.setViewBackgroundColor(mLauncher.getScrimView(), QUICK_SWITCH_FROM_HOME.getWorkspaceScrimColor(mLauncher), LINEAR); if (mRecentsView.getTaskViewCount() == 0) { xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR); diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index ca8381b4bf..8a9e04e488 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -114,7 +114,7 @@ public class FallbackRecentsStateController implements StateHandler threshold; + && getAlpha() > threshold + && (Color.alpha(mBackgroundColor) / 255f) > threshold; if (forceChange) { getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !isScrimDark()); } else { @@ -144,7 +148,13 @@ public class ScrimView extends View implements Insettable { } private boolean isScrimDark() { - return ColorUtils.calculateLuminance(mBackgroundColor) < 0.5f; + if (!(getBackground() instanceof ColorDrawable)) { + throw new IllegalStateException( + "ScrimView must have a ColorDrawable background, this one has: " + + getBackground()); + } + return ColorUtils.calculateLuminance( + ((ColorDrawable) getBackground()).getColor()) < 0.5f; } /**