diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-05-29 10:09:48 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-05-29 10:09:48 +0200 |
commit | 04ceeec4b302a23f14d73e4d6e479ebf28145c8e (patch) | |
tree | fb537bca00a09b672fb1449f58c7d31b4dc9da60 /src | |
parent | 35bf89e154ed7ac26e538fb908a96fc99e9b441d (diff) | |
parent | 2c55954ddda1d84a32150b430fe80ff8084612a1 (diff) |
Merge remote-tracking branch 'refs/remotes/siacs/master'
Diffstat (limited to '')
5 files changed, 13 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 4ad16559f..dcfe57e63 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -88,6 +88,8 @@ public final class Config { public static final int REFRESH_UI_INTERVAL = 500; + public static final int MAX_DISPLAY_MESSAGE_CHARS = 4096; + public static final boolean DISABLE_PROXY_LOOKUP = false; //useful to debug ibb public static final boolean DISABLE_HTTP_UPLOAD = false; public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance 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 a22a4bb7f..f2f68a321 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -43,6 +43,7 @@ import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; import eu.siacs.conversations.entities.Account; @@ -318,6 +319,9 @@ public class MessageAdapter extends ArrayAdapter<Message> { } catch (ArrayIndexOutOfBoundsException e) { body = message.getMergedBody(); } + if (body.length() > Config.MAX_DISPLAY_MESSAGE_CHARS) { + body = body.substring(0, Config.MAX_DISPLAY_MESSAGE_CHARS)+"\u2026"; + } final SpannableString formattedBody = new SpannableString(body); int i = body.indexOf(Message.MERGE_SEPARATOR); while(i >= 0) { 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); } } } diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml index 19df7c091..19bb83206 100644 --- a/src/main/res/layout/message_received.xml +++ b/src/main/res/layout/message_received.xml @@ -61,7 +61,6 @@ android:autoLink="web" android:textColorLink="@color/dark" android:textColor="@color/dark" - android:maxLines="256" android:textColorHighlight="@color/grey800" android:textSize="?attr/TextSizeBody" /> diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml index 42cdc95a7..ee8d38e49 100644 --- a/src/main/res/layout/message_sent.xml +++ b/src/main/res/layout/message_sent.xml @@ -62,7 +62,6 @@ android:autoLink="web" android:textColorLink="@color/black54" android:textColor="@color/black54" - android:maxLines="256" android:textColorHighlight="@color/grey500" android:textSize="?attr/TextSizeBody" /> |