From 9500ba52fd69b4e224d438ce1829d0ca52620aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Mon, 23 Sep 2019 21:53:04 +0200 Subject: [PATCH] [UI] Fix status bar icon color in light theme, color&date picker dialogs crashing the app. --- .../main/java/pl/szczodrzynski/edziennik/MainActivity.kt | 9 +++++++++ app/src/main/res/values/styles.xml | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt index 5d7bbd7c..62fe8cd9 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt @@ -30,6 +30,7 @@ import pl.szczodrzynski.navlib.drawer.items.DrawerPrimaryItem import pl.szczodrzynski.navlib.drawer.items.withAppTitle import pl.szczodrzynski.navlib.getColorFromAttr import androidx.appcompat.widget.PopupMenu +import androidx.core.graphics.ColorUtils import androidx.navigation.NavOptions import com.danimahardhika.cafebar.CafeBar import com.mikepenz.iconics.IconicsColor @@ -239,6 +240,14 @@ class MainActivity : AppCompatActivity() { b.navView.configSystemBarsUtil(this) + // fix for setting status bar color to window color, outside of navlib + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + window.statusBarColor = statusBarColor + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ColorUtils.calculateLuminance(statusBarColor) > 0.6) { + window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + } + // TODO fix navlib navbar detection, orientation change issues, status bar color setting if not fullscreen commit() diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index cdd0abb1..116c7a40 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -95,8 +95,6 @@ ?android:textColorSecondary ?colorSurface @color/dividerColor - - ?android:windowBackground