diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-05-28 23:48:39 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-05-28 23:48:39 +0200 |
commit | aaf5233efe39e8473c4e616ac256004f627816c8 (patch) | |
tree | af194f679eb1f42fa2fca02eb190bcdc8c0e14f2 /src/main/java/eu/siacs/conversations/utils | |
parent | 422fd1847fa18553398a2747c72f835d9227f172 (diff) |
limit text size in message adapter to 2k and also limit text size in conversations adapter
Diffstat (limited to 'src/main/java/eu/siacs/conversations/utils')
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/UIHelper.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index 6ca5370a3..4ab748188 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -184,8 +184,12 @@ public class UIHelper { return new Pair<>(getFileDescriptionString(context,message),true); } } else { - if (message.getBody().startsWith(Message.ME_COMMAND)) { - return new Pair<>(message.getBody().replaceAll("^" + Message.ME_COMMAND, + String body = message.getBody(); + if (body.length() > 256) { + body = body.substring(0,256); + } + if (body.startsWith(Message.ME_COMMAND)) { + return new Pair<>(body.replaceAll("^" + Message.ME_COMMAND, UIHelper.getMessageDisplayName(message) + " "), false); } else if (GeoHelper.isGeoUri(message.getBody())) { if (message.getStatus() == Message.STATUS_RECEIVED) { @@ -197,7 +201,7 @@ public class UIHelper { return new Pair<>(context.getString(R.string.x_file_offered_for_download, getFileDescriptionString(context,message)),true); } else{ - return new Pair<>(message.getBody().trim(), false); + return new Pair<>(body.trim(), false); } } } |