mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Fix mentions when in the middle of text
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
f4508bc4fe
commit
dfae11f65c
@ -23,9 +23,6 @@ package com.nextcloud.talk.callbacks;
|
|||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.style.StyleSpan;
|
|
||||||
import android.text.style.TypefaceSpan;
|
|
||||||
import com.nextcloud.talk.R;
|
|
||||||
import com.nextcloud.talk.models.json.mention.Mention;
|
import com.nextcloud.talk.models.json.mention.Mention;
|
||||||
import com.nextcloud.talk.utils.MagicCharPolicy;
|
import com.nextcloud.talk.utils.MagicCharPolicy;
|
||||||
import com.nextcloud.talk.utils.text.Spans;
|
import com.nextcloud.talk.utils.text.Spans;
|
||||||
@ -41,7 +38,7 @@ public class MentionAutocompleteCallback implements AutocompleteCallback<Mention
|
|||||||
String replacement = item.getLabel();
|
String replacement = item.getLabel();
|
||||||
editable.replace(start, end, replacement + " ");
|
editable.replace(start, end, replacement + " ");
|
||||||
Spans.MentionSpan mentionSpan = new Spans.MentionSpan(Typeface.BOLD, item.getId(), item.getLabel());
|
Spans.MentionSpan mentionSpan = new Spans.MentionSpan(Typeface.BOLD, item.getId(), item.getLabel());
|
||||||
editable.setSpan(mentionSpan, 0, replacement.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
editable.setSpan(mentionSpan, start, start + replacement.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user