aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-09 20:45:52 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-09 20:45:52 +0100
commit5280a96ae1b78553e624a0c3fc10b6b362d2d39b (patch)
tree708ac964e139f64f8ac8e57793bff81ac79ea4ac /src
parent784f507b151dd0a806cf86ac8902b018d0bdb6e0 (diff)
do not interpret grin >< as quote
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java2
-rw-r--r--src/main/java/de/pixart/messenger/utils/UIHelper.java13
2 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index d2e9f7eed..ccbbabc99 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -407,7 +407,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
char current = body.length() > i ? body.charAt(i) : '\n';
if (lineStart == -1) {
if (previous == '\n') {
- if ((current == '>' && !UIHelper.isPositionFollowedByNumber(body, i)) || current == '\u00bb') {
+ if ((current == '>' && UIHelper.isPositionFollowedByQuoteableCharacter(body,i)) || current == '\u00bb') {
// Line start with quote
lineStart = i;
if (quoteStart == -1) quoteStart = i;
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);