From a189ac22ce9bc9cf021fbc9cbc260e7e461c89f5 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Mon, 29 Nov 2021 21:29:44 +0100 Subject: [PATCH] Prevent white on white status bar on Android 5 --- .../java/protect/card_locker/LoyaltyCardViewActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index d7b1b7335..44ceb96e4 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -48,6 +48,7 @@ import androidx.appcompat.widget.Toolbar; import androidx.constraintlayout.widget.Guideline; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; +import androidx.core.graphics.ColorUtils; import androidx.core.graphics.drawable.DrawableCompat; import androidx.core.widget.NestedScrollView; import androidx.core.widget.TextViewCompat; @@ -583,8 +584,11 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements // Make notification area light if dark icons are needed if (Build.VERSION.SDK_INT >= 23) { window.getDecorView().setSystemUiVisibility(backgroundNeedsDarkIcons ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0); + window.setStatusBarColor(Color.TRANSPARENT); + } else { + // Darken statusbar if icons won't be visible otherwise + window.setStatusBarColor(backgroundNeedsDarkIcons ? ColorUtils.blendARGB(backgroundHeaderColor, Color.BLACK, 0.15f) : Color.TRANSPARENT); } - window.setStatusBarColor(Color.TRANSPARENT); // Set shadow colour of store text so even same color on same color would be readable storeName.setShadowLayer(1, 1, 1, backgroundNeedsDarkIcons ? Color.BLACK : Color.WHITE);