mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 03:32:15 -05:00
write text in bold when highlighted in received muc message
This commit is contained in:
parent
cb9c4d4327
commit
97ba0a0d49
@ -522,7 +522,7 @@ public class NotificationService {
|
||||
return (m.find() || message.getType() == Message.TYPE_PRIVATE);
|
||||
}
|
||||
|
||||
private static Pattern generateNickHighlightPattern(final String nick) {
|
||||
public static Pattern generateNickHighlightPattern(final String nick) {
|
||||
// We expect a word boundary, i.e. space or start of string, followed by
|
||||
// the
|
||||
// nick (matched in case-insensitive manner), followed by optional
|
||||
|
@ -52,6 +52,7 @@ import eu.siacs.conversations.entities.Message;
|
||||
import eu.siacs.conversations.entities.Message.FileParams;
|
||||
import eu.siacs.conversations.entities.Transferable;
|
||||
import eu.siacs.conversations.persistance.FileBackend;
|
||||
import eu.siacs.conversations.services.NotificationService;
|
||||
import eu.siacs.conversations.ui.ConversationActivity;
|
||||
import eu.siacs.conversations.ui.text.DividerSpan;
|
||||
import eu.siacs.conversations.ui.text.QuoteSpan;
|
||||
@ -448,6 +449,13 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||
privateMarkerIndex + 1 + nick.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
if (message.getConversation().getMode() == Conversation.MODE_MULTI && message.getStatus() == Message.STATUS_RECEIVED) {
|
||||
Pattern pattern = NotificationService.generateNickHighlightPattern(message.getConversation().getMucOptions().getActualNick());
|
||||
Matcher matcher = pattern.matcher(body);
|
||||
while(matcher.find()) {
|
||||
body.setSpan(new StyleSpan(Typeface.BOLD), matcher.start(), matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
Linkify.addLinks(body, XMPP_PATTERN, "xmpp");
|
||||
Linkify.addLinks(body, Patterns.AUTOLINK_WEB_URL, "http", WEBURL_MATCH_FILTER, WEBURL_TRANSFORM_FILTER);
|
||||
Linkify.addLinks(body, GeoHelper.GEO_URI, "geo");
|
||||
|
Loading…
Reference in New Issue
Block a user