diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:45:52 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:45:52 +0100 |
commit | 5280a96ae1b78553e624a0c3fc10b6b362d2d39b (patch) | |
tree | 708ac964e139f64f8ac8e57793bff81ac79ea4ac /src/main/java/de/pixart/messenger/utils/UIHelper.java | |
parent | 784f507b151dd0a806cf86ac8902b018d0bdb6e0 (diff) |
do not interpret grin >< as quote
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils/UIHelper.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/UIHelper.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java index caa466b04..c350268d6 100644 --- a/src/main/java/de/pixart/messenger/utils/UIHelper.java +++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java @@ -212,7 +212,7 @@ public class UIHelper { for(String l : lines) { if (l.length() > 0) { char first = l.charAt(0); - if ((first != '>' || isPositionFollowedByNumber(l, 0)) && first != '\u00bb') { + if ((first != '>' || !isPositionFollowedByQuoteableCharacter(l,0)) && first != '\u00bb') { String line = l.trim(); if (line.isEmpty()) { continue; @@ -236,7 +236,11 @@ public class UIHelper { } } - public static boolean isPositionFollowedByNumber(CharSequence body, int pos) { + public static boolean isPositionFollowedByQuoteableCharacter(CharSequence body, int pos) { + return !isPositionFollowedByNumber(body, pos) && !isPositionFollowedByBigGrin(body, pos); + } + + private static boolean isPositionFollowedByNumber(CharSequence body, int pos) { boolean previousWasNumber = false; for (int i = pos + 1; i < body.length(); i++) { char c = body.charAt(i); @@ -251,6 +255,11 @@ public class UIHelper { return previousWasNumber; } + private static boolean isPositionFollowedByBigGrin(CharSequence body, int pos) { + return body.length() <= pos + 1 + || ((body.charAt(pos + 1) == '<') && (body.length() == pos + 2 || Character.isWhitespace(body.charAt(pos + 2)))); + } + public static String getFileDescriptionString(final Context context, final Message message) { if (message.getType() == Message.TYPE_IMAGE) { return context.getString(R.string.image); |