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:
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)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<org.oxycblt.auxio.ui.coordinator.EdgeCoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main_layout"
|
||||
|
@ -16,7 +16,7 @@
|
|||
app:navGraph="@navigation/nav_explore"
|
||||
tools:layout="@layout/fragment_home" />
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
<org.oxycblt.auxio.ui.coordinator.EdgeCoordinatorLayout
|
||||
android:id="@+id/playback_sheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -79,6 +79,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</org.oxycblt.auxio.ui.coordinator.EdgeCoordinatorLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</org.oxycblt.auxio.ui.coordinator.EdgeCoordinatorLayout>
|
||||
|
|
Loading…
Reference in a new issue