From 65e826dbc233dc60ee79368580eca3c5fcbfc5f8 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Tue, 8 Jun 2021 15:04:22 -0400 Subject: [PATCH] Add slow fade-in to notification shelf icon to prevent overlapping icons in the shelf. Fixes: 188030100 Test: manual testing Change-Id: I54382c5bd6bb1953205af6aad399f199cb2fc7dd --- .../android/systemui/statusbar/NotificationShelf.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 9dc4ac952b1d1..8878d3c4fe6c8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -29,6 +29,8 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.animation.Interpolator; +import android.view.animation.PathInterpolator; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.R; @@ -56,6 +58,11 @@ public class NotificationShelf extends ActivatableNotificationView implements private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag; private static final String TAG = "NotificationShelf"; + // More extreme version of SLOW_OUT_LINEAR_IN which keeps the icon nearly invisible until after + // the next icon has translated out of the way, to avoid overlapping. + private static final Interpolator ICON_ALPHA_INTERPOLATOR = + new PathInterpolator(0.6f, 0f, 0.6f, 0f); + private NotificationIconContainer mShelfIcons; private int[] mTmp = new int[2]; private boolean mHideBackground; @@ -659,7 +666,7 @@ public class NotificationShelf extends ActivatableNotificationView implements if (iconState == null) { return; } - iconState.alpha = transitionAmount; + iconState.alpha = ICON_ALPHA_INTERPOLATOR.getInterpolation(transitionAmount); boolean isAppearing = row.isDrawingAppearAnimation() && !row.isInShelf(); iconState.hidden = isAppearing || (view instanceof ExpandableNotificationRow