From 85961fa44bc253aee80e9a114b5bcfdc447e7356 Mon Sep 17 00:00:00 2001 From: zakcohen Date: Fri, 7 May 2021 14:10:44 -0700 Subject: [PATCH] Make foreground scrim darker on Recents View. Make the foreground scrim darker, not just scrimming to the target color. Waiting for real token for the scrim color. Moves the COLOR_TINT property from TaskView to RecentsView to make coordinating the animation simpler. Bug: 187320416 Test: Local Change-Id: I300f98f78e33476ee604d4dd61b485326356eb5b --- .../android/quickstep/views/RecentsView.java | 62 ++++++++++++++++++- .../quickstep/views/TaskThumbnailView.java | 3 +- .../com/android/quickstep/views/TaskView.java | 45 ++------------ 3 files changed, 68 insertions(+), 42 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 59588325fd..7bd0195391 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -63,7 +63,9 @@ import android.annotation.TargetApi; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; import android.content.res.Configuration; +import android.graphics.BlendMode; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.PointF; @@ -98,6 +100,7 @@ import android.widget.OverScroller; import androidx.annotation.Nullable; import androidx.annotation.UiThread; +import androidx.core.graphics.ColorUtils; import com.android.launcher3.BaseActivity; import com.android.launcher3.BaseActivity.MultiWindowModeChangedListener; @@ -243,6 +246,24 @@ public abstract class RecentsView COLOR_TINT = + new FloatProperty("colorTint") { + @Override + public void setValue(RecentsView recentsView, float v) { + recentsView.setColorTint(v); + } + + @Override + public Float get(RecentsView recentsView) { + return recentsView.getColorTint(); + } + }; + /** * Even though {@link TaskView} has distinct offsetTranslationX/Y and resistance property, they * are currently both used to apply secondary translation. Should their use cases change to be @@ -404,6 +425,10 @@ public abstract class RecentsView COLOR_TINT = - new FloatProperty("colorTint") { - @Override - public void setValue(TaskView taskView, float v) { - taskView.setColorTint(v); - } - - @Override - public Float get(TaskView taskView) { - return taskView.getColorTint(); - } - }; - private final TaskOutlineProvider mOutlineProvider; private Task mTask; @@ -393,11 +379,6 @@ public class TaskView extends FrameLayout implements Reusable { private final float[] mIconCenterCoords = new float[2]; private final float[] mChipCenterCoords = new float[2]; - // Colored tint for the task view and all its supplementary views (like the task icon and well - // being banner. - private final int mTintingColor; - private float mTintAmount; - private boolean mIsClickableAsLiveTile = true; public TaskView(Context context) { @@ -419,8 +400,6 @@ public class TaskView extends FrameLayout implements Reusable { mOutlineProvider = new TaskOutlineProvider(getContext(), mCurrentFullscreenParams, mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx); setOutlineProvider(mOutlineProvider); - - mTintingColor = Themes.getColorBackgroundFloating(context); } /** @@ -864,7 +843,7 @@ public class TaskView extends FrameLayout implements Reusable { setTranslationZ(0); setAlpha(mStableAlpha); setIconScaleAndDim(1); - setColorTint(0); + setColorTint(0, 0); } public void setStableAlpha(float parentAlpha) { @@ -1472,25 +1451,13 @@ public class TaskView extends FrameLayout implements Reusable { getRecentsView().initiateSplitSelect(this, splitPositionOption); } - private void setColorTint(float amount) { - mTintAmount = amount; - mSnapshotView.setDimAlpha(mTintAmount); - mIconView.setIconColorTint(mTintingColor, mTintAmount); - mDigitalWellBeingToast.setBannerColorTint(mTintingColor, mTintAmount); - } - - private float getColorTint() { - return mTintAmount; - } - /** - * Show the task view with a color tint (animates value). + * Set a color tint on the snapshot and supporting views. */ - public void showColorTint(boolean enable) { - ObjectAnimator tintAnimator = ObjectAnimator.ofFloat( - this, COLOR_TINT, enable ? MAX_PAGE_SCRIM_ALPHA : 0); - tintAnimator.setAutoCancel(true); - tintAnimator.start(); + public void setColorTint(float amount, int tintColor) { + mSnapshotView.setDimAlpha(amount); + mIconView.setIconColorTint(tintColor, amount); + mDigitalWellBeingToast.setBannerColorTint(tintColor, amount); } /**