package com.multiplemodals.extensions import android.os.Build import android.view.View import android.view.Window import android.view.WindowInsetsController @Suppress("DEPRECATION") fun Window.setStatusBarDarkIcons(dark: Boolean) { when { Build.VERSION_CODES.R <= Build.VERSION.SDK_INT -> insetsController?.setSystemBarsAppearance( if (dark) WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS else 0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS ) else -> decorView.systemUiVisibility = if (dark) { decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR } else { decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() } } }