|
|
@ -42,27 +42,19 @@ val Activity.windowSize: DisplayMetrics |
|
|
|
return displayMetrics |
|
|
|
return displayMetrics |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun Activity.fullScreen(fullScreen: Boolean) { |
|
|
|
fun Activity.fullScreen() { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { |
|
|
|
window.setDecorFitsSystemWindows(fullScreen) |
|
|
|
window.setDecorFitsSystemWindows(true) |
|
|
|
} |
|
|
|
} |
|
|
|
@Suppress("DEPRECATION") |
|
|
|
@Suppress("DEPRECATION") |
|
|
|
if (fullScreen) { |
|
|
|
window.decorView.systemUiVisibility = |
|
|
|
window.decorView.systemUiVisibility = |
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
|
@Suppress("DEPRECATION") |
|
|
|
window.clearFlags( |
|
|
|
window.clearFlags( |
|
|
|
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS |
|
|
|
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS |
|
|
|
or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION |
|
|
|
or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION |
|
|
|
) |
|
|
|
) |
|
|
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) |
|
|
|
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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|