Commit cbbf0110 authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Fix overtriggering of onTransitionPeekToHalf in BottomSheet

Overtriggering of the peek-to-half event would cause the scrim to
disappear when the device was rotated. This patch checks that the
sheet state is <= hidden (as opposed to just <) when blocking the
event's trigger. As an added precaution, the listener that sets the
scrim alpha has an added check for whether the sheet is open.

Bug: 840265
Change-Id: Ic3e0731be3525959898159e0610b3c49b9a04fa4
Reviewed-on: https://chromium-review.googlesource.com/1054210Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557626}
parent d4655dce
......@@ -1160,7 +1160,7 @@ public class BottomSheet extends FrameLayout
float offsetWithBrowserControls = getCurrentOffsetPx() - getOffsetFromBrowserControls();
// Do not send events for states less than the hidden state unless 0 has not been sent.
if (offsetWithBrowserControls < getSheetHeightForState(SHEET_STATE_HIDDEN)
if (offsetWithBrowserControls <= getSheetHeightForState(SHEET_STATE_HIDDEN)
&& mLastOffsetRatioSent <= 0) {
return;
}
......
......@@ -173,6 +173,7 @@ public class BottomSheetController implements ApplicationStatus.ActivityStateLis
@Override
public void onTransitionPeekToHalf(float transitionFraction) {
if (!mBottomSheet.isSheetOpen()) return;
fadingBackgroundView.setViewAlpha(transitionFraction);
}
......
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