MessageAdapter: do not apply empty size spans

This commit is contained in:
Daniel Gultsch 2017-11-21 12:41:05 +01:00
parent 9548a4f6af
commit 52e09d17e8

View file

@ -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,8 +482,10 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
Matcher matcher = Emoticons.generatePattern(body).matcher(body);
while(matcher.find()) {
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());