Merge "Reset internal and visual swipe state whenever the shade collapses." into udc-dev am: b91f5bacd5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22646454 Change-Id: I1e4c7840cd083b3ef976f5ac277e574bb434843b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -374,11 +374,10 @@ public class SwipeHelper implements Gefingerpoken {
|
|||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
final boolean captured = (mIsSwiping || mLongPressSent || mMenuRowIntercepting);
|
final boolean captured = (mIsSwiping || mLongPressSent || mMenuRowIntercepting);
|
||||||
mIsSwiping = false;
|
|
||||||
mTouchedView = null;
|
|
||||||
mLongPressSent = false;
|
mLongPressSent = false;
|
||||||
mCallback.onLongPressSent(null);
|
mCallback.onLongPressSent(null);
|
||||||
mMenuRowIntercepting = false;
|
mMenuRowIntercepting = false;
|
||||||
|
resetSwipeState();
|
||||||
cancelLongPress();
|
cancelLongPress();
|
||||||
if (captured) return true;
|
if (captured) return true;
|
||||||
break;
|
break;
|
||||||
@@ -491,7 +490,7 @@ public class SwipeHelper implements Gefingerpoken {
|
|||||||
}
|
}
|
||||||
if (!mCancelled || wasRemoved) {
|
if (!mCancelled || wasRemoved) {
|
||||||
mCallback.onChildDismissed(animView);
|
mCallback.onChildDismissed(animView);
|
||||||
resetSwipeState();
|
resetSwipeOfView(animView);
|
||||||
}
|
}
|
||||||
if (endAction != null) {
|
if (endAction != null) {
|
||||||
endAction.accept(mCancelled);
|
endAction.accept(mCancelled);
|
||||||
@@ -546,7 +545,7 @@ public class SwipeHelper implements Gefingerpoken {
|
|||||||
|
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
updateSwipeProgressFromOffset(animView, canBeDismissed);
|
updateSwipeProgressFromOffset(animView, canBeDismissed);
|
||||||
resetSwipeState();
|
resetSwipeOfView(animView);
|
||||||
}
|
}
|
||||||
onChildSnappedBack(animView, targetLeft);
|
onChildSnappedBack(animView, targetLeft);
|
||||||
});
|
});
|
||||||
@@ -806,9 +805,20 @@ public class SwipeHelper implements Gefingerpoken {
|
|||||||
return mIsSwiping ? mTouchedView : null;
|
return mIsSwiping ? mTouchedView : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void resetSwipeOfView(View view) {
|
||||||
|
if (getSwipedView() == view) {
|
||||||
|
resetSwipeState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void resetSwipeState() {
|
public void resetSwipeState() {
|
||||||
|
View swipedView = getSwipedView();
|
||||||
mTouchedView = null;
|
mTouchedView = null;
|
||||||
mIsSwiping = false;
|
mIsSwiping = false;
|
||||||
|
if (swipedView != null) {
|
||||||
|
snapChildIfNeeded(swipedView, false, 0);
|
||||||
|
onChildSnappedBack(swipedView, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getTouchSlop(MotionEvent event) {
|
private float getTouchSlop(MotionEvent event) {
|
||||||
|
|||||||
@@ -4189,10 +4189,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
mCentralSurfaces.resetUserExpandedStates();
|
mCentralSurfaces.resetUserExpandedStates();
|
||||||
clearTemporaryViews();
|
clearTemporaryViews();
|
||||||
clearUserLockedViews();
|
clearUserLockedViews();
|
||||||
if (mSwipeHelper.isSwiping()) {
|
cancelActiveSwipe();
|
||||||
mSwipeHelper.resetSwipeState();
|
|
||||||
updateContinuousShadowDrawing();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4264,6 +4261,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
if (!mIsExpanded) {
|
if (!mIsExpanded) {
|
||||||
mGroupExpansionManager.collapseGroups();
|
mGroupExpansionManager.collapseGroups();
|
||||||
mExpandHelper.cancelImmediately();
|
mExpandHelper.cancelImmediately();
|
||||||
|
if (!mIsExpansionChanging) {
|
||||||
|
cancelActiveSwipe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateNotificationAnimationStates();
|
updateNotificationAnimationStates();
|
||||||
updateChronometers();
|
updateChronometers();
|
||||||
@@ -6113,7 +6113,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
|
private void cancelActiveSwipe() {
|
||||||
|
mSwipeHelper.resetSwipeState();
|
||||||
|
updateContinuousShadowDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
void updateContinuousShadowDrawing() {
|
void updateContinuousShadowDrawing() {
|
||||||
boolean continuousShadowUpdate = mAnimationRunning
|
boolean continuousShadowUpdate = mAnimationRunning
|
||||||
|| mSwipeHelper.isSwiping();
|
|| mSwipeHelper.isSwiping();
|
||||||
|
|||||||
@@ -800,6 +800,34 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
assertEquals(mAmbientState.getScrollY(), 0);
|
assertEquals(mAmbientState.getScrollY(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onShadeClosesWithAnimationWillResetSwipeState() {
|
||||||
|
// GIVEN shade is expanded
|
||||||
|
mStackScroller.setIsExpanded(true);
|
||||||
|
clearInvocations(mNotificationSwipeHelper);
|
||||||
|
|
||||||
|
// WHEN closing the shade with the animations
|
||||||
|
mStackScroller.onExpansionStarted();
|
||||||
|
mStackScroller.setIsExpanded(false);
|
||||||
|
mStackScroller.onExpansionStopped();
|
||||||
|
|
||||||
|
// VERIFY swipe is reset
|
||||||
|
verify(mNotificationSwipeHelper).resetSwipeState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onShadeClosesWithoutAnimationWillResetSwipeState() {
|
||||||
|
// GIVEN shade is expanded
|
||||||
|
mStackScroller.setIsExpanded(true);
|
||||||
|
clearInvocations(mNotificationSwipeHelper);
|
||||||
|
|
||||||
|
// WHEN closing the shade without the animation
|
||||||
|
mStackScroller.setIsExpanded(false);
|
||||||
|
|
||||||
|
// VERIFY swipe is reset
|
||||||
|
verify(mNotificationSwipeHelper).resetSwipeState();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSplitShade_hasTopOverscroll() {
|
public void testSplitShade_hasTopOverscroll() {
|
||||||
mTestableResources
|
mTestableResources
|
||||||
|
|||||||
Reference in New Issue
Block a user