summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/SwipeHelper.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java8
2 files changed, 24 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 19b29206440d..f835ad689132 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -133,6 +133,8 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
private final ArrayMap<View, Animator> mDismissPendingMap = new ArrayMap<>();
+ private float mSnapBackDirection = 0;
+
public SwipeHelper(
Callback callback, Resources resources, ViewConfiguration viewConfiguration,
FalsingManager falsingManager, FeatureFlags featureFlags) {
@@ -523,17 +525,24 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
*/
protected void snapChild(final View animView, final float targetLeft, float velocity) {
final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
+ mSnapBackDirection = getTranslation(animView) - targetLeft;
cancelTranslateAnimation(animView);
PhysicsAnimator<? extends View> anim =
createSnapBackAnimation(animView, targetLeft, velocity);
anim.addUpdateListener((target, values) -> {
- onTranslationUpdate(target, getTranslation(target), canBeDismissed);
+ float translation = getTranslation(target);
+ onTranslationUpdate(target, translation, canBeDismissed);
+ if ((mSnapBackDirection > 0 && translation < targetLeft)
+ || (mSnapBackDirection < 0 && translation > targetLeft)) {
+ mCallback.onChildSnapBackOvershoots();
+ mSnapBackDirection = 0;
+ }
});
anim.addEndListener((t, p, wasFling, cancelled, finalValue, finalVelocity, allEnded) -> {
mSnappingChild = false;
-
+ mSnapBackDirection = 0;
if (!cancelled) {
updateSwipeProgressFromOffset(animView, canBeDismissed);
resetViewIfSwiping(animView);
@@ -947,6 +956,11 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
void onLongPressSent(View v);
/**
+ * The snap back animation on a view overshoots for the first time.
+ */
+ void onChildSnapBackOvershoots();
+
+ /**
* Called when the child is snapped to a position.
*
* @param animView the view that was snapped.
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 804824569f1e..48a6a4c057df 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
@@ -62,6 +62,7 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.view.OneShotPreDrawListener;
import com.android.systemui.Dumpable;
import com.android.systemui.ExpandHelper;
+import com.android.systemui.Flags;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.classifier.Classifier;
import com.android.systemui.classifier.FalsingCollector;
@@ -621,6 +622,13 @@ public class NotificationStackScrollLayoutController implements Dumpable {
}
@Override
+ public void onChildSnapBackOvershoots() {
+ if (Flags.magneticNotificationSwipes()) {
+ mNotificationRoundnessManager.setViewsAffectedBySwipe(null, null, null);
+ }
+ }
+
+ @Override
public void onChildSnappedBack(View animView, float targetLeft) {
mView.onSwipeEnd();
if (animView instanceof ExpandableNotificationRow row) {