Fixes notification swipe snapping when menu is empty.
This change modifies the swipe handling logic in NotificationSwipeHelper such that it doesn't attempt to snap to the "menu open" state when the menu is zero width (i.e. it's snapping on a left-to-right gesture and the menu is only enabled for right-to-left swipes). This prevents us from getting in to a state where the menu was considered "open" when it wasn't, which caused the next gesture to be handled incorrectly. Change-Id: I3b78e95de7266e5a469637007ca78f7af2caab49 Fixes: 121077588 Test: manually
This commit is contained in:
@@ -189,10 +189,13 @@ class NotificationSwipeHelper extends SwipeHelper
|
||||
boolean isFastNonDismissGesture =
|
||||
gestureFastEnough && !gestureTowardsMenu && !isDismissGesture;
|
||||
boolean isMenuRevealingGestureAwayFromMenu = slowSwipedFarEnough || isFastNonDismissGesture;
|
||||
if (isNonDismissGestureTowardsMenu
|
||||
|| (!isFalseGesture(ev) && isMenuRevealingGestureAwayFromMenu)) {
|
||||
int menuSnapTarget = menuRow.getMenuSnapTarget();
|
||||
boolean isNonFalseMenuRevealingGesture =
|
||||
!isFalseGesture(ev) && isMenuRevealingGestureAwayFromMenu;
|
||||
if ((isNonDismissGestureTowardsMenu || isNonFalseMenuRevealingGesture)
|
||||
&& menuSnapTarget != 0) {
|
||||
// Menu has not been snapped to previously and this is menu revealing gesture
|
||||
snapOpen(animView, menuRow.getMenuSnapTarget(), velocity);
|
||||
snapOpen(animView, menuSnapTarget, velocity);
|
||||
menuRow.onSnapOpen();
|
||||
} else if (isDismissGesture(ev) && !gestureTowardsMenu) {
|
||||
dismiss(animView, velocity);
|
||||
|
||||
Reference in New Issue
Block a user