Commit e4d3971a authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][BottomSheet] Remove mContentWidth update from root view listener

This CL removes mContentWidth update from the root view's
OnLayoutChangeListener and updates this variable in onContentSizeChanged.

Bug: 1148421
Change-Id: I149b21a83a8145d030221f7c026feeace50fbaff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536874Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarMathias Carlen <mcarlen@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827731}
parent 82ac5bb7
......@@ -38,7 +38,7 @@ public class SizeListenableLinearLayout extends LinearLayout {
// when that happens. A correct fix is to make the BottomSheet always listen for layout
// changes (it currently does that only if there is no ContentSizeListener attached to
// the BottomSheetContent).
mListener.onSizeChanged(-1, bottom - top, -1, -1);
mListener.onSizeChanged(right - left, bottom - top, -1, -1);
}
}
......
......@@ -342,10 +342,6 @@ class BottomSheet extends FrameLayout
mContainerHeight = bottom - top;
mScrollableHeight = mContainerHeight + mToolbarShadowHeight;
// TODO(https://crbug.com/1148421): Remove this update once we can handle
// mContentWidth update in onContentSizeChanged
mContentWidth = mContainerWidth;
if (previousWidth != mContainerWidth || previousHeight != mContainerHeight) {
if (mCurrentState == SheetState.HALF && !isHalfStateEnabled()) {
setSheetState(SheetState.FULL, false);
......@@ -1272,6 +1268,7 @@ class BottomSheet extends FrameLayout
private void onContentSizeChanged(int width, int height, int oldWidth, int oldHeight) {
boolean heightChanged = mContentDesiredHeight != height;
mContentDesiredHeight = height;
mContentWidth = width;
if (heightChanged && mCurrentState == SheetState.SCROLLING) {
endAnimations();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment