From 6074f4bfd1a3a9c2c9b7bf0ee360e31ccc832c95 Mon Sep 17 00:00:00 2001 From: Harry Bond Date: Tue, 4 Mar 2025 17:29:56 +0000 Subject: [PATCH] fix status bar colour Signed-off-by: Harry Bond --- android/app/src/main/java/app/organicmaps/MwmActivity.java | 3 ++- .../main/java/app/organicmaps/routing/TransitStepView.java | 3 ++- .../src/main/java/app/organicmaps/util/ThemeSwitcher.java | 6 +++--- .../app/src/main/java/app/organicmaps/util/ThemeUtils.java | 5 ----- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/android/app/src/main/java/app/organicmaps/MwmActivity.java b/android/app/src/main/java/app/organicmaps/MwmActivity.java index 083e0054ad..1ec9e882c5 100644 --- a/android/app/src/main/java/app/organicmaps/MwmActivity.java +++ b/android/app/src/main/java/app/organicmaps/MwmActivity.java @@ -566,8 +566,9 @@ public class MwmActivity extends BaseMwmFragmentActivity private void refreshLightStatusBar() { + int darkModeFlags = this.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; UiUtils.setLightStatusBar(this, !( - ThemeUtils.isNightTheme(this) + (darkModeFlags == Configuration.UI_MODE_NIGHT_YES) || RoutingController.get().isPlanning() || Framework.nativeGetChoosePositionMode() != Framework.ChoosePositionMode.NONE )); diff --git a/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java b/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java index 9f4a965c10..f24709beee 100644 --- a/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java +++ b/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java @@ -89,7 +89,8 @@ public class TransitStepView extends View implements MultilineLayoutManager.Sque { mDrawable = null; mText = info.getDistance() + " " + info.getDistanceUnits(); - mTextPaint.setColor(ThemeUtils.isDefaultTheme(getContext()) ? Color.BLACK : Color.WHITE); + //TODO @RedAuburn: set this with themed resource defs + //mTextPaint.setColor(ThemeUtils.isDefaultTheme(getContext()) ? Color.BLACK : Color.WHITE); } else { diff --git a/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java b/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java index 97bf8437ee..ffd94ea11e 100644 --- a/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java +++ b/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java @@ -59,9 +59,9 @@ public enum ThemeSwitcher */ private void setAndroidTheme(@NonNull String theme) { -// if (ThemeUtils.isSystemTheme(mContext, theme)) -// AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); - if (ThemeUtils.isNightTheme(mContext, theme)) + if (ThemeUtils.isSystemTheme(mContext, theme)) + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); + else if (ThemeUtils.isNightTheme(mContext, theme)) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); else if (ThemeUtils.isDefaultTheme(mContext, theme)) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); diff --git a/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java b/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java index d4ec7d4e43..43d47f7df6 100644 --- a/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java +++ b/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java @@ -44,11 +44,6 @@ public final class ThemeUtils return VALUE_BUFFER.resourceId; } - public static boolean isDefaultTheme(@NonNull Context context) - { - return isDefaultTheme(context, Config.getThemeSettings(context)); - } - public static boolean isDefaultTheme(@NonNull Context context, String theme) { String defaultTheme = context.getString(R.string.theme_default);