fix default value for colorful chat bubbles

This commit is contained in:
Daniel Gultsch 2024-04-12 09:34:52 +02:00
parent eadff422c9
commit b62f244c63
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
3 changed files with 11 additions and 7 deletions

View file

@ -39,8 +39,8 @@ public class AppSettings {
public static final String SHOW_CONNECTION_OPTIONS = "show_connection_options";
public static final String USE_TOR = "use_tor";
public static final String CHANNEL_DISCOVERY_METHOD = "channel_discovery_method";
public static final String SEND_CRASH_REPORTS = "send_crash_reports";
public static final String COLORFUL_CHAT_BUBBLES = "use_green_background";
private final Context context;
@ -93,6 +93,10 @@ public class AppSettings {
return getBooleanPreference(ALLOW_SCREENSHOTS, R.bool.allow_screenshots);
}
public boolean isColorfulChatBubbles() {
return getBooleanPreference(COLORFUL_CHAT_BUBBLES, R.bool.use_green_background);
}
public boolean isUseTor() {
return getBooleanPreference(USE_TOR, R.bool.use_tor);
}

View file

@ -3,12 +3,10 @@ package eu.siacs.conversations.ui.adapter;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Typeface;
import android.os.Build;
import android.preference.PreferenceManager;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
@ -45,6 +43,7 @@ import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import eu.siacs.conversations.AppSettings;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
@ -95,7 +94,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
private final DisplayMetrics metrics;
private OnContactPictureClicked mOnContactPictureClickedListener;
private OnContactPictureLongClicked mOnContactPictureLongClickedListener;
private boolean mUseGreenBackground = false;
private boolean colorfulChatBubbles = false;
private final boolean mForceNames;
public MessageAdapter(final XmppActivity activity, final List<Message> messages, final boolean forceNames) {
@ -653,7 +652,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
}
final boolean colorfulBackground = mUseGreenBackground;
final boolean colorfulBackground = this.colorfulChatBubbles;
final BubbleColor bubbleColor;
if (type == RECEIVED) {
if (isInValidSession) {
@ -887,8 +886,8 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
public void updatePreferences() {
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(activity);
this.mUseGreenBackground = p.getBoolean("use_green_background", activity.getResources().getBoolean(R.bool.use_green_background));
final AppSettings appSettings = new AppSettings(activity);
this.colorfulChatBubbles = appSettings.isColorfulChatBubbles();
}

View file

@ -16,6 +16,7 @@
android:title="@string/pref_light_dark_mode"
app:useSimpleSummaryProvider="true" />
<SwitchPreferenceCompat
android:defaultValue="@bool/use_green_background"
android:icon="@drawable/ic_forum_24dp"
android:key="use_green_background"
android:summary="@string/pref_use_colorful_bubbles_summary"