主界面状态栏隐藏 #176

This commit is contained in:
HapeLee
2025-10-30 20:28:14 +08:00
parent 6874615939
commit 5d3f86de5f
8 changed files with 29 additions and 2 deletions
@@ -36,6 +36,7 @@ object PreferKey {
const val showDiscovery = "showDiscovery" const val showDiscovery = "showDiscovery"
const val enableReview = "enableReview" const val enableReview = "enableReview"
const val showRss = "showRss" const val showRss = "showRss"
const val showStatusBar = "showStatusBar"
const val bookshelfLayout = "bookshelfLayout" const val bookshelfLayout = "bookshelfLayout"
const val bookshelfLayoutModePortrait = "bookshelfLayoutPortrait" const val bookshelfLayoutModePortrait = "bookshelfLayoutPortrait"
const val bookshelfLayoutModeLandscape = "bookshelf_layout_landscape" const val bookshelfLayoutModeLandscape = "bookshelf_layout_landscape"
@@ -282,6 +282,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val showRSS: Boolean val showRSS: Boolean
get() = appCtx.getPrefBoolean(PreferKey.showRss, true) get() = appCtx.getPrefBoolean(PreferKey.showRss, true)
val showStatusBar: Boolean
get() = appCtx.getPrefBoolean(PreferKey.showStatusBar, true)
val showBottomView: Boolean val showBottomView: Boolean
get() = appCtx.getPrefBoolean(PreferKey.showBottomView, true) get() = appCtx.getPrefBoolean(PreferKey.showBottomView, true)
@@ -222,7 +222,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
PreferKey.colorImage -> handleRestartRequired() PreferKey.colorImage -> handleRestartRequired()
PreferKey.showDiscovery, PreferKey.showRss, PreferKey.showDiscovery, PreferKey.showRss,
PreferKey.showBottomView, PreferKey.tabletInterface, PreferKey.showStatusBar, PreferKey.showBottomView, PreferKey.tabletInterface,
PreferKey.labelVisibilityMode -> postEvent(EventBus.NOTIFY_MAIN, true) PreferKey.labelVisibilityMode -> postEvent(EventBus.NOTIFY_MAIN, true)
} }
@@ -9,11 +9,14 @@ import android.text.format.DateUtils
import android.view.Gravity import android.view.Gravity
import android.view.MenuItem import android.view.MenuItem
import android.view.MotionEvent import android.view.MotionEvent
import android.view.WindowInsets
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.get import androidx.core.view.get
import androidx.core.view.postDelayed import androidx.core.view.postDelayed
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
@@ -21,6 +24,7 @@ import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.viewpager2.adapter.FragmentStateAdapter import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2
import cn.hutool.core.util.IdcardUtil.hide
import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.bottomnavigation.LabelVisibilityMode import com.google.android.material.bottomnavigation.LabelVisibilityMode
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
@@ -37,6 +41,7 @@ import io.legado.app.help.AppWebDav
import io.legado.app.help.book.BookHelp import io.legado.app.help.book.BookHelp
import io.legado.app.help.config.AppConfig import io.legado.app.help.config.AppConfig
import io.legado.app.help.config.LocalConfig import io.legado.app.help.config.LocalConfig
import io.legado.app.help.config.ReadBookConfig
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.storage.Backup import io.legado.app.help.storage.Backup
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
@@ -61,6 +66,7 @@ import io.legado.app.utils.shouldHideSoftInput
import io.legado.app.utils.showDialogFragment import io.legado.app.utils.showDialogFragment
import io.legado.app.utils.startActivity import io.legado.app.utils.startActivity
import io.legado.app.utils.themeColor import io.legado.app.utils.themeColor
import io.legado.app.utils.toggleSystemBar
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.visible import io.legado.app.utils.visible
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
@@ -119,7 +125,7 @@ open class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen() installSplashScreen()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
toggleSystemBar(AppConfig.showStatusBar)
if (checkStartupRoute()) return if (checkStartupRoute()) return
setExitSharedElementCallback(MaterialContainerTransformSharedElementCallback()) setExitSharedElementCallback(MaterialContainerTransformSharedElementCallback())
@@ -135,6 +141,11 @@ open class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
bindNavigationListener() bindNavigationListener()
} }
override fun onResume() {
super.onResume()
toggleSystemBar(AppConfig.showStatusBar)
}
override fun dispatchTouchEvent(ev: MotionEvent): Boolean { override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
if (ev.action == MotionEvent.ACTION_DOWN) { if (ev.action == MotionEvent.ACTION_DOWN) {
currentFocus?.let { currentFocus?.let {
@@ -22,6 +22,8 @@
android:id="@+id/tv_count" android:id="@+id/tv_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:includeFontPadding="false"
android:gravity="top"
android:textColor="?attr/colorSecondary" android:textColor="?attr/colorSecondary"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
@@ -30,6 +32,8 @@
android:id="@+id/tv_count_all" android:id="@+id/tv_count_all"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:includeFontPadding="false"
android:gravity="bottom"
android:textSize="12sp" android:textSize="12sp"
android:textStyle="bold" /> android:textStyle="bold" />
+1
View File
@@ -1320,4 +1320,5 @@
<string name="redirect_block_cross_origin">阻止跨域名重定向</string> <string name="redirect_block_cross_origin">阻止跨域名重定向</string>
<string name="redirect_block_all">阻止所有重定向</string> <string name="redirect_block_all">阻止所有重定向</string>
<string name="redirect_ask_same_domain_block_cross">域内询问且域外阻止</string> <string name="redirect_ask_same_domain_block_cross">域内询问且域外阻止</string>
<string name="show_status">显示状态栏</string>
</resources> </resources>
+1
View File
@@ -1321,4 +1321,5 @@
<string name="redirect_block_cross_origin">阻止跨域名重定向</string> <string name="redirect_block_cross_origin">阻止跨域名重定向</string>
<string name="redirect_block_all">阻止所有重定向</string> <string name="redirect_block_all">阻止所有重定向</string>
<string name="redirect_ask_same_domain_block_cross">域内询问且域外阻止</string> <string name="redirect_ask_same_domain_block_cross">域内询问且域外阻止</string>
<string name="show_status">显示状态栏</string>
</resources> </resources>
@@ -100,6 +100,12 @@
android:title="@string/show_rss" android:title="@string/show_rss"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="true"
android:key="showStatusBar"
android:title="@string/show_status"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.SwitchPreference <io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="showBottomView" android:key="showBottomView"