From 724dced8209646df4cb2e0e0543a7dbd2b8bc2b1 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Fri, 13 Feb 2015 14:32:11 -0800 Subject: [PATCH] Define a max message length to display. // FREEBIE Closes #2294 --- .../thoughtcrime/securesms/database/model/MessageRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java index 7e044b1124..1c223061b5 100644 --- a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java +++ b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java @@ -46,6 +46,8 @@ public abstract class MessageRecord extends DisplayRecord { public static final int DELIVERY_STATUS_PENDING = 2; public static final int DELIVERY_STATUS_FAILED = 3; + private static final int MAX_DISPLAY_LENGTH = 2000; + private final Recipient individualRecipient; private final int recipientDeviceId; private final long id; @@ -104,6 +106,8 @@ public abstract class MessageRecord extends DisplayRecord { return emphasisAdded(context.getString(R.string.MessageRecord_left_group)); } else if (isGroupQuit()) { return emphasisAdded(context.getString(R.string.ConversationItem_group_action_left, getIndividualRecipient().toShortString())); + } else if (getBody().getBody().length() > MAX_DISPLAY_LENGTH) { + return new SpannableString(getBody().getBody().substring(0, MAX_DISPLAY_LENGTH)); } return new SpannableString(getBody().getBody());