2022-05-12 13:23:55 +02:00
|
|
|
package app.grapheneos.pdfviewer.ktx
|
|
|
|
|
|
|
|
import android.view.View
|
2022-10-02 15:12:24 +02:00
|
|
|
import android.view.Window
|
|
|
|
import androidx.core.view.WindowCompat
|
2022-05-12 13:23:55 +02:00
|
|
|
import androidx.core.view.WindowInsetsCompat
|
|
|
|
import androidx.core.view.WindowInsetsControllerCompat
|
|
|
|
|
|
|
|
private val systemBars = WindowInsetsCompat.Type.statusBars()
|
|
|
|
|
2022-10-02 15:12:24 +02:00
|
|
|
fun View.hideSystemUi(window: Window) {
|
|
|
|
val controller = WindowCompat.getInsetsController(window, this)
|
2022-05-12 13:23:55 +02:00
|
|
|
controller.systemBarsBehavior =
|
|
|
|
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
|
|
|
controller.hide(systemBars)
|
|
|
|
}
|
|
|
|
|
2022-10-02 15:12:24 +02:00
|
|
|
fun View.showSystemUi(window: Window) {
|
|
|
|
WindowCompat.getInsetsController(window, this).show(systemBars)
|
2022-05-12 13:23:55 +02:00
|
|
|
}
|