Commit 38cbde1b authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Bug fix for BottomSheet content scroling

A bug in the math getting BottomSheet full height ratio prevented
the content from scrolling properly in when the sheet is of max height.
This CL sets it right.

Bug: 1005371
Change-Id: I4e59898c14ffaaa3fb9635e25769936d199cd907
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1809023Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697838}
parent 3be3631a
...@@ -1040,7 +1040,7 @@ public class BottomSheet ...@@ -1040,7 +1040,7 @@ public class BottomSheet
if (mContainerHeight <= 0) return 0; if (mContainerHeight <= 0) return 0;
float customFullRatio = float customFullRatio =
mSheetContent != null ? mSheetContent.getCustomFullRatio() : INVALID_HEIGHT_RATIO; mSheetContent != null ? mSheetContent.getCustomFullRatio() : INVALID_HEIGHT_RATIO;
return customFullRatio < 0 ? mContainerHeight / (mContainerHeight + mToolbarShadowHeight) return customFullRatio < 0 ? (mContainerHeight + mToolbarShadowHeight) / mContainerHeight
: customFullRatio; : customFullRatio;
} }
...@@ -1333,7 +1333,7 @@ public class BottomSheet ...@@ -1333,7 +1333,7 @@ public class BottomSheet
public boolean isSmallScreen() { public boolean isSmallScreen() {
// A small screen is defined by there being less than 160dp between half and full states. // A small screen is defined by there being less than 160dp between half and full states.
float fullHeightRatio = mContainerHeight / (mContainerHeight + mToolbarShadowHeight); float fullHeightRatio = (mContainerHeight + mToolbarShadowHeight) / mContainerHeight;
float fullToHalfDiff = (fullHeightRatio - HALF_HEIGHT_RATIO) * mContainerHeight; float fullToHalfDiff = (fullHeightRatio - HALF_HEIGHT_RATIO) * mContainerHeight;
return fullToHalfDiff < mMinHalfFullDistance; return fullToHalfDiff < mMinHalfFullDistance;
} }
......
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