From a5f909ffc0d82a8fb427afe1584a9af96a30946e Mon Sep 17 00:00:00 2001 From: Jay Aliomer Date: Fri, 15 Apr 2022 17:12:27 -0400 Subject: [PATCH] Properly apply launch animation params Also rename methods to make sense Fixes: 229075523 Test: visual Change-Id: I76e1b4904df69958e01641e362a0de60185f94af --- ...meters.kt => LaunchAnimationParameters.kt} | 4 +-- .../NotificationLaunchAnimatorController.kt | 10 +++---- .../row/ExpandableNotificationRow.java | 30 +++++++++++++++---- .../row/NotificationBackgroundView.java | 2 -- .../stack/NotificationListContainer.java | 4 +-- .../stack/NotificationStackScrollLayout.java | 6 ++-- ...tificationStackScrollLayoutController.java | 6 ++-- 7 files changed, 39 insertions(+), 23 deletions(-) rename packages/SystemUI/src/com/android/systemui/statusbar/notification/{ExpandAnimationParameters.kt => LaunchAnimationParameters.kt} (95%) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ExpandAnimationParameters.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/LaunchAnimationParameters.kt similarity index 95% rename from packages/SystemUI/src/com/android/systemui/statusbar/notification/ExpandAnimationParameters.kt rename to packages/SystemUI/src/com/android/systemui/statusbar/notification/LaunchAnimationParameters.kt index 349b1918a504c..42edb309d5773 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ExpandAnimationParameters.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/LaunchAnimationParameters.kt @@ -7,8 +7,8 @@ import com.android.systemui.animation.Interpolators import com.android.systemui.animation.LaunchAnimator import kotlin.math.min -/** Parameters for the notifications expand animations. */ -class ExpandAnimationParameters( +/** Parameters for the notifications launch expanding animations. */ +class LaunchAnimationParameters( top: Int, bottom: Int, left: Int, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt index 02aa1f2fd585b..b764c271de453 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt @@ -82,7 +82,7 @@ class NotificationLaunchAnimatorController( } else { notification.currentBackgroundRadiusTop } - val params = ExpandAnimationParameters( + val params = LaunchAnimationParameters( top = windowTop, bottom = location[1] + height, left = location[0], @@ -165,9 +165,9 @@ class NotificationLaunchAnimatorController( onFinishAnimationCallback?.run() } - private fun applyParams(params: ExpandAnimationParameters?) { - notification.applyExpandAnimationParams(params) - notificationListContainer.applyExpandAnimationParams(params) + private fun applyParams(params: LaunchAnimationParameters?) { + notification.applyLaunchAnimationParams(params) + notificationListContainer.applyLaunchAnimationParams(params) } override fun onLaunchAnimationProgress( @@ -175,7 +175,7 @@ class NotificationLaunchAnimatorController( progress: Float, linearProgress: Float ) { - val params = state as ExpandAnimationParameters + val params = state as LaunchAnimationParameters params.progress = progress params.linearProgress = linearProgress diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index efb46b9689d3a..3347bf3bf05a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -93,7 +93,7 @@ import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.SmartReplyController; import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.notification.AboveShelfChangedListener; -import com.android.systemui.statusbar.notification.ExpandAnimationParameters; +import com.android.systemui.statusbar.notification.LaunchAnimationParameters; import com.android.systemui.statusbar.notification.FeedbackIcon; import com.android.systemui.statusbar.notification.NotificationFadeAware; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController; @@ -367,8 +367,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView private SystemNotificationAsyncTask mSystemNotificationAsyncTask = new SystemNotificationAsyncTask(); - private float mTopRoundnessDuringExpandAnimation; - private float mBottomRoundnessDuringExpandAnimation; + private float mTopRoundnessDuringLaunchAnimation; + private float mBottomRoundnessDuringLaunchAnimation; /** * Returns whether the given {@code statusBarNotification} is a system notification. @@ -2130,7 +2130,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } - public void applyExpandAnimationParams(ExpandAnimationParameters params) { + public void applyLaunchAnimationParams(LaunchAnimationParameters params) { if (params == null) { return; } @@ -2195,13 +2195,31 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } setTranslationY(top); - mTopRoundnessDuringExpandAnimation = params.getTopCornerRadius() / mOutlineRadius; - mBottomRoundnessDuringExpandAnimation = params.getBottomCornerRadius() / mOutlineRadius; + mTopRoundnessDuringLaunchAnimation = params.getTopCornerRadius() / mOutlineRadius; + mBottomRoundnessDuringLaunchAnimation = params.getBottomCornerRadius() / mOutlineRadius; invalidateOutline(); mBackgroundNormal.setExpandAnimationSize(params.getWidth(), actualHeight); } + @Override + public float getCurrentTopRoundness() { + if (mExpandAnimationRunning) { + return mTopRoundnessDuringLaunchAnimation; + } + + return super.getCurrentTopRoundness(); + } + + @Override + public float getCurrentBottomRoundness() { + if (mExpandAnimationRunning) { + return mBottomRoundnessDuringLaunchAnimation; + } + + return super.getCurrentBottomRoundness(); + } + public void setExpandAnimationRunning(boolean expandAnimationRunning) { if (expandAnimationRunning) { setAboveShelf(true); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java index 7d0f00abcc98e..51715696efb03 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java @@ -29,8 +29,6 @@ import android.view.View; import com.android.internal.util.ArrayUtils; import com.android.systemui.R; -import com.android.systemui.statusbar.NotificationShelf; -import com.android.systemui.statusbar.notification.ExpandAnimationParameters; /** * A view that can be used for both the dimmed and normal background of an notification. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java index 7a5c18896e5f7..e4d96c30f15c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java @@ -22,7 +22,7 @@ import android.view.ViewGroup; import androidx.annotation.Nullable; import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper; -import com.android.systemui.statusbar.notification.ExpandAnimationParameters; +import com.android.systemui.statusbar.notification.LaunchAnimationParameters; import com.android.systemui.statusbar.notification.NotificationActivityStarter; import com.android.systemui.statusbar.notification.VisibilityLocationProvider; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -175,7 +175,7 @@ public interface NotificationListContainer extends /** * Apply parameters of the expand animation to the layout */ - default void applyExpandAnimationParams(ExpandAnimationParameters params) {} + default void applyLaunchAnimationParams(LaunchAnimationParameters params) {} default void setExpandingNotification(ExpandableNotificationRow row) {} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 15a93c871c805..adba5b676dc85 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -85,7 +85,7 @@ import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationShelfController; import com.android.systemui.statusbar.StatusBarState; -import com.android.systemui.statusbar.notification.ExpandAnimationParameters; +import com.android.systemui.statusbar.notification.LaunchAnimationParameters; import com.android.systemui.statusbar.notification.FakeShadowView; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController; import com.android.systemui.statusbar.notification.NotificationUtils; @@ -516,7 +516,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable /** * The current launch animation params when launching a notification */ - private ExpandAnimationParameters mLaunchAnimationParams; + private LaunchAnimationParameters mLaunchAnimationParams; /** * Corner radii of the launched notification if it's clipped @@ -3018,7 +3018,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER) - public void applyExpandAnimationParams(ExpandAnimationParameters params) { + public void applyLaunchAnimationParams(LaunchAnimationParameters params) { // Modify the clipping for launching notifications mLaunchAnimationParams = params; setLaunchingNotification(params != null); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index 440bea638231f..d17338ee21615 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -83,7 +83,7 @@ import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; -import com.android.systemui.statusbar.notification.ExpandAnimationParameters; +import com.android.systemui.statusbar.notification.LaunchAnimationParameters; import com.android.systemui.statusbar.notification.NotifPipelineFlags; import com.android.systemui.statusbar.notification.NotificationActivityStarter; import com.android.systemui.statusbar.notification.NotificationEntryListener; @@ -1739,8 +1739,8 @@ public class NotificationStackScrollLayoutController { } @Override - public void applyExpandAnimationParams(ExpandAnimationParameters params) { - mView.applyExpandAnimationParams(params); + public void applyLaunchAnimationParams(LaunchAnimationParameters params) { + mView.applyLaunchAnimationParams(params); } @Override