Revert "ui: 3rd fix to bottom sheet insets overlap"

This reverts commit 5af437e47f.
This commit is contained in:
Alexander Capehart
2026-01-17 09:36:58 -07:00
parent f8aece19cb
commit 5ea2ccfc7c
@@ -97,15 +97,6 @@ abstract class BaseBottomSheetBehavior<V : View>(context: Context, attributeSet:
true true
override fun onLayoutChild(parent: CoordinatorLayout, child: V, layoutDirection: Int): Boolean { override fun onLayoutChild(parent: CoordinatorLayout, child: V, layoutDirection: Int): Boolean {
// Pre-calculate peekHeight before the sheet is positioned by super.onLayoutChild().
// This ensures correct positioning during configuration changes (e.g., split-screen
// resize) where layout happens before insets are applied. Use the bar's measured
// height if available, otherwise fall back to the ideal height.
val bar = (child as ViewGroup).getChildAt(0)
val barHeight =
if (bar.measuredHeight > 0) bar.measuredHeight else getIdealBarHeight(child.context)
peekHeight = barHeight + idealBottomGestureInsets
val layout = super.onLayoutChild(parent, child, layoutDirection) val layout = super.onLayoutChild(parent, child, layoutDirection)
// Don't repeat redundant initialization. // Don't repeat redundant initialization.
if (!initalized) { if (!initalized) {
@@ -118,6 +109,7 @@ abstract class BaseBottomSheetBehavior<V : View>(context: Context, attributeSet:
setOnApplyWindowInsetsListener(::applyWindowInsets) setOnApplyWindowInsetsListener(::applyWindowInsets)
} }
initalized = true initalized = true
peekHeight = getIdealBarHeight(child.context) + idealBottomGestureInsets
} }
// Sometimes CoordinatorLayout doesn't dispatch window insets to us, likely due to how // Sometimes CoordinatorLayout doesn't dispatch window insets to us, likely due to how
// much we overload it. Ensure that we get them. // much we overload it. Ensure that we get them.