diff options
author | steckbrief <steckbrief@chefmail.de> | 2015-12-14 19:13:30 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2015-12-14 19:13:30 +0100 |
commit | dcf951e48e81dd03a7909fb1ddb404ca46a0d00c (patch) | |
tree | 113c9aa9317ba86c859f495afe6113c5c205f9cc /libs/emojicon/src/main | |
parent | 1c44fd8a4b7956eb9b635b9e943286757100a8bf (diff) |
Fixes FS#88, Code cleanup
Diffstat (limited to 'libs/emojicon/src/main')
-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; } |