diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index 11480d669..c52c79c38 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -3,6 +3,6 @@ package io.legado.app.constant object PreferKey { const val downloadPath = "downloadPath" - - + const val hideStatusBar = "hideStatusBar" + const val hideNavigationBar = "hideNavigationBar" } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/Help.kt b/app/src/main/java/io/legado/app/ui/book/read/Help.kt index 1ff72d7dc..f522df279 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/Help.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/Help.kt @@ -5,6 +5,7 @@ import android.view.View import android.view.View.NO_ID import android.view.ViewGroup import io.legado.app.App +import io.legado.app.constant.PreferKey import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ThemeStore @@ -21,12 +22,12 @@ object Help { or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) - val hideNavigationBar = App.INSTANCE.getPrefBoolean("hideNavigationBar") + val hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar) if (hideNavigationBar) { flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION } if (toolBarHide) { - if (App.INSTANCE.getPrefBoolean("hideStatusBar")) { + if (App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar)) { flag = flag or View.SYSTEM_UI_FLAG_FULLSCREEN } if (hideNavigationBar) { 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 0aa08497c..4504f1dee 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 @@ -11,6 +11,7 @@ import androidx.core.view.isVisible import io.legado.app.App import io.legado.app.R import io.legado.app.constant.Bus +import io.legado.app.constant.PreferKey import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.buttonDisabledColor import io.legado.app.utils.* @@ -197,7 +198,7 @@ class ReadMenu : FrameLayout { vw_menu_bg.onClick { runMenuOut() } vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply { height = - if (context.getPrefBoolean("hideNavigationBar") + if (context.getPrefBoolean(PreferKey.hideStatusBar) && Help.isNavigationBarExist(activity) ) context.getNavigationBarHeight() else 0 diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt index 4a869a1ed..1175f3293 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt @@ -12,6 +12,7 @@ import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceFragmentCompat import io.legado.app.R import io.legado.app.constant.Bus +import io.legado.app.constant.PreferKey import io.legado.app.lib.theme.ATH import io.legado.app.ui.book.read.Help import io.legado.app.utils.postEvent @@ -91,8 +92,8 @@ class MoreConfigDialog : DialogFragment() { key: String? ) { when (key) { - "hideStatusBar" -> postEvent(Bus.UP_CONFIG, true) - "hideNavigationBar" -> postEvent(Bus.UP_CONFIG, true) + PreferKey.hideStatusBar -> postEvent(Bus.UP_CONFIG, true) + PreferKey.hideNavigationBar -> postEvent(Bus.UP_CONFIG, true) } } diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt index 228e6f2e9..15f3c5127 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt @@ -10,6 +10,7 @@ import android.widget.ImageView import androidx.appcompat.widget.AppCompatImageView import io.legado.app.R import io.legado.app.constant.AppConst.TIME_FORMAT +import io.legado.app.constant.PreferKey import io.legado.app.help.ReadBookConfig import io.legado.app.utils.* import kotlinx.android.synthetic.main.view_book_page.view.* @@ -58,7 +59,7 @@ class ContentView : FrameLayout { fun upStyle() { ReadBookConfig.getConfig().apply { - val pt = if (context.getPrefBoolean("hideStatusBar", false)) { + val pt = if (context.getPrefBoolean(PreferKey.hideStatusBar, false)) { top_bar.visible() 0 } else {