From b6f85ba0dd765e72a89a85461b3f8c48f038270c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 11 May 2015 14:18:30 +0200 Subject: avoid using paragraph style breaks by accident --- src/main/java/eu/siacs/conversations/entities/Message.java | 4 +++- .../java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 3c144f5c..217b82bb 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -17,6 +17,8 @@ public class Message extends AbstractEntity { public static final String TABLENAME = "messages"; + public static final String MERGE_SEPARATOR = "\u2029\n\n"; + public static final int STATUS_RECEIVED = 0; public static final int STATUS_UNSEND = 1; public static final int STATUS_SEND = 2; @@ -396,7 +398,7 @@ public class Message extends AbstractEntity { public String getMergedBody() { final Message next = this.next(); if (this.mergeable(next)) { - return getBody().trim() + "\n\n" + next.getMergedBody(); + return getBody().trim() + MERGE_SEPARATOR + next.getMergedBody(); } return getBody().trim(); } 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 ec351622..29dfced2 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -234,10 +234,11 @@ public class MessageAdapter extends ArrayAdapter { final String nick = UIHelper.getMessageDisplayName(message); final String body = message.getMergedBody().replaceAll("^" + Message.ME_COMMAND,nick + " "); final SpannableString formattedBody = new SpannableString(body); - int i = body.indexOf("\n\n"); + int i = body.indexOf(Message.MERGE_SEPARATOR); while(i >= 0) { - formattedBody.setSpan(new RelativeSizeSpan(0.3f),i,i+2,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - i = body.indexOf("\n\n",i+2); + final int end = i + Message.MERGE_SEPARATOR.length(); + formattedBody.setSpan(new RelativeSizeSpan(0.3f),i,end,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + i = body.indexOf(Message.MERGE_SEPARATOR,end); } if (message.getType() != Message.TYPE_PRIVATE) { if (message.hasMeCommand()) { -- cgit v1.2.3