diff --git a/quickstep/res/layout/scrim_view.xml b/quickstep/res/layout/scrim_view.xml deleted file mode 100644 index 3f2daf1d17..0000000000 --- a/quickstep/res/layout/scrim_view.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - \ No newline at end of file diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index a3a1fef052..01616d45ec 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -18,12 +18,9 @@ package com.android.launcher3.uioverrides; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.graphics.OverviewScrim.SCRIM_MULTIPLIER; -import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; @@ -40,7 +37,6 @@ import androidx.annotation.NonNull; import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.LauncherState; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.statemanager.StateManager.StateHandler; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.PagedOrientationHandler; @@ -70,9 +66,6 @@ public abstract class BaseRecentsViewStateController TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); - OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim(); - SCRIM_PROGRESS.set(scrim, state.getOverviewScrimAlpha(mLauncher)); - SCRIM_MULTIPLIER.set(scrim, 1f); getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness()); RECENTS_GRID_PROGRESS.set(mRecentsView, state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f); @@ -111,16 +104,6 @@ public abstract class BaseRecentsViewStateController setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); - OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim(); - setter.setFloat(scrim, SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher), - config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR)); - setter.setFloat(scrim, SCRIM_MULTIPLIER, 1f, - config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR)); - if (toState.areElementsVisible(mLauncher, LauncherState.SPLIT_PLACHOLDER_VIEW)) { - scrim.updateStableScrimmedView(mLauncher.getSplitPlaceholderView()); - } else { - scrim.updateStableScrimmedView(mLauncher.getOverviewPanel()); - } setter.setFloat( mRecentsView, getTaskModalnessProperty(), diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index b2f8a404c0..4e03971517 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -90,4 +90,9 @@ public class AllAppsState extends LauncherState { public LauncherState getHistoryForState(LauncherState previousState) { return previousState == OVERVIEW ? OVERVIEW : NORMAL; } + + @Override + public float getWorkspaceScrimAlpha(Launcher launcher) { + return 1; + } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 95a855a7c8..6cdeb0f74b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -103,7 +103,7 @@ public class OverviewState extends LauncherState { } @Override - public float getOverviewScrimAlpha(Launcher launcher) { + public float getWorkspaceScrimAlpha(Launcher launcher) { return 1f; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index a990f3ed93..b8caf81f14 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -44,7 +44,6 @@ import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.launcher3.util.TouchController; @@ -141,10 +140,6 @@ public class NavBarToHomeTouchController implements TouchController, AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, builder); - builder.setFloat(mLauncher.getDragLayer().getOverviewScrim(), - OverviewScrim.SCRIM_MULTIPLIER, OVERVIEW_TO_HOME_SCRIM_MULTIPLIER, - PULLBACK_INTERPOLATOR); - if (LIVE_TILE.get()) { builder.addOnFrameCallback(recentsView::redrawLiveTile); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index 464b90a2cb..74a253eb3a 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -16,6 +16,7 @@ package com.android.launcher3.uioverrides.touchcontrollers; +import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.HINT_STATE; @@ -45,7 +46,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; -import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.util.VibratorWrapper; import com.android.quickstep.SystemUiProxy; @@ -128,10 +128,10 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch if (mFromState == NORMAL && mToState == HINT_STATE) { mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat( - mLauncher.getDragLayer().getOverviewScrim(), - OverviewScrim.SCRIM_PROGRESS, - mFromState.getOverviewScrimAlpha(mLauncher), - mToState.getOverviewScrimAlpha(mLauncher)); + mLauncher.getScrimView(), + VIEW_ALPHA, + mFromState.getWorkspaceScrimAlpha(mLauncher), + mToState.getWorkspaceScrimAlpha(mLauncher)); } mStartedOverview = false; mReachedOverview = false; diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 61cd13b36c..697516d113 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; +import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; @@ -59,7 +60,6 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.BaseSwipeDetector; import com.android.launcher3.touch.BothAxesSwipeDetector; @@ -231,8 +231,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // - OverviewScrim PendingAnimation xAnim = new PendingAnimation((long) (mXRange * 2)); xAnim.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], LINEAR); - xAnim.setFloat(mLauncher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS, - toState.getOverviewScrimAlpha(mLauncher), LINEAR); + xAnim.setFloat(mLauncher.getScrimView(), VIEW_ALPHA, + toState.getWorkspaceScrimAlpha(mLauncher), LINEAR); mXOverviewAnim = xAnim.createPlaybackController(); mXOverviewAnim.dispatchOnStart(); diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 79db842c0d..558230b258 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -183,7 +183,6 @@ public final class TaskViewUtils { boolean parallaxCenterAndAdjacentTask = taskIndex != recentsView.getCurrentPage() && !(dp.isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()); - float gridProgress = recentsView.getGridProgress(); float gridTranslationSecondary = recentsView.getGridTranslationSecondary(taskIndex); int startScroll = recentsView.getScrollOffset(taskIndex); @@ -216,7 +215,8 @@ public final class TaskViewUtils { AnimatedFloat.VALUE, tsv.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR); out.setFloat(tsv.taskSecondaryTranslation, AnimatedFloat.VALUE, 0, TOUCH_RESPONSE_INTERPOLATOR_ACCEL_DEACCEL); - out.setInt(tsv, TaskViewSimulator.SCROLL, 0, TOUCH_RESPONSE_INTERPOLATOR); + out.setFloat(tsv.recentsViewScroll, AnimatedFloat.VALUE, 0, + TOUCH_RESPONSE_INTERPOLATOR); TaskViewSimulator finalTsv = tsv; TransformParams finalParams = params; @@ -374,7 +374,8 @@ public final class TaskViewUtils { AnimatedFloat.VALUE, 1, TOUCH_RESPONSE_INTERPOLATOR); out.setFloat(tvs.recentsViewScale, AnimatedFloat.VALUE, tvs.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR); - out.setInt(tvs, TaskViewSimulator.SCROLL, 0, TOUCH_RESPONSE_INTERPOLATOR); + out.setFloat(tvs.recentsViewScroll, + AnimatedFloat.VALUE, 0, TOUCH_RESPONSE_INTERPOLATOR); TaskViewSimulator finalTsv = tvs; TransformParams finalParams = params; diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 6757e4c4b8..c12bd9b301 100644 --- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -18,7 +18,6 @@ package com.android.quickstep.util; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER; @@ -42,9 +41,7 @@ import com.android.launcher3.R; import com.android.launcher3.ShortcutAndWidgetContainer; import com.android.launcher3.Workspace; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.anim.SpringAnimationBuilder; -import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.util.DynamicResource; @@ -134,7 +131,8 @@ public class StaggeredWorkspaceAnim { if (animateOverviewScrim) { PendingAnimation pendingAnimation = new PendingAnimation(DURATION_MS); - addScrimAnimationForState(launcher, NORMAL, pendingAnimation); + launcher.getWorkspace().getStateTransitionAnimation() + .setScrim(pendingAnimation, NORMAL, new StateAnimationConfig()); mAnimators.play(pendingAnimation.buildAnim()); } @@ -192,7 +190,8 @@ public class StaggeredWorkspaceAnim { launcher.getOverviewPanel().getScroller().forceFinished(true); if (animateOverviewScrim) { - addScrimAnimationForState(launcher, BACKGROUND_APP, NO_ANIM_PROPERTY_SETTER); + launcher.getWorkspace().getStateTransitionAnimation() + .setScrim(NO_ANIM_PROPERTY_SETTER, BACKGROUND_APP, config); } } @@ -263,16 +262,6 @@ public class StaggeredWorkspaceAnim { mAnimators.play(alpha); } - private void addScrimAnimationForState(Launcher launcher, LauncherState state, - PropertySetter setter) { - launcher.getWorkspace().getStateTransitionAnimation().setScrim(setter, state); - setter.setFloat( - launcher.getDragLayer().getOverviewScrim(), - OverviewScrim.SCRIM_PROGRESS, - state.getOverviewScrimAlpha(launcher), - ACCEL_DEACCEL); - } - private void addDepthAnimationForState(Launcher launcher, LauncherState state, long duration) { if (!(launcher instanceof BaseQuickstepLauncher)) { return; diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index 3c8a12c876..e63f8bbea8 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -30,17 +30,14 @@ import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; -import android.util.IntProperty; import androidx.annotation.NonNull; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Utilities; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.touch.PagedOrientationHandler; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.BaseActivityInterface; -import com.android.quickstep.views.RecentsView.ScrollState; import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper; import com.android.quickstep.views.TaskView.FullscreenDrawParams; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -52,19 +49,6 @@ import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat. */ public class TaskViewSimulator implements TransformParams.BuilderProxy { - public static final IntProperty SCROLL = - new IntProperty("scroll") { - @Override - public void setValue(TaskViewSimulator simulator, int scroll) { - simulator.setScroll(scroll); - } - - @Override - public Integer get(TaskViewSimulator simulator) { - return simulator.mScrollState.scroll; - } - }; - private final Rect mTmpCropRect = new Rect(); private final RectF mTempRectF = new RectF(); private final float[] mTempPoint = new float[2]; @@ -101,11 +85,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { public final AnimatedFloat fullScreenProgress = new AnimatedFloat(); public final AnimatedFloat recentsViewSecondaryTranslation = new AnimatedFloat(); public final AnimatedFloat recentsViewPrimaryTranslation = new AnimatedFloat(); - private final ScrollState mScrollState = new ScrollState(); + public final AnimatedFloat recentsViewScroll = new AnimatedFloat(); // Cached calculations private boolean mLayoutValid = false; - private boolean mScrollValid = false; private int mOrientationStateId; public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) { @@ -172,11 +155,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { /** * Updates the scroll for RecentsView */ - public void setScroll(int scroll) { - if (mScrollState.scroll != scroll) { - mScrollState.scroll = scroll; - mScrollValid = false; - } + public void setScroll(float scroll) { + recentsViewScroll.value = scroll; } public void setDrawsBelowRecents(boolean drawsBelowRecents) { @@ -268,20 +248,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mTaskRect.width(), mTaskRect.height(), mDp, mOrientationState.getRecentsActivityRotation(), isRtlEnabled); mPositionHelper.getMatrix().invert(mInversePositionMatrix); - - PagedOrientationHandler poh = mOrientationState.getOrientationHandler(); - mScrollState.halfPageSize = - poh.getPrimaryValue(mTaskRect.width(), mTaskRect.height()) / 2; - mScrollState.halfScreenSize = poh.getPrimaryValue(mDp.widthPx, mDp.heightPx) / 2; - mScrollValid = false; - } - - if (!mScrollValid) { - mScrollValid = true; - int start = mOrientationState.getOrientationHandler() - .getPrimaryValue(mTaskRect.left, mTaskRect.top); - mScrollState.screenCenter = start + mScrollState.scroll + mScrollState.halfPageSize; - mScrollState.updateInterpolation(mDp, start); } float fullScreenProgress = Utilities.boundToRange(this.fullScreenProgress.value, 0, 1); @@ -306,7 +272,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE, taskSecondaryTranslation.value); mOrientationState.getOrientationHandler().set( - mMatrix, MATRIX_POST_TRANSLATE, mScrollState.scroll); + mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value); // Apply RecentsView matrix mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y); diff --git a/quickstep/src/com/android/quickstep/views/AllAppsScrimView.java b/quickstep/src/com/android/quickstep/views/AllAppsScrimView.java deleted file mode 100644 index 185080e51d..0000000000 --- a/quickstep/src/com/android/quickstep/views/AllAppsScrimView.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2021 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.quickstep.views; - -import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.anim.Interpolators.ACCEL; -import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.util.AttributeSet; -import android.view.animation.Interpolator; - -import androidx.core.graphics.ColorUtils; - -import com.android.launcher3.BaseQuickstepLauncher; -import com.android.launcher3.DeviceProfile; -import com.android.launcher3.Utilities; -import com.android.launcher3.anim.Interpolators; -import com.android.launcher3.util.Themes; -import com.android.launcher3.views.ScrimView; - -/** - * Scrim used for all-apps background. uses interpolator to coordinate fade in with - * all-apps contents - * - * Note: ranges are inverted because progress goes from 1 to 0 for NORMAL->AllAPPS - */ -public class AllAppsScrimView extends ScrimView { - - private static final float TINT_DECAY_MULTIPLIER = .5f; - - //min progress for scrim to become visible - private static final float SCRIM_VISIBLE_THRESHOLD = .9f; - //max progress where scrim alpha animates. - private static final float SCRIM_SOLID_THRESHOLD = .5f; - private final Interpolator mScrimInterpolator = Interpolators.clampToProgress(ACCEL, - SCRIM_SOLID_THRESHOLD, - SCRIM_VISIBLE_THRESHOLD); - - // In transposed layout, we simply draw a flat color. - private boolean mDrawingFlatColor; - - private final int mEndAlpha; - private final Paint mPaint; - - private int mCurrentScrimColor; - private final int mTintColor; - - public AllAppsScrimView(Context context, AttributeSet attrs) { - super(context, attrs); - mMaxScrimAlpha = Math.round(OVERVIEW.getOverviewScrimAlpha(mLauncher) * 255); - mTintColor = Themes.getColorAccent(mContext); - - - mEndAlpha = Color.alpha(mEndScrim); - mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - - // Just assume the easiest UI for now, until we have the proper layout information. - mDrawingFlatColor = true; - } - - @Override - public void reInitUi() { - DeviceProfile dp = mLauncher.getDeviceProfile(); - mDrawingFlatColor = dp.isVerticalBarLayout(); - updateColors(); - updateSysUiColors(); - invalidate(); - } - - @Override - public void updateColors() { - super.updateColors(); - if (mDrawingFlatColor) { - return; - } - - if (mProgress >= 1) { - mCurrentScrimColor = 0; - } else { - float interpolationProgress = mScrimInterpolator.getInterpolation(mProgress); - // Note that these ranges and interpolators are inverted because progress goes 1 to 0. - int alpha = Math.round(Utilities.mapRange(interpolationProgress, mEndAlpha, 0)); - int color = ColorUtils.blendARGB(mEndScrim, mTintColor, - mProgress * TINT_DECAY_MULTIPLIER); - mCurrentScrimColor = setColorAlphaBound(color, alpha); - } - } - - @Override - protected void onDraw(Canvas canvas) { - if (mDrawingFlatColor) { - if (mCurrentFlatColor != 0) { - canvas.drawColor(mCurrentFlatColor); - } - return; - } - - if (Color.alpha(mCurrentScrimColor) == 0) { - return; - } else if (mProgress <= 0) { - canvas.drawColor(mCurrentScrimColor); - return; - } - - mPaint.setColor(mCurrentScrimColor); - canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint); - } -} diff --git a/quickstep/src/com/android/quickstep/views/ClearAllButton.java b/quickstep/src/com/android/quickstep/views/ClearAllButton.java index d616f7c7a5..4300329671 100644 --- a/quickstep/src/com/android/quickstep/views/ClearAllButton.java +++ b/quickstep/src/com/android/quickstep/views/ClearAllButton.java @@ -23,10 +23,8 @@ import android.widget.Button; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.quickstep.views.RecentsView.PageCallbacks; -import com.android.quickstep.views.RecentsView.ScrollState; -public class ClearAllButton extends Button implements PageCallbacks { +public class ClearAllButton extends Button { public static final FloatProperty VISIBILITY_ALPHA = new FloatProperty("visibilityAlpha") { @@ -99,8 +97,7 @@ public class ClearAllButton extends Button implements PageCallbacks { } } - @Override - public void onPageScroll(ScrollState scrollState, boolean gridEnabled) { + public void onRecentsViewScroll(int scrollFromEdge, boolean gridEnabled) { RecentsView recentsView = getRecentsView(); if (recentsView == null) { return; @@ -113,7 +110,7 @@ public class ClearAllButton extends Button implements PageCallbacks { } int leftEdgeScroll = recentsView.getLeftMostChildScroll(); - float adjustedScrollFromEdge = scrollState.scrollFromEdge - leftEdgeScroll; + int adjustedScrollFromEdge = scrollFromEdge - leftEdgeScroll; float shift = Math.min(adjustedScrollFromEdge, orientationSize); mNormalTranslationPrimary = mIsRtl ? -shift : shift; if (!gridEnabled) { diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java index deb674c4a0..7c8041c992 100644 --- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java @@ -72,7 +72,6 @@ public final class DigitalWellBeingToast { private View mBanner; private ViewOutlineProvider mOldBannerOutlineProvider; private float mBannerOffsetPercentage; - private float mBannerAlpha = 1f; private float mVerticalOffset = 0f; public DigitalWellBeingToast(BaseDraggingActivity activity, TaskView taskView) { @@ -99,10 +98,6 @@ public final class DigitalWellBeingToast { mTaskView.setContentDescription( getContentDescriptionForTask(mTask, appUsageLimitTimeMs, appRemainingTimeMs)); - RecentsView rv = mTaskView.getRecentsView(); - if (rv != null) { - rv.onDigitalWellbeingToastShown(); - } } public String getText() { @@ -268,7 +263,6 @@ public final class DigitalWellBeingToast { layoutParams.bottomMargin = ((ViewGroup.MarginLayoutParams) mTaskView.getThumbnail().getLayoutParams()).bottomMargin; mBanner.setTranslationY(mBannerOffsetPercentage * mBanner.getHeight()); - mBanner.setAlpha(mBannerAlpha); mTaskView.addView(mBanner); } @@ -293,18 +287,11 @@ public final class DigitalWellBeingToast { } } - void updateBannerAlpha(float alpha) { - if (mBanner != null && mBannerAlpha != alpha) { - mBannerAlpha = alpha; - mBanner.setAlpha(alpha); - } - } - void setBannerColorTint(int color, float amount) { if (mBanner == null) { return; } - if (mBannerAlpha == 0 || amount == 0) { + if (amount == 0) { mBanner.setLayerType(View.LAYER_TYPE_NONE, null); } Paint layerPaint = new Paint(); diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index 896d1ae58d..f5a8ff8170 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -149,9 +149,10 @@ public class LauncherRecentsView extends RecentsView CONTENT_ALPHA = new FloatProperty("contentAlpha") { @Override @@ -332,7 +331,6 @@ public abstract class RecentsView