Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Oct 30, 2024
1 parent 003ffeb commit 58ec6e8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/legado/app/utils/ViewExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 58ec6e8

Please sign in to comment.