Skip to content

Commit 8ae8a37

Browse files
afohrmanleticiarossi
authored andcommitted
[Side Sheet] Fixed side sheet swipe calculations in RightSheetDelegate.
These changes fix a bug for coplanar predictive back, where a sheet hide was triggered every time a predictive back swipe was started on a right coplanar sheet, rather than allowing the predictive back swipe. PiperOrigin-RevId: 527681485
1 parent a6cf098 commit 8ae8a37

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/java/com/google/android/material/sidesheet/RightSheetDelegate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ int getExpandedOffset() {
6363
boolean isReleasedCloseToOriginEdge(@NonNull View releasedChild) {
6464
// To be considered released close to the origin (right) edge, the released child's left must
6565
// be at least halfway to the origin (right) edge of the screen.
66-
return releasedChild.getLeft() > (getHiddenOffset() - getExpandedOffset()) / 2;
66+
return releasedChild.getLeft() > (getHiddenOffset() + getExpandedOffset()) / 2;
6767
}
6868

6969
@Override
7070
boolean isSwipeSignificant(float xVelocity, float yVelocity) {
7171
return SheetUtils.isSwipeMostlyHorizontal(xVelocity, yVelocity)
72-
&& yVelocity > sheetBehavior.getSignificantVelocityThreshold();
72+
&& Math.abs(xVelocity) > sheetBehavior.getSignificantVelocityThreshold();
7373
}
7474

7575
@Override

0 commit comments

Comments
 (0)