aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-04-13 20:49:20 +0200
committerChristian Schneppe <christian@pix-art.de>2017-04-13 20:49:20 +0200
commitd25353ad3ec4b30356af6b47bfc95217b7a56613 (patch)
treedcc303f3499cd4722efbf683c0adcf0d1593cb77
parent678141e1bb78388fe52a6d7aad31c231a884c117 (diff)
make contacts status color configurable
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java12
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java9
-rw-r--r--src/main/res/values-de/strings.xml2
-rw-r--r--src/main/res/values/strings.xml2
-rw-r--r--src/main/res/xml/preferences.xml5
5 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
index f36aa6f39..bcbf6ba3b 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -1,12 +1,14 @@
package de.pixart.messenger.ui.adapter;
import android.content.Context;
+import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
+import android.preference.PreferenceManager;
import android.support.v4.content.ContextCompat;
import android.util.Pair;
import android.view.LayoutInflater;
@@ -181,7 +183,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
ImageView profilePicture = (ImageView) view.findViewById(R.id.conversation_image);
loadAvatar(conversation, profilePicture);
- if (conversation.getMode() == Conversation.MODE_SINGLE) {
+ if (conversation.getMode() == Conversation.MODE_SINGLE && ShowPresenceColoredNames()) {
switch (conversation.getContact().getPresences().getShownStatus()) {
case CHAT:
case ONLINE:
@@ -311,4 +313,12 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
}
}
}
+
+ public boolean ShowPresenceColoredNames() {
+ return getPreferences().getBoolean("presence_colored_names", false);
+ }
+
+ protected SharedPreferences getPreferences() {
+ return PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
+ }
} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java
index 0f8dbfee9..9873431ef 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java
@@ -96,7 +96,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
color = tag.getColor();
}
}
- if (offline) {
+ if (offline || !ShowPresenceColoredNames()) {
tvName.setTextColor(ContextCompat.getColor(activity, R.color.black87));
tvName.setAlpha(INACTIVE_ALPHA);
tvJid.setAlpha(INACTIVE_ALPHA);
@@ -205,4 +205,11 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
}
}
+ public boolean ShowPresenceColoredNames() {
+ return getPreferences().getBoolean("presence_colored_names", false);
+ }
+
+ protected SharedPreferences getPreferences() {
+ return PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
+ }
}
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index a1822040a..b996a29c6 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -720,5 +720,7 @@
<string name="pref_use_tor">Über Tor verbinden</string>
<string name="pref_use_tor_summary">Alle Verbindungen über das Tor-Netzwerk tunneln. Benötigt Orbot</string>
<string name="last_seen_just_away">kürzlich</string>
+ <string name="pref_use_colored_names_to_indicate_status">Kontaktnamen-Farbe zeigt Online-Status an</string>
+ <string name="pref_use_colored_names_to_indicate_status_summary">Kontaktnamen einfärben, um den Online-Status des Kontakts anzuzeigen</string>
</resources>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index b6e983011..07db5f20f 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -329,9 +329,11 @@
<string name="pref_use_larger_font">Increase font size</string>
<string name="pref_use_larger_font_summary">Use larger font sizes across the entire app</string>
<string name="pref_use_send_button_to_indicate_status">Send button indicates status</string>
+ <string name="pref_use_colored_names_to_indicate_status">Colored names indicates status</string>
<string name="pref_use_indicate_received">Request message receipts</string>
<string name="pref_use_indicate_received_summary">Received messages will be marked with a green tick if supported</string>
<string name="pref_use_send_button_to_indicate_status_summary">Colorize send button to indicate contact status</string>
+ <string name="pref_use_colored_names_to_indicate_status_summary">Colorize contact names to indicate contact status</string>
<string name="pref_expert_options_other">Other</string>
<string name="pref_autojoin">Automatically join conferences</string>
<string name="pref_autojoin_summary">Respect the autojoin flag in conference bookmarks</string>
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index daddaf6fa..26d54627f 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -20,6 +20,11 @@
android:key="send_button_status"
android:summary="@string/pref_use_send_button_to_indicate_status_summary"
android:title="@string/pref_use_send_button_to_indicate_status" />
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:key="presence_colored_names"
+ android:summary="@string/pref_use_colored_names_to_indicate_status_summary"
+ android:title="@string/pref_use_colored_names_to_indicate_status" />
<ListPreference
android:defaultValue="recent"
android:dialogTitle="@string/choose_quick_action"