diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java | 9 |
1 files changed, 5 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 81c6c393..5523314b 100644 --- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java +++ b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java @@ -1406,6 +1406,7 @@ public final class EmojiconHandler { } public static final Map<Pattern, Integer> ANDROID_EMOTICONS = new HashMap<Pattern, Integer>(); + private static final Pattern TIME_AND_SCORING_PATTERN = Pattern.compile("[0-9]{1,3}:[0-9]{1,3}"); private static final Spannable.Factory spannableFactory = Spannable.Factory .getInstance(); @@ -1453,7 +1454,7 @@ public final class EmojiconHandler { falsePositives.add(Pair.create(webUrlMatcher.start(), webUrlMatcher.end())); } - Matcher timeAndScoringMatcher = Pattern.compile("[0-9]{1,3}:[0-9]{1,3}").matcher(spannable); + Matcher timeAndScoringMatcher = TIME_AND_SCORING_PATTERN.matcher(spannable); while (timeAndScoringMatcher.find()) { falsePositives.add(Pair.create(timeAndScoringMatcher.start(), timeAndScoringMatcher.end())); } @@ -1475,9 +1476,9 @@ public final class EmojiconHandler { } if (set) { // 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)) { + for (Pair<Integer, Integer> falsePositive : falsePositives) { + if ((matcher.start() >= falsePositive.first && matcher.start() <= falsePositive.second) + || (matcher.end() >= falsePositive.first && matcher.end() <= falsePositive.second)) { set = false; break; } |