diff --git a/src/main/java/eu/siacs/conversations/AppSettings.java b/src/main/java/eu/siacs/conversations/AppSettings.java index cb25a2335..132a2bab8 100644 --- a/src/main/java/eu/siacs/conversations/AppSettings.java +++ b/src/main/java/eu/siacs/conversations/AppSettings.java @@ -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); } diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 38a78df68..fbb38d5d8 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -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 { 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 messages, final boolean forceNames) { @@ -653,7 +652,7 @@ public class MessageAdapter extends ArrayAdapter { } } - 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 { } 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(); } diff --git a/src/main/res/xml/preferences_interface.xml b/src/main/res/xml/preferences_interface.xml index 390e1e591..a71dcaf08 100644 --- a/src/main/res/xml/preferences_interface.xml +++ b/src/main/res/xml/preferences_interface.xml @@ -16,6 +16,7 @@ android:title="@string/pref_light_dark_mode" app:useSimpleSummaryProvider="true" />