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
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 5958832..7bd0195 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.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 androidx.annotation.Nullable;
import androidx.annotation.UiThread;
+import androidx.core.graphics.ColorUtils;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.BaseActivity.MultiWindowModeChangedListener;
@@ -244,6 +247,24 @@
};
/**
+ * Can be used to tint the color of the RecentsView to simulate a scrim that can views
+ * excluded from. Really should be a proper scrim.
+ * TODO(b/187528071): Remove this and replace with a real scrim.
+ */
+ private static final FloatProperty<RecentsView> COLOR_TINT =
+ new FloatProperty<RecentsView>("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
* more specific, we'd want to create a similar FloatProperty just for a TaskView's
@@ -404,6 +425,10 @@
// The GestureEndTarget that is still in progress.
protected GestureState.GestureEndTarget mCurrentGestureEndTarget;
+ // TODO(b/187528071): Remove these and replace with a real scrim.
+ private float mColorTint;
+ private final int mTintingColor;
+
private int mOverScrollShift = 0;
/**
@@ -616,6 +641,8 @@
mLiveTileTaskViewSimulator.recentsViewScale.value = 1;
mLiveTileTaskViewSimulator.setOrientationState(mOrientationState);
mLiveTileTaskViewSimulator.setDrawsBelowRecents(true);
+
+ mTintingColor = getForegroundScrimDimColor(context);
}
public OverScroller getScroller() {
@@ -1203,6 +1230,7 @@
loadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
setTaskModalness(0);
updateVerticalPageOffsets();
+ setColorTint(0);
}
public void setFullscreenProgress(float fullscreenProgress) {
@@ -3678,9 +3706,34 @@
* tasks to be dimmed while other elements in the recents view are left alone.
*/
public void showForegroundScrim(boolean show) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(this, COLOR_TINT, show ? 0.5f : 0f);
+ anim.setAutoCancel(true);
+ anim.start();
+ }
+
+ /** Tint the RecentsView and TaskViews in to simulate a scrim. */
+ // TODO(b/187528071): Replace this tinting with a scrim on top of RecentsView
+ private void setColorTint(float tintAmount) {
+ mColorTint = tintAmount;
+
for (int i = 0; i < getTaskViewCount(); i++) {
- getTaskViewAt(i).showColorTint(show);
+ getTaskViewAt(i).setColorTint(mColorTint, mTintingColor);
}
+
+ Drawable scrimBg = mActivity.getScrimView().getBackground();
+ if (scrimBg != null) {
+ if (tintAmount == 0f) {
+ scrimBg.setTintList(null);
+ } else {
+ scrimBg.setTintBlendMode(BlendMode.SRC_OVER);
+ scrimBg.setTint(
+ ColorUtils.setAlphaComponent(mTintingColor, (int) (255 * tintAmount)));
+ }
+ }
+ }
+
+ private float getColorTint() {
+ return mColorTint;
}
private boolean showAsGrid() {
@@ -3756,4 +3809,11 @@
});
}
}
+
+ /** Get the color used for foreground scrimming the RecentsView for sharing. */
+ public static int getForegroundScrimDimColor(Context context) {
+ int baseColor = Themes.getAttrColor(context, R.attr.overviewScrimColor);
+ // The Black blending is temporary until we have the proper color token.
+ return ColorUtils.blendARGB(Color.BLACK, baseColor, 0.25f);
+ }
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index 685f725..5b8d4ce 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -53,7 +53,6 @@
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.SystemUiController;
-import com.android.launcher3.util.Themes;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.quickstep.views.TaskView.FullscreenDrawParams;
import com.android.systemui.plugins.OverviewScreenshotActions;
@@ -121,7 +120,7 @@
// Initialize with placeholder value. It is overridden later by TaskView
mFullscreenParams = TEMP_PARAMS.get(context);
- mDimColor = Themes.getColorBackgroundFloating(context);
+ mDimColor = RecentsView.getForegroundScrimDimColor(context);
mDimmingPaintAfterClearing.setColor(mDimColor);
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 6f3aade..a791474 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -88,7 +88,6 @@
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
-import com.android.launcher3.util.Themes;
import com.android.launcher3.util.TransformingTouchDelegate;
import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.RecentsModel;
@@ -328,19 +327,6 @@
}
};
- private static final FloatProperty<TaskView> COLOR_TINT =
- new FloatProperty<TaskView>("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 @@
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 @@
mOutlineProvider = new TaskOutlineProvider(getContext(), mCurrentFullscreenParams,
mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx);
setOutlineProvider(mOutlineProvider);
-
- mTintingColor = Themes.getColorBackgroundFloating(context);
}
/**
@@ -864,7 +843,7 @@
setTranslationZ(0);
setAlpha(mStableAlpha);
setIconScaleAndDim(1);
- setColorTint(0);
+ setColorTint(0, 0);
}
public void setStableAlpha(float parentAlpha) {
@@ -1472,25 +1451,13 @@
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);
}
/**