aboutsummaryrefslogtreecommitdiffstats
path: root/libs/emojicon
diff options
context:
space:
mode:
Diffstat (limited to 'libs/emojicon')
-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;