replace deprecated api uses
This commit is contained in:
parent
7ff831769e
commit
5fadf7f47d
@ -569,12 +569,12 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
||||
}
|
||||
|
||||
private void showSystemUi() {
|
||||
ViewKt.showSystemUi(binding.getRoot());
|
||||
ViewKt.showSystemUi(binding.getRoot(), getWindow());
|
||||
getSupportActionBar().show();
|
||||
}
|
||||
|
||||
private void hideSystemUi() {
|
||||
ViewKt.hideSystemUi(binding.getRoot());
|
||||
ViewKt.hideSystemUi(binding.getRoot(), getWindow());
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,20 @@
|
||||
package app.grapheneos.pdfviewer.ktx
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.ViewCompat
|
||||
import android.view.Window
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
|
||||
private val systemBars = WindowInsetsCompat.Type.statusBars()
|
||||
|
||||
fun View.hideSystemUi() {
|
||||
val controller = ViewCompat.getWindowInsetsController(this) ?: return
|
||||
fun View.hideSystemUi(window: Window) {
|
||||
val controller = WindowCompat.getInsetsController(window, this)
|
||||
controller.systemBarsBehavior =
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
controller.hide(systemBars)
|
||||
}
|
||||
|
||||
fun View.showSystemUi() {
|
||||
ViewCompat.getWindowInsetsController(this)?.show(systemBars)
|
||||
fun View.showSystemUi(window: Window) {
|
||||
WindowCompat.getInsetsController(window, this).show(systemBars)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user