aboutsummaryrefslogtreecommitdiffstats
path: root/libs/emojicon/src/main
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2015-12-14 15:15:00 +0100
committersteckbrief <steckbrief@chefmail.de>2015-12-14 15:15:00 +0100
commit1c44fd8a4b7956eb9b635b9e943286757100a8bf (patch)
tree9e5103c5cb97036e7fb2961c1d9bb057b296d831 /libs/emojicon/src/main
parent9d0dedc6cec165fc720e507e94c976f78a6ed743 (diff)
Fixes FS#88: Avoid smilie repacement in time messages
Diffstat (limited to 'libs/emojicon/src/main')
-rw-r--r--libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java
index bc1d670d..81c6c393 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java
+++ b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java
@@ -1448,9 +1448,14 @@ public final class EmojiconHandler {
boolean hasChanges = false;
Matcher webUrlMatcher = Patterns.WEB_URL.matcher(spannable);
- Set<Pair<Integer, Integer>> webUrls = new HashSet<Pair<Integer, Integer>>();
+ Set<Pair<Integer, Integer>> falsePositives = new HashSet<Pair<Integer, Integer>>();
while (webUrlMatcher.find()) {
- webUrls.add(Pair.create(webUrlMatcher.start(), webUrlMatcher.end()));
+ falsePositives.add(Pair.create(webUrlMatcher.start(), webUrlMatcher.end()));
+ }
+
+ Matcher timeAndScoringMatcher = Pattern.compile("[0-9]{1,3}:[0-9]{1,3}").matcher(spannable);
+ while (timeAndScoringMatcher.find()) {
+ falsePositives.add(Pair.create(timeAndScoringMatcher.start(), timeAndScoringMatcher.end()));
}
Map<Pattern, Integer> emoticons = ANDROID_EMOTICONS;
@@ -1469,8 +1474,8 @@ public final class EmojiconHandler {
}
}
if (set) {
- // check that found emojicon is not in an web url
- for (Pair<Integer, Integer> webUrl : webUrls) {
+ // check that found emojicon is not in an web url or in a time or in a scoring
+ for (Pair<Integer, Integer> webUrl : falsePositives) {
if ((matcher.start() >= webUrl.first && matcher.start() <= webUrl.second)
|| (matcher.end() >= webUrl.first && matcher.end() <= webUrl.second)) {
set = false;