Loading quickstep/src/com/android/quickstep/views/RecentsView.java +61 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -243,6 +246,24 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T } }; /** * 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 Loading Loading @@ -404,6 +425,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T // 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; /** Loading Loading @@ -616,6 +641,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T mLiveTileTaskViewSimulator.recentsViewScale.value = 1; mLiveTileTaskViewSimulator.setOrientationState(mOrientationState); mLiveTileTaskViewSimulator.setDrawsBelowRecents(true); mTintingColor = getForegroundScrimDimColor(context); } public OverScroller getScroller() { Loading Loading @@ -1186,6 +1213,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T loadVisibleTaskData(TaskView.FLAG_UPDATE_ALL); setTaskModalness(0); updateVerticalPageOffsets(); setColorTint(0); } public void setFullscreenProgress(float fullscreenProgress) { Loading Loading @@ -3661,9 +3689,34 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T * 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() { Loading Loading @@ -3739,4 +3792,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T }); } } /** 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); } } quickstep/src/com/android/quickstep/views/TaskThumbnailView.java +1 −2 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import com.android.launcher3.config.FeatureFlags; 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; Loading Loading @@ -121,7 +120,7 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc // 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); } Loading quickstep/src/com/android/quickstep/views/TaskView.java +6 −39 Original line number Diff line number Diff line Loading @@ -88,7 +88,6 @@ import com.android.launcher3.util.ActivityOptionsWrapper; 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; Loading Loading @@ -328,19 +327,6 @@ public class TaskView extends FrameLayout implements Reusable { } }; 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; Loading Loading @@ -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) { Loading @@ -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); } /** Loading Loading @@ -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) { Loading Loading @@ -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); } /** Loading Loading
quickstep/src/com/android/quickstep/views/RecentsView.java +61 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -243,6 +246,24 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T } }; /** * 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 Loading Loading @@ -404,6 +425,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T // 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; /** Loading Loading @@ -616,6 +641,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T mLiveTileTaskViewSimulator.recentsViewScale.value = 1; mLiveTileTaskViewSimulator.setOrientationState(mOrientationState); mLiveTileTaskViewSimulator.setDrawsBelowRecents(true); mTintingColor = getForegroundScrimDimColor(context); } public OverScroller getScroller() { Loading Loading @@ -1186,6 +1213,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T loadVisibleTaskData(TaskView.FLAG_UPDATE_ALL); setTaskModalness(0); updateVerticalPageOffsets(); setColorTint(0); } public void setFullscreenProgress(float fullscreenProgress) { Loading Loading @@ -3661,9 +3689,34 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T * 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() { Loading Loading @@ -3739,4 +3792,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T }); } } /** 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); } }
quickstep/src/com/android/quickstep/views/TaskThumbnailView.java +1 −2 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import com.android.launcher3.config.FeatureFlags; 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; Loading Loading @@ -121,7 +120,7 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc // 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); } Loading
quickstep/src/com/android/quickstep/views/TaskView.java +6 −39 Original line number Diff line number Diff line Loading @@ -88,7 +88,6 @@ import com.android.launcher3.util.ActivityOptionsWrapper; 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; Loading Loading @@ -328,19 +327,6 @@ public class TaskView extends FrameLayout implements Reusable { } }; 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; Loading Loading @@ -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) { Loading @@ -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); } /** Loading Loading @@ -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) { Loading Loading @@ -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); } /** Loading