aboutsummaryrefslogtreecommitdiffstats
path: root/libs/emojicon
diff options
context:
space:
mode:
Diffstat (limited to 'libs/emojicon')
-rw-r--r--libs/emojicon/build.gradle1
-rw-r--r--libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java18
2 files changed, 12 insertions, 7 deletions
diff --git a/libs/emojicon/build.gradle b/libs/emojicon/build.gradle
index a9776be0..8673b750 100644
--- a/libs/emojicon/build.gradle
+++ b/libs/emojicon/build.gradle
@@ -12,7 +12,6 @@ android {
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
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..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();
@@ -1448,9 +1449,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 = TIME_AND_SCORING_PATTERN.matcher(spannable);
+ while (timeAndScoringMatcher.find()) {
+ falsePositives.add(Pair.create(timeAndScoringMatcher.start(), timeAndScoringMatcher.end()));
}
Map<Pattern, Integer> emoticons = ANDROID_EMOTICONS;
@@ -1469,10 +1475,10 @@ public final class EmojiconHandler {
}
}
if (set) {
- // check that found emojicon is not in an web url
- for (Pair<Integer, Integer> webUrl : webUrls) {
- if ((matcher.start() >= webUrl.first && matcher.start() <= webUrl.second)
- || (matcher.end() >= webUrl.first && matcher.end() <= webUrl.second)) {
+ // check that found emojicon is not in an web url or in a time or in a scoring
+ 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;
}