mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 00:11:50 +01:00
Fix tabbed sheets having insets added to the height
This commit is contained in:
parent
58defbb5d2
commit
af1e7af102
@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx
|
|||||||
import eu.kanade.tachiyomi.util.view.expand
|
import eu.kanade.tachiyomi.util.view.expand
|
||||||
import eu.kanade.tachiyomi.util.view.setEdgeToEdge
|
import eu.kanade.tachiyomi.util.view.setEdgeToEdge
|
||||||
import kotlinx.android.synthetic.main.tabbed_bottom_sheet.*
|
import kotlinx.android.synthetic.main.tabbed_bottom_sheet.*
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
abstract class TabbedBottomSheetDialog(private val activity: Activity) :
|
abstract class TabbedBottomSheetDialog(private val activity: Activity) :
|
||||||
BottomSheetDialog
|
BottomSheetDialog
|
||||||
@ -98,7 +99,7 @@ class MeasuredViewPager @JvmOverloads constructor(context: Context, attrs: Attri
|
|||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||||
var height = 0
|
var height = 0
|
||||||
val childWidthSpec = MeasureSpec.makeMeasureSpec(
|
val childWidthSpec = MeasureSpec.makeMeasureSpec(
|
||||||
Math.max(
|
max(
|
||||||
0,
|
0,
|
||||||
MeasureSpec.getSize(widthMeasureSpec) -
|
MeasureSpec.getSize(widthMeasureSpec) -
|
||||||
paddingLeft - paddingRight
|
paddingLeft - paddingRight
|
||||||
@ -112,10 +113,10 @@ class MeasuredViewPager @JvmOverloads constructor(context: Context, attrs: Attri
|
|||||||
if (h > height) height = h
|
if (h > height) height = h
|
||||||
}
|
}
|
||||||
if (height != 0) {
|
if (height != 0) {
|
||||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) + (rootWindowInsets?.systemWindowInsetBottom ?: 0)
|
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
||||||
}
|
}
|
||||||
if (maxHeight < height) {
|
if (maxHeight < height + (rootWindowInsets?.systemWindowInsetBottom ?: 0)) {
|
||||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST) + (rootWindowInsets?.systemWindowInsetBottom ?: 0)
|
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST)
|
||||||
}
|
}
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user