diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils/UIHelper.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/UIHelper.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java index 7978650dc..12cd708f1 100644 --- a/src/main/java/de/pixart/messenger/utils/UIHelper.java +++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java @@ -209,7 +209,7 @@ public class UIHelper { for(String l : lines) { if (l.length() > 0) { char first = l.charAt(0); - if (first != '>' && first != '\u00bb') { + if ((first != '>' || isPositionFollowedByNumber(l, 0)) && first != '\u00bb') { String line = l.trim(); if (line.isEmpty()) { continue; @@ -233,6 +233,21 @@ public class UIHelper { } } + public static boolean isPositionFollowedByNumber(CharSequence body, int pos) { + boolean previousWasNumber = false; + for (int i = pos + 1; i < body.length(); i++) { + char c = body.charAt(i); + if (Character.isDigit(body.charAt(i))) { + previousWasNumber = true; + } else if (previousWasNumber && (c == '.' || c == ',')) { + previousWasNumber = false; + } else { + return Character.isWhitespace(c) && previousWasNumber; + } + } + return previousWasNumber; + } + public static String getFileDescriptionString(final Context context, final Message message) { if (message.getType() == Message.TYPE_IMAGE) { return context.getString(R.string.image); |