Skip to content

Commit

Permalink
[Predictive Back] [Side Sheet] Added updateBackProgress() predictive …
Browse files Browse the repository at this point in the history
…back support for coplanar side sheets.

Before this change, coplanar sheets responded to the sheet during finishBackProgress(), in handleBackInvoked(). After this change, coplanar sheets respond to the back progress while the predictive back event is in progress, in updateBackProgress().

PiperOrigin-RevId: 528470353
  • Loading branch information
afohrman authored and leticiarossi committed May 1, 2023
1 parent b984e64 commit 5ba704a
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -991,6 +991,31 @@ public void updateBackProgress(@NonNull BackEvent backEvent) {
return;
}
sideContainerBackHelper.updateBackProgress(backEvent, getGravityFromSheetEdge());

updateCoplanarSiblingBackProgress();
}

private void updateCoplanarSiblingBackProgress() {
if (viewRef == null || viewRef.get() == null) {
return;
}
View sheet = viewRef.get();

View coplanarSiblingView = getCoplanarSiblingView();
if (coplanarSiblingView == null) {
return;
}

MarginLayoutParams coplanarSiblingLayoutParams =
(MarginLayoutParams) coplanarSiblingView.getLayoutParams();
if (coplanarSiblingLayoutParams == null) {
return;
}

int updatedCoplanarSiblingAdjacentMargin = (int) (childWidth * sheet.getScaleX() + innerMargin);
sheetDelegate.updateCoplanarSiblingAdjacentMargin(
coplanarSiblingLayoutParams, updatedCoplanarSiblingAdjacentMargin);
coplanarSiblingView.requestLayout();
}

@Override
Expand Down

0 comments on commit 5ba704a

Please sign in to comment.