aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/eu/siacs/conversations/Config.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java6
-rw-r--r--src/main/res/layout/message_received.xml1
-rw-r--r--src/main/res/layout/message_sent.xml1
4 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java
index c73da59e3..c4fe28d98 100644
--- a/src/main/java/eu/siacs/conversations/Config.java
+++ b/src/main/java/eu/siacs/conversations/Config.java
@@ -76,6 +76,8 @@ public final class Config {
public static final int REFRESH_UI_INTERVAL = 500;
+ public static final int MAX_DISPLAY_MESSAGE_CHARS = 5 * 1024;
+
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 74bfb491a..32646a92d 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -19,6 +19,7 @@ import android.text.style.RelativeSizeSpan;
import android.text.style.StyleSpan;
import android.text.util.Linkify;
import android.util.DisplayMetrics;
+import android.util.Log;
import android.util.Patterns;
import android.view.View;
import android.view.View.OnClickListener;
@@ -39,6 +40,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;
@@ -308,6 +310,10 @@ public class MessageAdapter extends ArrayAdapter<Message> {
} catch (ArrayIndexOutOfBoundsException e) {
body = message.getMergedBody();
}
+ if (body.length() > Config.MAX_DISPLAY_MESSAGE_CHARS) {
+ Log.d(Config.LOGTAG,"not showing complete message of length "+body.length());
+ body = body.substring(0, Config.MAX_DISPLAY_MESSAGE_CHARS);
+ }
final SpannableString formattedBody = new SpannableString(body);
int i = body.indexOf(Message.MERGE_SEPARATOR);
while(i >= 0) {
diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml
index e720a6ff2..466dd045a 100644
--- a/src/main/res/layout/message_received.xml
+++ b/src/main/res/layout/message_received.xml
@@ -53,7 +53,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
- android:maxLines="256"
android:textColorLink="@color/white"
android:textColor="@color/white"
android:textColorHighlight="@color/grey800"
diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml
index be530c5fe..fc68c3894 100644
--- a/src/main/res/layout/message_sent.xml
+++ b/src/main/res/layout/message_sent.xml
@@ -54,7 +54,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
- android:maxLines="256"
android:textColorLink="@color/black87"
android:textColor="@color/black87"
android:textColorHighlight="@color/grey500"