summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-11-16 17:09:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-11-16 17:09:26 +0000
commit08bafa97583e540d14de0af190caace6136989c0 (patch)
treecf9a78d15f001f5cb08543add51fce6269b7ece3
parent49533f8d29fb5674963e0ac2c3040a459a65429f (diff)
parent2e02a839b3de1a99acd24939c30d869d11132a17 (diff)
Merge "Fixes swipe gesture on non-dismissable notifications."
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
index a4909c77af8c..f1d9549b9284 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
@@ -165,15 +165,15 @@ class NotificationSwipeHelper extends SwipeHelper
if (menuRow.isSnappedAndOnSameSide()) {
// Menu was snapped to previously and we're on the same side
- handleSwipeFromSnap(ev, animView, velocity, menuRow);
+ handleSwipeFromOpenState(ev, animView, velocity, menuRow);
} else {
// Menu has not been snapped, or was snapped previously but is now on
// the opposite side.
- handleSwipeFromNonSnap(ev, animView, velocity, menuRow);
+ handleSwipeFromClosedState(ev, animView, velocity, menuRow);
}
}
- private void handleSwipeFromNonSnap(MotionEvent ev, View animView, float velocity,
+ private void handleSwipeFromClosedState(MotionEvent ev, View animView, float velocity,
NotificationMenuRowPlugin menuRow) {
boolean isDismissGesture = isDismissGesture(ev);
final boolean gestureTowardsMenu = menuRow.isTowardsMenu(velocity);
@@ -183,10 +183,14 @@ class NotificationSwipeHelper extends SwipeHelper
final boolean showMenuForSlowOnGoing = !menuRow.canBeDismissed()
&& timeForGesture >= SWIPE_MENU_TIMING;
- if (!isFalseGesture(ev)
- && (swipedEnoughToShowMenu(menuRow)
- && (!gestureFastEnough || showMenuForSlowOnGoing))
- || (gestureTowardsMenu && !isDismissGesture)) {
+ boolean isNonDismissGestureTowardsMenu = gestureTowardsMenu && !isDismissGesture;
+ boolean isSlowSwipe = !gestureFastEnough || showMenuForSlowOnGoing;
+ boolean slowSwipedFarEnough = swipedEnoughToShowMenu(menuRow) && isSlowSwipe;
+ boolean isFastNonDismissGesture =
+ gestureFastEnough && !gestureTowardsMenu && !isDismissGesture;
+ boolean isMenuRevealingGestureAwayFromMenu = slowSwipedFarEnough || isFastNonDismissGesture;
+ if (isNonDismissGestureTowardsMenu
+ || (!isFalseGesture(ev) && isMenuRevealingGestureAwayFromMenu)) {
// Menu has not been snapped to previously and this is menu revealing gesture
snapOpen(animView, menuRow.getMenuSnapTarget(), velocity);
menuRow.onSnapOpen();
@@ -199,7 +203,7 @@ class NotificationSwipeHelper extends SwipeHelper
}
}
- private void handleSwipeFromSnap(MotionEvent ev, View animView, float velocity,
+ private void handleSwipeFromOpenState(MotionEvent ev, View animView, float velocity,
NotificationMenuRowPlugin menuRow) {
boolean isDismissGesture = isDismissGesture(ev);
@@ -419,4 +423,4 @@ class NotificationSwipeHelper extends SwipeHelper
void onDismiss();
}
-} \ No newline at end of file
+}