From ccc3a662318d99599d98a47e6c724e50fed987e1 Mon Sep 17 00:00:00 2001 From: Peter Kalauskas Date: Thu, 12 May 2022 22:53:37 +0000 Subject: [PATCH] Fix text crossfade When expanding a notification and changing the text displayed, fade-out the going-away text earlier, and fade-in the new text later. This avoids a state in between where some text is drawn on top of other text. Test: Create notification with long text, use drag to slowly expand notification. Check that text is never drawn on top of each other Bug: 232852389 Change-Id: If0eb86aaf858ba7b2043bca56c4c70196709f078 --- .../statusbar/notification/TransformState.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java index 9f9fba4378696..f84a6df05422f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification; +import android.util.MathUtils; import android.util.Pools; import android.view.View; import android.view.animation.Interpolator; @@ -98,7 +99,10 @@ public class TransformState { if (sameAs(otherState)) { ensureVisible(); } else { - CrossFadeHelper.fadeIn(mTransformedView, transformationAmount, true /* remap */); + CrossFadeHelper.fadeIn( + mTransformedView, + MathUtils.constrainedMap(0, 1, 0.45f, 1, transformationAmount), + false /* remap */); } transformViewFullyFrom(otherState, transformationAmount); } @@ -294,7 +298,10 @@ public class TransformState { } return false; } else { - CrossFadeHelper.fadeOut(mTransformedView, transformationAmount); + CrossFadeHelper.fadeOut( + mTransformedView, + MathUtils.constrainedMap(0, 1, 0, 0.55f, transformationAmount), + false /* remap */); } transformViewFullyTo(otherState, transformationAmount); return true;