diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index 49cc8149d..a171f0273 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -22,12 +22,13 @@ import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.backgroundColor +import io.legado.app.lib.theme.bottomBackground import io.legado.app.model.CacheBook import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.config.BgTextConfigDialog import io.legado.app.ui.book.read.config.ClickActionConfigDialog import io.legado.app.ui.book.read.config.PaddingConfigDialog -import io.legado.app.utils.getPrefString +import io.legado.app.utils.* import io.legado.app.utils.viewbindingdelegate.viewBinding /** @@ -48,6 +49,7 @@ abstract class ReadBookBaseActivity : } override fun onActivityCreated(savedInstanceState: Bundle?) { + binding.navigationBar.setBackgroundColor(bottomBackground) if (!LocalConfig.readHelpVersionIsLast) { showClickRegionalConfig() } @@ -86,16 +88,16 @@ abstract class ReadBookBaseActivity : toolBarHide: Boolean = true ) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - window.insetsController?.let { - if (ReadBookConfig.hideNavigationBar) { - it.hide(WindowInsets.Type.navigationBars()) + window.insetsController?.run { + if (toolBarHide && ReadBookConfig.hideNavigationBar) { + hide(WindowInsets.Type.navigationBars()) } else { - it.show(WindowInsets.Type.navigationBars()) + show(WindowInsets.Type.navigationBars()) } if (toolBarHide && ReadBookConfig.hideStatusBar) { - it.hide(WindowInsets.Type.statusBars()) + hide(WindowInsets.Type.statusBars()) } else { - it.show(WindowInsets.Type.statusBars()) + show(WindowInsets.Type.statusBars()) } } } @@ -134,6 +136,7 @@ abstract class ReadBookBaseActivity : } override fun upNavigationBarColor() { + upNavigationBar() when { binding.readMenu.isVisible -> super.upNavigationBarColor() bottomDialog > 0 -> super.upNavigationBarColor() @@ -141,6 +144,23 @@ abstract class ReadBookBaseActivity : } } + private fun upNavigationBar() { + binding.navigationBar.run { + if (bottomDialog > 0 || binding.readMenu.isVisible) { + layoutParams = layoutParams.apply { + height = if (ReadBookConfig.hideNavigationBar) { + activity?.navigationBarHeight ?: 0 + } else { + 0 + } + } + visible() + } else { + gone() + } + } + } + /** * 保持亮屏 */ diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index d51dfd9fc..0f9c95283 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -63,6 +63,7 @@ class ReadMenu @JvmOverloads constructor( brightnessBackground.setColor(ColorUtils.adjustAlpha(bgColor, 0.5f)) llBrightness.background = brightnessBackground llBottomBg.setBackgroundColor(bgColor) + vwNavigationBar.setBackgroundColor(bgColor) fabSearch.backgroundTintList = bottomBackgroundList fabSearch.setColorFilter(textColor) fabAutoPage.backgroundTintList = bottomBackgroundList diff --git a/app/src/main/res/layout/activity_book_read.xml b/app/src/main/res/layout/activity_book_read.xml index d41de23f7..235c04b87 100644 --- a/app/src/main/res/layout/activity_book_read.xml +++ b/app/src/main/res/layout/activity_book_read.xml @@ -37,4 +37,11 @@ android:layout_height="match_parent" android:visibility="gone" /> + + \ No newline at end of file