feat: 优化代码

pull/105/head
kunfei 5 years ago
parent 3c67886269
commit dbce1a2be8
  1. 6
      app/src/main/java/io/legado/app/ui/book/read/Help.kt

@ -20,6 +20,9 @@ object Help {
private const val NAVIGATION = "navigationBarBackground" private const val NAVIGATION = "navigationBarBackground"
/**
* 更新状态栏,导航栏
*/
fun upSystemUiVisibility(activity: Activity, toolBarHide: Boolean = true) { fun upSystemUiVisibility(activity: Activity, toolBarHide: Boolean = true) {
var flag = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN var flag = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
@ -70,6 +73,9 @@ object Help {
return false return false
} }
/**
* 保持亮屏
*/
fun keepScreenOn(window: Window, on: Boolean) { fun keepScreenOn(window: Window, on: Boolean) {
if (on) { if (on) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

Loading…
Cancel
Save