From fefd08767c3bf03b735693cfa64c898f57e4aa83 Mon Sep 17 00:00:00 2001
From: ivk <ivk@tutao.de>
Date: Tue, 30 Jul 2024 16:05:06 +0200
Subject: [PATCH] [android] Fix status bar color when switching to dark mode

Co-authored-by: jat <jat@tutao.de>
---
 .../java/de/tutao/tutanota/AndroidThemeFacade.kt   | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/app-android/app/src/main/java/de/tutao/tutanota/AndroidThemeFacade.kt b/app-android/app/src/main/java/de/tutao/tutanota/AndroidThemeFacade.kt
index d11404b3e47..e42578bbd0e 100644
--- a/app-android/app/src/main/java/de/tutao/tutanota/AndroidThemeFacade.kt
+++ b/app-android/app/src/main/java/de/tutao/tutanota/AndroidThemeFacade.kt
@@ -113,24 +113,14 @@ class AndroidThemeFacade(
 
 		val windowInsetController = WindowInsetsControllerCompat(activity.window, activity.window.decorView)
 
-		if (isNavBarLight) {
-			windowInsetController.isAppearanceLightNavigationBars = true
-		}
+		windowInsetController.isAppearanceLightNavigationBars = isNavBarLight
 
 		val headerBg = getColor(theme, "navigation_bg")
 		@ColorInt val statusBarColor = parseColor(headerBg)
 		val isStatusBarLight = headerBg.isLightHexColor()
 
-		// Changing status bar color
-		// Before Android M there was no flag to use lightStatusBar (so that text is white or
-		// black). As our primary color is red, Android thinks that the status bar color text
-		// should be white. So we cannot use white status bar color.
-		// So for Android M and above we alternate between white and dark status bar colors and
-		// we change lightStatusBar flag accordingly.
 		activity.window.statusBarColor = statusBarColor
-		if (isStatusBarLight) {
-			windowInsetController.isAppearanceLightStatusBars = true
-		}
+		windowInsetController.isAppearanceLightStatusBars = isStatusBarLight
 	}
 
 	private fun getColor(theme: Map<String, String>, key: String): String =