4747import android .util .Pair ;
4848
4949import com .zulip .android .R ;
50+ import com .zulip .android .ZulipApp ;
5051
5152import org .ccil .cowan .tagsoup .Parser ;
5253import org .xml .sax .Attributes ;
@@ -77,6 +78,7 @@ public class CustomHtmlToSpannedConverter implements ContentHandler {
7778 private Html .ImageGetter mEmojiGetter ;
7879 private String mBaseUri ;
7980 private static int userMentionColor ;
81+ private static int userMentionSelfColor ;
8082 public CustomHtmlToSpannedConverter (String source ,
8183 Html .ImageGetter imageGetter , Html .TagHandler tagHandler ,
8284 Parser parser , Html .ImageGetter emojiGetter , String baseUri , Context context ) {
@@ -88,6 +90,7 @@ public CustomHtmlToSpannedConverter(String source,
8890 mEmojiGetter = emojiGetter ;
8991 mBaseUri = baseUri ;
9092 userMentionColor = ContextCompat .getColor (context , R .color .dark_red );
93+ userMentionSelfColor = ContextCompat .getColor (context , R .color .dark_blue );
9194 }
9295
9396 public Spanned convert () {
@@ -437,8 +440,11 @@ private static void endSpan(SpannableStringBuilder text) {
437440 if (where != len ) {
438441 Href h = (Href ) obj ;
439442 if (h != null && h .mHref != null ) {
440- text .setSpan (new ProfileSpan (h .mHref , userMentionColor ), where , len ,
441- Spannable .SPAN_EXCLUSIVE_EXCLUSIVE );
443+ if (ZulipApp .get ().getEmail ().equals (h .mHref )) {
444+ text .setSpan (new ForegroundColorSpan (userMentionSelfColor ), where , len , Spannable .SPAN_EXCLUSIVE_EXCLUSIVE );
445+ } else {
446+ text .setSpan (new ProfileSpan (h .mHref , userMentionColor ), where , len , Spannable .SPAN_EXCLUSIVE_EXCLUSIVE );
447+ }
442448 }
443449 }
444450 }
0 commit comments