47
47
import android .util .Pair ;
48
48
49
49
import com .zulip .android .R ;
50
+ import com .zulip .android .ZulipApp ;
50
51
51
52
import org .ccil .cowan .tagsoup .Parser ;
52
53
import org .xml .sax .Attributes ;
@@ -77,6 +78,7 @@ public class CustomHtmlToSpannedConverter implements ContentHandler {
77
78
private Html .ImageGetter mEmojiGetter ;
78
79
private String mBaseUri ;
79
80
private static int userMentionColor ;
81
+ private static int userMentionSelfColor ;
80
82
public CustomHtmlToSpannedConverter (String source ,
81
83
Html .ImageGetter imageGetter , Html .TagHandler tagHandler ,
82
84
Parser parser , Html .ImageGetter emojiGetter , String baseUri , Context context ) {
@@ -88,6 +90,7 @@ public CustomHtmlToSpannedConverter(String source,
88
90
mEmojiGetter = emojiGetter ;
89
91
mBaseUri = baseUri ;
90
92
userMentionColor = ContextCompat .getColor (context , R .color .dark_red );
93
+ userMentionSelfColor = ContextCompat .getColor (context , R .color .dark_blue );
91
94
}
92
95
93
96
public Spanned convert () {
@@ -437,8 +440,11 @@ private static void endSpan(SpannableStringBuilder text) {
437
440
if (where != len ) {
438
441
Href h = (Href ) obj ;
439
442
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
+ }
442
448
}
443
449
}
444
450
}
0 commit comments