mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Default theme to follow system instead of light
Also remove deprecated Auto option
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user