Define a max message length to display.

// FREEBIE

Closes #2294
This commit is contained in:
Moxie Marlinspike 2015-02-13 14:32:11 -08:00
parent b8ca0e57ad
commit 724dced820

View File

@ -46,6 +46,8 @@ public abstract class MessageRecord extends DisplayRecord {
public static final int DELIVERY_STATUS_PENDING = 2; public static final int DELIVERY_STATUS_PENDING = 2;
public static final int DELIVERY_STATUS_FAILED = 3; public static final int DELIVERY_STATUS_FAILED = 3;
private static final int MAX_DISPLAY_LENGTH = 2000;
private final Recipient individualRecipient; private final Recipient individualRecipient;
private final int recipientDeviceId; private final int recipientDeviceId;
private final long id; private final long id;
@ -104,6 +106,8 @@ public abstract class MessageRecord extends DisplayRecord {
return emphasisAdded(context.getString(R.string.MessageRecord_left_group)); return emphasisAdded(context.getString(R.string.MessageRecord_left_group));
} else if (isGroupQuit()) { } else if (isGroupQuit()) {
return emphasisAdded(context.getString(R.string.ConversationItem_group_action_left, getIndividualRecipient().toShortString())); 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()); return new SpannableString(getBody().getBody());