From bd888d0c377b7fef3c849122bf2b035753abb859 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 17 Oct 2021 11:14:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/base/BaseActivity.kt | 2 +- .../io/legado/app/utils/ActivityExtensions.kt | 28 +++++++------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index bb55a57c8..238dc23d2 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -157,7 +157,7 @@ abstract class BaseActivity( private fun setupSystemBar() { if (fullScreen && !isInMultiWindow) { - fullScreen(true) + fullScreen() } val isTransparentStatusBar = AppConfig.isTransparentStatusBar val statusBarColor = ThemeStore.statusBarColor(this, isTransparentStatusBar) diff --git a/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt b/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt index 95ddd578d..9a0fe2355 100644 --- a/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt @@ -42,27 +42,19 @@ val Activity.windowSize: DisplayMetrics return displayMetrics } -fun Activity.fullScreen(fullScreen: Boolean) { +fun Activity.fullScreen() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - window.setDecorFitsSystemWindows(fullScreen) + window.setDecorFitsSystemWindows(true) } @Suppress("DEPRECATION") - if (fullScreen) { - window.decorView.systemUiVisibility = - View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE - window.clearFlags( - WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS - or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION - ) - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } else { - window.decorView.systemUiVisibility = 0 - window.addFlags( - WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS - or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION - ) - window.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } + window.decorView.systemUiVisibility = + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE + @Suppress("DEPRECATION") + window.clearFlags( + WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS + or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION + ) + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) } /**