app: use static variables to refer to config settings

This commit is contained in:
Daniel Gultsch 2024-04-15 18:49:27 +02:00
parent 97eb7d4e48
commit ee57ba7fba
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
2 changed files with 3 additions and 2 deletions

View file

@ -21,6 +21,7 @@ public class AppSettings {
public static final String AUTOMATIC_MESSAGE_DELETION = "automatic_message_deletion";
public static final String BROADCAST_LAST_ACTIVITY = "last_activity";
public static final String THEME = "theme";
public static final String DYNAMIC_COLORS = "dynamic_colors";
public static final String SHOW_DYNAMIC_TAGS = "show_dynamic_tags";
public static final String OMEMO = "omemo";
public static final String ALLOW_SCREENSHOTS = "allow_screenshots";

View file

@ -48,13 +48,13 @@ public class Conversations extends Application {
public static boolean isDynamicColorsDesired(final Context context) {
final var preferences = PreferenceManager.getDefaultSharedPreferences(context);
return preferences.getBoolean("dynamic_colors", false);
return preferences.getBoolean(AppSettings.DYNAMIC_COLORS, false);
}
private static int getDesiredNightMode(
final Context context, final SharedPreferences sharedPreferences) {
final String theme =
sharedPreferences.getString("theme", context.getString(R.string.theme));
sharedPreferences.getString(AppSettings.THEME, context.getString(R.string.theme));
return getDesiredNightMode(theme);
}