Default theme to follow system instead of light

Also remove deprecated Auto option
This commit is contained in:
Torsten Grote
2024-05-10 11:03:20 -03:00
parent 8fa0866243
commit 424e022388
7 changed files with 8 additions and 17 deletions

View File

@@ -27,7 +27,7 @@ class BriarAccountManager extends AndroidAccountManager {
super.deleteAccount();
Localizer.reinitialize();
UiUtils.setTheme(appContext,
appContext.getString(R.string.pref_theme_light_value));
appContext.getString(R.string.pref_theme_system_value));
}
}
}

View File

@@ -33,6 +33,7 @@ import static java.util.logging.Level.FINE;
import static java.util.logging.Level.INFO;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.briar.android.TestingConstants.IS_DEBUG_BUILD;
import static org.briarproject.briar.android.settings.DisplayFragment.PREF_THEME;
public class BriarApplicationImpl extends Application
implements BriarApplication {
@@ -109,11 +110,11 @@ public class BriarApplicationImpl extends Application
}
private void setTheme(Context ctx, SharedPreferences prefs) {
String theme = prefs.getString("pref_key_theme", null);
String theme = prefs.getString(PREF_THEME, null);
if (theme == null) {
// set default value
theme = getString(R.string.pref_theme_light_value);
prefs.edit().putString("pref_key_theme", theme).apply();
theme = getString(R.string.pref_theme_system_value);
prefs.edit().putString(PREF_THEME, theme).apply();
}
// set theme
UiUtils.setTheme(ctx, theme);

View File

@@ -36,7 +36,7 @@ import static org.briarproject.briar.android.settings.SettingsActivity.EXTRA_THE
public class DisplayFragment extends PreferenceFragmentCompat {
public static final String PREF_LANGUAGE = "pref_key_language";
private static final String PREF_THEME = "pref_key_theme";
public static final String PREF_THEME = "pref_key_theme";
private static final Logger LOG =
getLogger(DisplayFragment.class.getName());

View File

@@ -92,7 +92,6 @@ import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN;
import static android.view.inputmethod.EditorInfo.IME_NULL;
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
import static android.widget.Toast.LENGTH_LONG;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_TIME;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
@@ -349,12 +348,7 @@ public class UiUtils {
} else if (theme
.equals(ctx.getString(R.string.pref_theme_dark_value))) {
setDefaultNightMode(MODE_NIGHT_YES);
} else if (theme
.equals(ctx.getString(R.string.pref_theme_auto_value))) {
// TODO remove AUTO-setting as it is deprecated
setDefaultNightMode(MODE_NIGHT_AUTO_TIME);
} else if (theme
.equals(ctx.getString(R.string.pref_theme_system_value))) {
} else {
setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
}
}

View File

@@ -63,17 +63,14 @@
<string-array name="pref_theme_entries">
<item>@string/pref_theme_light</item>
<item>@string/pref_theme_dark</item>
<item>@string/pref_theme_auto</item>
<item>@string/pref_theme_system</item>
</string-array>
<string name="pref_theme_light_value" translatable="false">light</string>
<string name="pref_theme_dark_value" translatable="false">dark</string>
<string name="pref_theme_auto_value" translatable="false">auto</string>
<string name="pref_theme_system_value" translatable="false">system</string>
<string-array name="pref_theme_values">
<item>@string/pref_theme_light_value</item>
<item>@string/pref_theme_dark_value</item>
<item>@string/pref_theme_auto_value</item>
<item>@string/pref_theme_system_value</item>
</string-array>

View File

@@ -543,7 +543,6 @@
<string name="pref_theme_title">Theme</string>
<string name="pref_theme_light">Light</string>
<string name="pref_theme_dark">Dark</string>
<string name="pref_theme_auto">Automatic (Daytime)</string>
<string name="pref_theme_system">System default</string>
<!-- Settings Connections -->

View File

@@ -13,7 +13,7 @@
tools:summary="System default" />
<ListPreference
android:defaultValue="@string/pref_theme_light_value"
android:defaultValue="@string/pref_theme_system_value"
android:entries="@array/pref_theme_entries"
android:entryValues="@array/pref_theme_values"
android:key="pref_key_theme"