cleaned replaceIconsInString
This commit is contained in:
parent
898f58e636
commit
3131818e0c
1 changed files with 4 additions and 7 deletions
|
@ -116,19 +116,16 @@ public class AndroidUtils {
|
||||||
Matcher matcher = Pattern.compile(entry).matcher(spannable);
|
Matcher matcher = Pattern.compile(entry).matcher(spannable);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
boolean set = true;
|
boolean set = true;
|
||||||
for (ImageSpan span : spannable.getSpans(matcher.start(),
|
for (ImageSpan span : spannable.getSpans(matcher.start(), matcher.end(), ImageSpan.class))
|
||||||
matcher.end(), ImageSpan.class))
|
|
||||||
if (spannable.getSpanStart(span) >= matcher.start()
|
if (spannable.getSpanStart(span) >= matcher.start()
|
||||||
&& spannable.getSpanEnd(span) <= matcher.end())
|
&& spannable.getSpanEnd(span) <= matcher.end()) {
|
||||||
spannable.removeSpan(span);
|
spannable.removeSpan(span);
|
||||||
else {
|
} else {
|
||||||
set = false;
|
set = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (set) {
|
if (set) {
|
||||||
spannable.setSpan(new ImageSpan(arrow),
|
spannable.setSpan(new ImageSpan(arrow), matcher.start(), matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
matcher.start(), matcher.end(),
|
|
||||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue