mirror of
https://github.com/gedoor/legado.git
synced 2025-01-08 11:47:32 +08:00
优化
This commit is contained in:
parent
003ffeb6c6
commit
58ec6e80c9
@ -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
|
||||
|
@ -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 }
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user