aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils/UIHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils/UIHelper.java')
-rw-r--r--src/main/java/de/pixart/messenger/utils/UIHelper.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java
index fe933f8ac..5c3db105a 100644
--- a/src/main/java/de/pixart/messenger/utils/UIHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java
@@ -1,9 +1,14 @@
package de.pixart.messenger.utils;
import android.content.Context;
+import android.graphics.Typeface;
+import android.text.Spannable;
+import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
+import android.text.style.ForegroundColorSpan;
+import android.text.style.StyleSpan;
import android.util.Pair;
import androidx.annotation.ColorInt;
@@ -499,6 +504,14 @@ public class UIHelper {
}
}
+ public static SpannableString getColoredUsername(final Message message) {
+ final SpannableString user;
+ user = SpannableString.valueOf(UIHelper.getMessageDisplayName(message));
+ user.setSpan(new StyleSpan(Typeface.BOLD), 0, user.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ user.setSpan(new ForegroundColorSpan(message.getAvatarBackgroundColor()), 0, user.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ return user;
+ }
+
public static String getMessageDisplayName(final Message message) {
final Conversational conversation = message.getConversation();
if (message.getStatus() == Message.STATUS_RECEIVED) {