From 52e09d17e82d7edaaf765ec68ac491110046269a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 21 Nov 2017 12:41:05 +0100 Subject: [PATCH] MessageAdapter: do not apply empty size spans --- .../siacs/conversations/ui/adapter/MessageAdapter.java | 10 +++++----- 1 file 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 3530ca59d..ac983e497 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 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 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());