Better fix for previous issue
This commit is contained in:
parent
a1339deb61
commit
5c3413a3d5
1 changed files with 4 additions and 5 deletions
|
@ -123,7 +123,7 @@ public class BubbleChat {
|
|||
Spanned text = null;
|
||||
if (message != null) {
|
||||
if (context.getResources().getBoolean(R.bool.emoticons_in_messages)) {
|
||||
text = getSmiledText(context, getTextWithHttpLinks(message), message);
|
||||
text = getSmiledText(context, getTextWithHttpLinks(message));
|
||||
//text = getTextWithHttpLinks(message);
|
||||
} else {
|
||||
text = getTextWithHttpLinks(message);
|
||||
|
@ -257,17 +257,16 @@ public class BubbleChat {
|
|||
cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR));
|
||||
}
|
||||
|
||||
public static Spannable getSmiledText(Context context, Spanned spanned, String text) {
|
||||
public static Spannable getSmiledText(Context context, Spanned spanned) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(spanned);
|
||||
String text = spanned.toString();
|
||||
|
||||
for (Entry<String, Integer> entry : emoticons.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
int indexOf = text.indexOf(key);
|
||||
while (indexOf >= 0) {
|
||||
int end = indexOf + key.length();
|
||||
if (end <= spanned.length()) {
|
||||
builder.setSpan(new ImageSpan(context, entry.getValue()), indexOf, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
indexOf = text.indexOf(key, end);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue