From e9261424c98be9212e4290ecb7207486d5bd0ced Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 9 Sep 2020 11:28:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E5=B1=8F=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 2 +- .../legado/app/ui/book/read/ReadBookActivityHelp.kt | 13 +++++++++---- .../app/ui/book/read/config/BgTextConfigDialog.kt | 6 ++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 22cf977c3..7840123db 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -695,7 +695,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo * 更新状态栏,导航栏 */ override fun upSystemUiVisibility() { - ReadBookActivityHelp.upSystemUiVisibility(window, !read_menu.isVisible) + ReadBookActivityHelp.upSystemUiVisibility(window, isInMultiWindow, !read_menu.isVisible) upNavigationBarColor() } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt index 558975cba..5360e08e6 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt @@ -32,15 +32,20 @@ import org.jetbrains.anko.layoutInflater object ReadBookActivityHelp { - /** * 更新状态栏,导航栏 */ - fun upSystemUiVisibility(window: Window, toolBarHide: Boolean = true) { - var flag = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - or View.SYSTEM_UI_FLAG_LAYOUT_STABLE + fun upSystemUiVisibility( + window: Window, + isInMultiWindow: Boolean, + toolBarHide: Boolean = true + ) { + var flag = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) + if (!isInMultiWindow) { + flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + } if (ReadBookConfig.hideNavigationBar) { flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt index f785d522c..12ead916b 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt @@ -31,7 +31,7 @@ import io.legado.app.lib.dialogs.okButton import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.lib.theme.getSecondaryTextColor -import io.legado.app.ui.book.read.ReadBookActivityHelp +import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.filechooser.FileChooserDialog import io.legado.app.ui.filechooser.FilePicker import io.legado.app.ui.widget.text.AutoCompleteTextView @@ -129,9 +129,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { sw_dark_status_icon.onCheckedChange { buttonView, isChecked -> if (buttonView?.isPressed == true) { setStatusIconDark(isChecked) - activity?.window?.let { - ReadBookActivityHelp.upSystemUiVisibility(it) - } + (activity as? ReadBookActivity)?.upSystemUiVisibility() } } tv_text_color.onClick {