Skip to content

Commit ad9ad20

Browse files
afohrmanhunterstich
authored andcommitted
[Side Sheet] Renamed private references of "origin" to "inner" in SheetDelegate and related delegate classes.
PiperOrigin-RevId: 529193878
1 parent 1c27404 commit ad9ad20

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,26 @@ int getSheetEdge() {
4242
return SideSheetBehavior.EDGE_LEFT;
4343
}
4444

45-
/** Returns the sheet's offset in pixels from the origin edge when hidden. */
45+
/** Returns the sheet's offset in pixels from the inner edge when hidden. */
4646
@Override
4747
int getHiddenOffset() {
4848
// Return the parent's width in pixels, which results in the sheet being offset entirely off of
4949
// screen.
5050
return -sheetBehavior.getChildWidth() - sheetBehavior.getInnerMargin();
5151
}
5252

53-
/** Returns the sheet's offset in pixels from the origin edge when expanded. */
53+
/** Returns the sheet's offset in pixels from the inner edge when expanded. */
5454
@Override
5555
int getExpandedOffset() {
5656
// Calculate the expanded offset based on the width of the content.
5757
return max(0, sheetBehavior.getParentInnerEdge() + sheetBehavior.getInnerMargin());
5858
}
5959

60-
/** Whether the view has been released from a drag close to the origin edge. */
60+
/** Whether the view has been released from a drag close to the inner edge. */
6161
@Override
62-
boolean isReleasedCloseToOriginEdge(@NonNull View releasedChild) {
63-
// To be considered released close to the origin (left) edge, the released child's right must
64-
// be at least halfway to the origin (left) edge of the screen.
62+
boolean isReleasedCloseToInnerEdge(@NonNull View releasedChild) {
63+
// To be considered released close to the inner (left) edge, the released child's right must
64+
// be at least halfway to the inner (left) edge of the screen.
6565
return releasedChild.getRight() < (getExpandedOffset() - getHiddenOffset()) / 2;
6666
}
6767

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@ int getSheetEdge() {
4242
return SideSheetBehavior.EDGE_RIGHT;
4343
}
4444

45-
/** Returns the sheet's offset in pixels from the origin edge when hidden. */
45+
/** Returns the sheet's offset in pixels from the inner edge when hidden. */
4646
@Override
4747
int getHiddenOffset() {
4848
// Return the parent's width in pixels, which results in the sheet being offset entirely off of
4949
// screen.
5050
return sheetBehavior.getParentWidth();
5151
}
5252

53-
/** Returns the sheet's offset in pixels from the origin edge when expanded. */
53+
/** Returns the sheet's offset in pixels from the inner edge when expanded. */
5454
@Override
5555
int getExpandedOffset() {
5656
// Calculate the expanded offset based on the width of the content.
5757
return max(
5858
0, getHiddenOffset() - sheetBehavior.getChildWidth() - sheetBehavior.getInnerMargin());
5959
}
6060

61-
/** Whether the view has been released from a drag close to the origin edge. */
61+
/** Whether the view has been released from a drag close to the inner edge. */
6262
@Override
63-
boolean isReleasedCloseToOriginEdge(@NonNull View releasedChild) {
64-
// To be considered released close to the origin (right) edge, the released child's left must
65-
// be at least halfway to the origin (right) edge of the screen.
63+
boolean isReleasedCloseToInnerEdge(@NonNull View releasedChild) {
64+
// To be considered released close to the inner (right) edge, the released child's left must
65+
// be at least halfway to the inner (right) edge of the screen.
6666
return releasedChild.getLeft() > (getHiddenOffset() + getExpandedOffset()) / 2;
6767
}
6868

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ abstract class SheetDelegate {
3434
@SheetEdge
3535
abstract int getSheetEdge();
3636

37-
/** Returns the sheet's offset from the origin edge when hidden. */
37+
/** Returns the sheet's offset from the inner edge when hidden. */
3838
abstract int getHiddenOffset();
3939

40-
/** Returns the sheet's offset from the origin edge when expanded. */
40+
/** Returns the sheet's offset from the inner edge when expanded. */
4141
abstract int getExpandedOffset();
4242

43-
/** Whether the view has been released from a drag close to the origin edge. */
44-
abstract boolean isReleasedCloseToOriginEdge(@NonNull View releasedChild);
43+
/** Whether the view has been released from a drag close to the inner edge. */
44+
abstract boolean isReleasedCloseToInnerEdge(@NonNull View releasedChild);
4545

4646
abstract boolean isSwipeSignificant(float xVelocity, float yVelocity);
4747

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ private float calculateDragDistance(float initialPoint, float currentPoint) {
557557
}
558558

559559
/**
560-
* Returns the sheet's offset from the origin edge when expanded. It will calculate the offset
560+
* Returns the sheet's offset from the inner edge when expanded. It will calculate the offset
561561
* based on the width of the content.
562562
*/
563563
public int getExpandedOffset() {
@@ -859,10 +859,10 @@ private int calculateTargetStateOnViewReleased(
859859
targetState = STATE_EXPANDED;
860860

861861
} else if (shouldHide(releasedChild, xVelocity)) {
862-
// Hide if the view was either released close to the origin/right edge or it was a significant
862+
// Hide if the view was either released close to the inner edge or it was a significant
863863
// horizontal swipe; otherwise settle to expanded state.
864864
if (sheetDelegate.isSwipeSignificant(xVelocity, yVelocity)
865-
|| sheetDelegate.isReleasedCloseToOriginEdge(releasedChild)) {
865+
|| sheetDelegate.isReleasedCloseToInnerEdge(releasedChild)) {
866866
targetState = STATE_HIDDEN;
867867
} else {
868868
targetState = STATE_EXPANDED;

0 commit comments

Comments
 (0)