Support me command in replies
And guard against edge case crash (cherry picked from commit 3b0719a90b509612d84a601b624a5a5d6c8d89ba)
This commit is contained in:
parent
30b567ea6c
commit
54f292ac41
1 changed files with 5 additions and 5 deletions
|
@ -633,10 +633,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
final String nick = UIHelper.getMessageDisplayName(message);
|
||||
SpannableStringBuilder body = getSpannableBody(message);
|
||||
final var processMarkup = body.getSpans(0, body.length(), Message.PlainTextSpan.class).length > 0;
|
||||
boolean hasMeCommand = message.hasMeCommand();
|
||||
if (hasMeCommand) {
|
||||
body = body.replace(0, Message.ME_COMMAND.length(), nick + " ");
|
||||
}
|
||||
if (body.length() > Config.MAX_DISPLAY_MESSAGE_CHARS) {
|
||||
body = new SpannableStringBuilder(body, 0, Config.MAX_DISPLAY_MESSAGE_CHARS);
|
||||
body.append("\u2026");
|
||||
|
@ -670,8 +666,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
}
|
||||
}
|
||||
}
|
||||
boolean hasMeCommand = body.toString().startsWith(Message.ME_COMMAND);
|
||||
if (hasMeCommand) {
|
||||
body = body.replace(0, Message.ME_COMMAND.length(), nick + " ");
|
||||
}
|
||||
if (!message.isPrivateMessage()) {
|
||||
if (hasMeCommand) {
|
||||
if (hasMeCommand && body.length() > nick.length()) {
|
||||
body.setSpan(
|
||||
new StyleSpan(Typeface.BOLD_ITALIC),
|
||||
0,
|
||||
|
|
Loading…
Add table
Reference in a new issue