aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-11-21 12:41:05 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-11-21 12:41:05 +0100
commit52e09d17e82d7edaaf765ec68ac491110046269a (patch)
tree095c5f4e217e223db8ed5ebd4167a3a41983d1d2
parent9548a4f6af8dcdfc68feb3907ede5d3316e5038e (diff)
MessageAdapter: do not apply empty size spans
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 3530ca5..ac983e4 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -466,10 +466,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} else {
body.insert(privateMarkerIndex, " ");
}
- body.setSpan(new ForegroundColorSpan(getMessageTextColor(darkBackground, false)),
- 0, privateMarkerIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- body.setSpan(new StyleSpan(Typeface.BOLD),
- 0, privateMarkerIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ body.setSpan(new ForegroundColorSpan(getMessageTextColor(darkBackground, false)), 0, privateMarkerIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ body.setSpan(new StyleSpan(Typeface.BOLD), 0, privateMarkerIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (hasMeCommand) {
body.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), privateMarkerIndex + 1,
privateMarkerIndex + 1 + nick.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@@ -484,7 +482,9 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
Matcher matcher = Emoticons.generatePattern(body).matcher(body);
while(matcher.find()) {
- body.setSpan(new RelativeSizeSpan(1.2f), matcher.start(), matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ if (matcher.start() < matcher.end()) {
+ body.setSpan(new RelativeSizeSpan(1.2f), matcher.start(), matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
}
StylingHelper.format(body, viewHolder.messageBody.getCurrentTextColor());