ui: make bottom sheets request insets on layout

Make bottom sheets request window insets when they are laid out.

For some insane reason, bottom sheets are just not given window insets
when the device is rotated in the detail view. Appaently requesting them
fixes it all of a sudden.
This commit is contained in:
OxygenCobalt
2022-08-03 15:42:37 -06:00
parent 79637f7603
commit 772fe7df3b
3 changed files with 18 additions and 4 deletions
@@ -120,6 +120,8 @@ class BottomSheetContentBehavior<V : View>(context: Context, attributeSet: Attri
setup = true
}
child.requestApplyInsets()
return true
}
@@ -34,7 +34,19 @@ class EdgeCoordinatorLayout
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr: Int = 0) :
CoordinatorLayout(context, attrs, defStyleAttr) {
override fun dispatchApplyWindowInsets(insets: WindowInsets): WindowInsets {
super.dispatchApplyWindowInsets(insets)
for (child in children) {
child.dispatchApplyWindowInsets(insets)
}
return insets
}
override fun onApplyWindowInsets(insets: WindowInsets): WindowInsets {
super.onApplyWindowInsets(insets)
for (child in children) {
child.onApplyWindowInsets(insets)
}