This commit is contained in:
Horis 2024-10-30 16:29:02 +08:00
parent 003ffeb6c6
commit 58ec6e80c9
5 changed files with 5 additions and 5 deletions

View File

@ -72,7 +72,7 @@ class BookInfoEditActivity :
private fun initView() {
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets ->
val typeMask = WindowInsetsCompat.Type.navigationBars() or WindowInsetsCompat.Type.ime()
val typeMask = WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime()
val insets = windowInsets.getInsets(typeMask)
binding.root.bottomPadding = insets.bottom
windowInsets

View File

@ -84,7 +84,7 @@ abstract class BaseReadBookActivity :
upLayoutInDisplayCutoutMode()
super.onCreate(savedInstanceState)
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars())
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
binding.navigationBar.run {
layoutParams = layoutParams.apply { height = insets.bottom }
}

View File

@ -200,7 +200,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
private fun initView() {
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets ->
val typeMask = WindowInsetsCompat.Type.navigationBars() or WindowInsetsCompat.Type.ime()
val typeMask = WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime()
val insets = windowInsets.getInsets(typeMask)
binding.root.bottomPadding = insets.bottom
windowInsets

View File

@ -272,7 +272,7 @@ fun View.applyStatusBarPadding(withInitialPadding: Boolean = false) {
fun View.applyNavigationBarPadding(withInitialPadding: Boolean = false) {
val initialPadding = if (withInitialPadding) bottomPadding else 0
ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsets ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars())
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
bottomPadding = initialPadding + insets.bottom
windowInsets
}

View File

@ -3,7 +3,7 @@ package io.legado.app.utils
import androidx.core.view.WindowInsetsCompat
val WindowInsetsCompat.navigationBarHeight
get() = getInsets(WindowInsetsCompat.Type.navigationBars()).bottom
get() = getInsets(WindowInsetsCompat.Type.systemBars()).bottom
val WindowInsetsCompat.imeHeight
get() = getInsets(WindowInsetsCompat.Type.ime()).bottom