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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user