pull/464/head
Robot 4 years ago
commit 6f197a5009
  1. 3
      app/src/main/java/io/legado/app/lib/theme/ATH.kt
  2. 45
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt

@ -45,9 +45,8 @@ object ATH {
fun fullScreen(activity: Activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
activity.window.setDecorFitsSystemWindows(true)
} else {
fullScreenO(activity)
}
fullScreenO(activity)
activity.window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
}

@ -5,10 +5,7 @@ import android.app.Activity
import android.content.Context
import android.content.pm.ActivityInfo
import android.os.Build
import android.view.LayoutInflater
import android.view.View
import android.view.Window
import android.view.WindowManager
import android.view.*
import android.widget.EditText
import io.legado.app.App
import io.legado.app.R
@ -41,6 +38,38 @@ object ReadBookActivityHelp {
activity: Activity,
isInMultiWindow: Boolean,
toolBarHide: Boolean = true
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
activity.window.insetsController?.let {
if (toolBarHide) {
if (ReadBookConfig.hideStatusBar) {
it.hide(WindowInsets.Type.statusBars())
}
if (ReadBookConfig.hideNavigationBar) {
it.hide(WindowInsets.Type.navigationBars())
}
} else {
it.show(WindowInsets.Type.statusBars())
it.show(WindowInsets.Type.navigationBars())
}
}
}
upSystemUiVisibilityO(activity, isInMultiWindow, toolBarHide)
if (toolBarHide) {
ATH.setLightStatusBar(activity, ReadBookConfig.durConfig.curStatusIconDark())
} else {
ATH.setLightStatusBarAuto(
activity,
ThemeStore.statusBarColor(activity, AppConfig.isTransparentStatusBar)
)
}
}
@Suppress("DEPRECATION")
private fun upSystemUiVisibilityO(
activity: Activity,
isInMultiWindow: Boolean,
toolBarHide: Boolean = true
) {
var flag = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_IMMERSIVE
@ -60,14 +89,6 @@ object ReadBookActivityHelp {
}
}
activity.window.decorView.systemUiVisibility = flag
if (toolBarHide) {
ATH.setLightStatusBar(activity, ReadBookConfig.durConfig.curStatusIconDark())
} else {
ATH.setLightStatusBarAuto(
activity,
ThemeStore.statusBarColor(activity, AppConfig.isTransparentStatusBar)
)
}
}
/**

Loading…
Cancel
Save