Fix rounded corners of bottom sheets

Also setting notch mode to never show in landscape
Also also fixing tracking bottom sheet from passing the status bar in landscape
This commit is contained in:
Jays2Kings 2021-03-22 18:42:39 -04:00
parent 617ae424c5
commit 791b94e7a3
3 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,8 @@
package eu.kanade.tachiyomi.ui.manga.track package eu.kanade.tachiyomi.ui.manga.track
import android.content.Intent import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -43,7 +45,7 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
setContentView(view) setContentView(view)
sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup) sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup)
setEdgeToEdge(activity, view) setEdgeToEdge(activity, view, 0)
val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom
sheetBehavior.peekHeight = 500.dpToPx + height sheetBehavior.peekHeight = 500.dpToPx + height

View File

@ -258,10 +258,10 @@ fun BottomSheetDialog.setEdgeToEdge(
.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
val insets = activity.window.decorView.rootWindowInsets val insets = activity.window.decorView.rootWindowInsets
(contentView.parent as View).translationX = ( (contentView.parent as View).background = null
insets.systemWindowInsetLeft - insets contentView.post {
.systemWindowInsetRight (contentView.parent as View).background = null
).toFloat() / 2f }
if (setTopMargin > 0) (contentView.parent as View).updateLayoutParams<ViewGroup.MarginLayoutParams> { if (setTopMargin > 0) (contentView.parent as View).updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = activity.window.decorView.height - insets.systemWindowInsetTop - setTopMargin height = activity.window.decorView.height - insets.systemWindowInsetTop - setTopMargin
} }

View File

@ -5,15 +5,12 @@
<style name="Base.Widget.AppCompat.Toolbar" parent="@style/Base.V26.Widget.AppCompat.Toolbar" /> <style name="Base.Widget.AppCompat.Toolbar" parent="@style/Base.V26.Widget.AppCompat.Toolbar" />
<style name="Base.V26.Theme.AppCompat" parent="@style/Base.V23.Theme.AppCompat"> <style name="Base.V26.Theme.AppCompat" parent="@style/Base.V23.Theme.AppCompat">
<item name="colorError">?android:colorError</item> <item name="colorError">?android:colorError</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style> </style>
<style name="Base.V26.Theme.AppCompat.Light" parent="@style/Base.V23.Theme.AppCompat.Light"> <style name="Base.V26.Theme.AppCompat.Light" parent="@style/Base.V23.Theme.AppCompat.Light">
<item name="colorError">?android:colorError</item> <item name="colorError">?android:colorError</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style> </style>
<style name="Base.V26.Widget.AppCompat.Toolbar" parent="@style/Base.V7.Widget.AppCompat.Toolbar"> <style name="Base.V26.Widget.AppCompat.Toolbar" parent="@style/Base.V7.Widget.AppCompat.Toolbar">
<item name="android:touchscreenBlocksFocus">true</item> <item name="android:touchscreenBlocksFocus">true</item>
<item name="android:keyboardNavigationCluster">true</item> <item name="android:keyboardNavigationCluster">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style> </style>
</resources> </resources>