Skip to content

Commit

Permalink
Merge pull request #545 from hirotakaakita/fix/empty_middle_bottom_sheet
Browse files Browse the repository at this point in the history
bottom sheet behavior request force update
  • Loading branch information
takahirom authored Jan 23, 2020
2 parents b5aafa1 + 8f9df14 commit a78f309
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SessionsFragment : DaggerFragment() {
private var binding: FragmentSessionsBinding by autoCleared()
private lateinit var overrideBackPressedCallback: OnBackPressedCallback

private val sessionSheetBehavior: BottomSheetBehavior<*>
private val sessionSheetBehavior: BottomSheetBehavior<View>
get() {
val layoutParams = binding.sessionsSheet.layoutParams as CoordinatorLayout.LayoutParams
val behavior = layoutParams.behavior
Expand Down Expand Up @@ -113,6 +113,14 @@ class SessionsFragment : DaggerFragment() {
binding.sessionsSheet.doOnApplyWindowInsets { _, insets, _ ->
sessionSheetBehavior.peekHeight =
insets.systemWindowInsetBottom + initialPeekHeight + gestureNavigationBottomSpace
// This block is the workaround to bottomSheetBehavior bug fix.
// https://stackoverflow.com/questions/35685681/dynamically-change-height-of-bottomsheetbehavior
if (sessionSheetBehavior.state == BottomSheetBehavior.STATE_COLLAPSED)
sessionSheetBehavior.onLayoutChild(
binding.fragmentSessionsCoordinator,
binding.sessionsSheet,
View.LAYOUT_DIRECTION_LTR
)
}
binding.fragmentSessionsScrollView.doOnApplyWindowInsets { scrollView,
insets,
Expand Down

0 comments on commit a78f309

Please sign in to comment.