Commit 40f419bf authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Adjust bottom container view offset for bottom sheet

The top shadow drawable for bottom sheet consists of 3 parts
vertically - round-cornered view, shadow, and an empty space at the
top. In order to remove the gap between bottom sheet and infobar (or
any other view bottom container), the infobar needs to be lowered down
by the height of shadow plus that of the empty space. This CL defines
a new constant |bottom_sheet_shadow_top_offset| for the space, and
applies it to bottom container.

Bug: 1025098, 1030251
Change-Id: Ic145e861fcc5f1639196f6b96d3bfe3208fc0581
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948367
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721775}
parent ed2d5878
...@@ -616,7 +616,8 @@ ...@@ -616,7 +616,8 @@
<!-- Bottom Sheet dimensions --> <!-- Bottom Sheet dimensions -->
<dimen name="bottom_sheet_min_full_half_distance">140dp</dimen> <dimen name="bottom_sheet_min_full_half_distance">140dp</dimen>
<dimen name="bottom_sheet_peek_height">56dp</dimen> <dimen name="bottom_sheet_peek_height">56dp</dimen>
<dimen name="bottom_sheet_toolbar_shadow_height">24dp</dimen> <dimen name="bottom_sheet_toolbar_shadow_height">16dp</dimen>
<dimen name="bottom_sheet_shadow_top_offset">10dp</dimen>
<!-- Miscellaneous dimensions --> <!-- Miscellaneous dimensions -->
<dimen name="text_bubble_menu_anchor_y_inset">14dp</dimen> <dimen name="text_bubble_menu_anchor_y_inset">14dp</dimen>
......
...@@ -196,6 +196,10 @@ class BottomSheet extends FrameLayout ...@@ -196,6 +196,10 @@ class BottomSheet extends FrameLayout
return R.dimen.bottom_sheet_toolbar_shadow_height; return R.dimen.bottom_sheet_toolbar_shadow_height;
} }
static @DimenRes int getShadowTopOffsetResourceId() {
return R.dimen.bottom_sheet_shadow_top_offset;
}
/** /**
* Called when the activity containing the {@link BottomSheet} is destroyed. * Called when the activity containing the {@link BottomSheet} is destroyed.
*/ */
......
...@@ -105,6 +105,9 @@ public class BottomSheetController implements Destroyable { ...@@ -105,6 +105,9 @@ public class BottomSheetController implements Destroyable {
/** The height of the shadow that sits above the toolbar. */ /** The height of the shadow that sits above the toolbar. */
private final int mToolbarShadowHeight; private final int mToolbarShadowHeight;
/** The offset of the toolbar shadow from the top that remains empty. */
private final int mShadowTopOffset;
/** The parameters that control how the scrim behaves while the sheet is open. */ /** The parameters that control how the scrim behaves while the sheet is open. */
private ScrimParams mScrimParams; private ScrimParams mScrimParams;
...@@ -162,6 +165,8 @@ public class BottomSheetController implements Destroyable { ...@@ -162,6 +165,8 @@ public class BottomSheetController implements Destroyable {
mPendingSheetObservers = new ArrayList<>(); mPendingSheetObservers = new ArrayList<>();
mToolbarShadowHeight = mToolbarShadowHeight =
scrim.getResources().getDimensionPixelOffset(BottomSheet.getTopShadowResourceId()); scrim.getResources().getDimensionPixelOffset(BottomSheet.getTopShadowResourceId());
mShadowTopOffset = scrim.getResources().getDimensionPixelOffset(
BottomSheet.getShadowTopOffsetResourceId());
mPendingSheetObservers.add(new EmptyBottomSheetObserver() { mPendingSheetObservers.add(new EmptyBottomSheetObserver() {
/** The token used to enable browser controls persistence. */ /** The token used to enable browser controls persistence. */
...@@ -422,7 +427,7 @@ public class BottomSheetController implements Destroyable { ...@@ -422,7 +427,7 @@ public class BottomSheetController implements Destroyable {
/** @return The height of the shadow above the bottom sheet in px. */ /** @return The height of the shadow above the bottom sheet in px. */
public int getTopShadowHeight() { public int getTopShadowHeight() {
return mToolbarShadowHeight; return mToolbarShadowHeight + mShadowTopOffset;
} }
/** /**
......
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