Merge "RecentsView - reduce work in color tint animator" into sc-dev am: d7129fc919

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14803765

Change-Id: Id0679baf604aa354dfe2013e5575193b389a07e5
This commit is contained in:
Zak Cohen
2021-06-03 17:25:15 +00:00
committed by Automerger Merge Worker
@@ -410,6 +410,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
// TODO(b/187528071): Remove these and replace with a real scrim. // TODO(b/187528071): Remove these and replace with a real scrim.
private float mColorTint; private float mColorTint;
private final int mTintingColor; private final int mTintingColor;
private ObjectAnimator mTintingAnimator;
private int mOverScrollShift = 0; private int mOverScrollShift = 0;
@@ -3693,9 +3694,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
* tasks to be dimmed while other elements in the recents view are left alone. * tasks to be dimmed while other elements in the recents view are left alone.
*/ */
public void showForegroundScrim(boolean show) { public void showForegroundScrim(boolean show) {
ObjectAnimator anim = ObjectAnimator.ofFloat(this, COLOR_TINT, show ? 0.5f : 0f); if (!show && mColorTint == 0) {
anim.setAutoCancel(true); if (mTintingAnimator != null) {
anim.start(); mTintingAnimator.cancel();
mTintingAnimator = null;
}
return;
}
mTintingAnimator = ObjectAnimator.ofFloat(this, COLOR_TINT, show ? 0.5f : 0f);
mTintingAnimator.setAutoCancel(true);
mTintingAnimator.start();
} }
/** Tint the RecentsView and TaskViews in to simulate a scrim. */ /** Tint the RecentsView and TaskViews in to simulate a scrim. */