From 86889c2d21f4e6c26c7e07a477a9e5c398d5d059 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Mon, 18 Apr 2016 16:37:06 -0700 Subject: [PATCH] Fix gear being covered on notification update If a notification is updated to be non clearable but is in the middle of being dismissed then it is snapped back into place. Part of the ways to check if it was being dismissed is by checking the translation of the notification. In the case that the notification was translated to display the gear, then when it was updated it would be snapped back over the gear. This CL fixes this issue by snapping back to the gear instead of 0 in this situation. Bug: 28019486 Change-Id: Ic6c4c29b0adee15d7b358fcdbc8446e8a4cd9f82 --- .../src/com/android/systemui/SwipeHelper.java | 12 ++++++++++-- .../stack/NotificationStackScrollLayout.java | 6 ++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index e83819179c244..6d5abaf3f16d9 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -494,7 +494,15 @@ public class SwipeHelper implements Gefingerpoken { updateSwipeProgressFromOffset(view, canAnimViewBeDismissed); } - public void snapChildIfNeeded(final View view, boolean animate) { + /** + * Called when a view is updated to be non-dismissable, if the view was being dismissed before + * the update this will handle snapping it back into place. + * + * @param view the view to snap if necessary. + * @param animate whether to animate the snap or not. + * @param targetLeft the target to snap to. + */ + public void snapChildIfNeeded(final View view, boolean animate, float targetLeft) { if ((mDragging && mCurrView == view) || mSnappingChild) { return; } @@ -508,7 +516,7 @@ public class SwipeHelper implements Gefingerpoken { } if (needToSnap) { if (animate) { - snapChild(view, 0 /* targetLeft */, 0.0f /* velocity */); + snapChild(view, targetLeft, 0.0f /* velocity */); } else { snapChildInstantly(view); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 8b52bf65a6736..779ce96303ee3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -990,9 +990,11 @@ public class NotificationStackScrollLayout extends ViewGroup true /* isDismissAll */); } - public void snapViewIfNeeded(View child) { + public void snapViewIfNeeded(ExpandableNotificationRow child) { boolean animate = mIsExpanded || isPinnedHeadsUp(child); - mSwipeHelper.snapChildIfNeeded(child, animate); + // If the child is showing the gear to go to settings, snap to that + float targetLeft = child.getSettingsRow().isVisible() ? child.getTranslation() : 0; + mSwipeHelper.snapChildIfNeeded(child, animate, targetLeft); } @Override