From b9b1d8c5786b54dc8d62a18bef5375773207db26 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Thu, 19 Dec 2024 14:57:03 +0000 Subject: [PATCH 1/3] Ignore theme setting in ThemeUtils --- .../org/odk/collect/android/mainmenu/MainMenuActivity.kt | 4 +--- .../java/org/odk/collect/android/utilities/ThemeUtils.java | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt b/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt index 6c7cb340004..f4e16f9eacc 100644 --- a/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt +++ b/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt @@ -58,9 +58,7 @@ class MainMenuActivity : LocalizedActivity() { val viewModelProvider = ViewModelProvider(this, viewModelFactory) currentProjectViewModel = viewModelProvider[CurrentProjectViewModel::class.java] - if (!FeatureFlags.NO_THEME_SETTING) { - ThemeUtils(this).setDarkModeForCurrentProject() - } + ThemeUtils(this).setDarkModeForCurrentProject() if (!currentProjectViewModel.hasCurrentProject()) { super.onCreate(null) diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java b/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java index d2fea99c703..dbe2fa57dc4 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java @@ -29,6 +29,7 @@ import androidx.appcompat.app.AppCompatDelegate; import org.odk.collect.android.R; +import org.odk.collect.android.application.FeatureFlags; import org.odk.collect.android.injection.DaggerUtils; import org.odk.collect.settings.SettingsProvider; import org.odk.collect.settings.keys.ProjectKeys; @@ -89,7 +90,11 @@ public int getAccountPickerTheme() { } public boolean isSystemTheme() { - return getPrefsTheme().equals(context.getString(org.odk.collect.strings.R.string.app_theme_system)); + if (FeatureFlags.NO_THEME_SETTING) { + return true; + } else { + return getPrefsTheme().equals(context.getString(org.odk.collect.strings.R.string.app_theme_system)); + } } public boolean isDarkTheme() { From 6d51fa01b1da5415dcdf90bc66a900880d39d6f6 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Thu, 19 Dec 2024 15:00:22 +0000 Subject: [PATCH 2/3] Remove unused method --- .../java/org/odk/collect/android/utilities/ThemeUtils.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java b/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java index dbe2fa57dc4..d62ba39383b 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/ThemeUtils.java @@ -85,10 +85,6 @@ public int getSpinnerTimePickerDialogTheme() { R.style.Theme_Collect_Light_Spinner_TimePicker_Dialog; } - public int getAccountPickerTheme() { - return isDarkTheme() ? 0 : 1; - } - public boolean isSystemTheme() { if (FeatureFlags.NO_THEME_SETTING) { return true; From 0d67890a71de3bd5399551e14056320c7c7f7c12 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Thu, 19 Dec 2024 16:01:54 +0000 Subject: [PATCH 3/3] Optimize imports --- .../java/org/odk/collect/android/mainmenu/MainMenuActivity.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt b/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt index f4e16f9eacc..b1807ad3e7b 100644 --- a/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt +++ b/collect_app/src/main/java/org/odk/collect/android/mainmenu/MainMenuActivity.kt @@ -8,7 +8,6 @@ import org.odk.collect.android.R import org.odk.collect.android.activities.ActivityUtils import org.odk.collect.android.activities.CrashHandlerActivity import org.odk.collect.android.activities.FirstLaunchActivity -import org.odk.collect.android.application.FeatureFlags import org.odk.collect.android.injection.DaggerUtils import org.odk.collect.android.projects.ProjectSettingsDialog import org.odk.collect.android.utilities.ThemeUtils