replace deprecated api uses

This commit is contained in:
Pratyush 2022-10-02 18:42:24 +05:30 committed by Daniel Micay
parent 7ff831769e
commit 5fadf7f47d
2 changed files with 8 additions and 7 deletions

View File

@ -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();
}

View File

@ -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)
}