diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 9fb20e9e3..863141338 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -842,7 +842,7 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable public SpannableStringBuilder getBodyForDisplaying() { if (replyMessage != null) { try { - return new SpannableStringBuilder(MessageUtils.filterLtrRtl(">" + removeReplyFallback(replyMessage) + "\n" + removeReplyFallback(this)).trim()); + return new SpannableStringBuilder(MessageUtils.filterLtrRtl(getReplyText(replyMessage) + "\n" + removeReplyFallback(this)).trim()); } catch (IndexOutOfBoundsException e) { return new SpannableStringBuilder(MessageUtils.filterLtrRtl(this.body).trim()); } @@ -853,12 +853,26 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable public SpannableStringBuilder getBodyForReplyPreview() { try { - return new SpannableStringBuilder(MessageUtils.filterLtrRtl(">" + removeReplyFallback(this)).trim()); + return new SpannableStringBuilder(MessageUtils.filterLtrRtl(getReplyText(this).toString()).trim()); } catch (IndexOutOfBoundsException e) { return new SpannableStringBuilder(MessageUtils.filterLtrRtl(this.body).trim()); } } + private StringBuilder getReplyText(Message message) { + StringBuilder reply = removeReplyFallback(message); + reply.insert(0, '>'); + for (int i=0;i"); + i++; + } + } + + return reply; + } + private StringBuilder removeReplyFallback(Message message) { StringBuilder sb = new StringBuilder(message.body);