Hide the status bar when hiding the controllers

This commit is contained in:
Bnyro 2023-01-20 18:49:53 +01:00
parent 3da6b0678a
commit fbf9c30e9a
2 changed files with 9 additions and 0 deletions

View File

@ -205,6 +205,7 @@ internal class CustomExoPlayerView(
// remove the callback to hide the controller
handler.removeCallbacks(hideControllerRunnable)
super.hideController()
(context as? MainActivity)?.windowHelper?.hideStatusBar()
}
override fun showController() {

View File

@ -46,4 +46,12 @@ class WindowHelper(private val activity: BaseActivity) {
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
}
fun hideStatusBar() = activity.apply {
WindowInsetsControllerCompat(window, window.decorView).hide(WindowInsetsCompat.Type.statusBars())
}
fun showStatusBar() = activity.apply {
WindowInsetsControllerCompat(window, window.decorView).show(WindowInsetsCompat.Type.statusBars())
}
}