add a little bit of space between merged messages.

This commit is contained in:
Daniel Gultsch 2015-05-11 09:08:56 +02:00
parent 21deda7b00
commit 53e43daa0d
2 changed files with 8 additions and 2 deletions

View File

@ -396,7 +396,7 @@ public class Message extends AbstractEntity {
public String getMergedBody() { public String getMergedBody() {
final Message next = this.next(); final Message next = this.next();
if (this.mergeable(next)) { if (this.mergeable(next)) {
return getBody().trim() + '\n' + next.getMergedBody(); return getBody().trim() + "\n\n" + next.getMergedBody();
} }
return getBody().trim(); return getBody().trim();
} }

View File

@ -232,7 +232,13 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.messageBody.setIncludeFontPadding(true); viewHolder.messageBody.setIncludeFontPadding(true);
if (message.getBody() != null) { if (message.getBody() != null) {
final String nick = UIHelper.getMessageDisplayName(message); final String nick = UIHelper.getMessageDisplayName(message);
final String formattedBody = message.getMergedBody().replaceAll("^" + Message.ME_COMMAND,nick + " "); final String body = message.getMergedBody().replaceAll("^" + Message.ME_COMMAND,nick + " ");
final SpannableString formattedBody = new SpannableString(body);
int i = body.indexOf("\n\n");
while(i >= 0) {
formattedBody.setSpan(new RelativeSizeSpan(0.2f),i,i+2,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
i = body.indexOf("\n\n",i+2);
}
if (message.getType() != Message.TYPE_PRIVATE) { if (message.getType() != Message.TYPE_PRIVATE) {
if (message.hasMeCommand()) { if (message.hasMeCommand()) {
final Spannable span = new SpannableString(formattedBody); final Spannable span = new SpannableString(formattedBody);