From b9a7411cdb3a661018c06389d679005932b1b2ec Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Sun, 5 Sep 2021 15:00:16 +0200 Subject: [PATCH] Remove some other deprecation warnings --- .../droidfs/widgets/ColoredAlertDialogBuilder.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredAlertDialogBuilder.kt b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredAlertDialogBuilder.kt index 0f17156..2816b42 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredAlertDialogBuilder.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/widgets/ColoredAlertDialogBuilder.kt @@ -1,9 +1,10 @@ package sushi.hardcore.droidfs.widgets -import androidx.appcompat.app.AlertDialog import android.content.Context -import android.view.View import android.view.WindowManager +import androidx.appcompat.app.AlertDialog +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.WindowInsetsControllerCompat class ColoredAlertDialogBuilder: AlertDialog.Builder { constructor(context: Context): super(context) @@ -29,8 +30,11 @@ class ColoredAlertDialogBuilder: AlertDialog.Builder { val dialog = create() dialog.show() if (keepFullScreen){ - dialog.window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN - dialog.window?.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) + dialog.window?.let { + WindowInsetsControllerCompat(it, it.decorView) + .hide(WindowInsetsCompat.Type.statusBars()) + it.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) + } } return dialog }