From af1e7af1028f7f3f26747cfe196682b16da96e62 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sat, 27 Mar 2021 14:35:21 -0400 Subject: [PATCH] Fix tabbed sheets having insets added to the height --- .../java/eu/kanade/tachiyomi/widget/TabbedBottomSheet.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/TabbedBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/TabbedBottomSheet.kt index ac8cefc483..af68f48b1c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/TabbedBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/TabbedBottomSheet.kt @@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.view.expand import eu.kanade.tachiyomi.util.view.setEdgeToEdge import kotlinx.android.synthetic.main.tabbed_bottom_sheet.* +import kotlin.math.max abstract class TabbedBottomSheetDialog(private val activity: Activity) : BottomSheetDialog @@ -98,7 +99,7 @@ class MeasuredViewPager @JvmOverloads constructor(context: Context, attrs: Attri super.onMeasure(widthMeasureSpec, heightMeasureSpec) var height = 0 val childWidthSpec = MeasureSpec.makeMeasureSpec( - Math.max( + max( 0, MeasureSpec.getSize(widthMeasureSpec) - paddingLeft - paddingRight @@ -112,10 +113,10 @@ class MeasuredViewPager @JvmOverloads constructor(context: Context, attrs: Attri if (h > height) height = h } if (height != 0) { - heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) + (rootWindowInsets?.systemWindowInsetBottom ?: 0) + heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) } - if (maxHeight < height) { - heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST) + (rootWindowInsets?.systemWindowInsetBottom ?: 0) + if (maxHeight < height + (rootWindowInsets?.systemWindowInsetBottom ?: 0)) { + heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST) } super.onMeasure(widthMeasureSpec, heightMeasureSpec) }