mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-25 14:40:41 +01:00
detect the error, but how to replace?
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
4feac1cb50
commit
2c3448f328
@ -366,23 +366,20 @@ class MessageInputFragment : Fragment() {
|
|||||||
var mentionSpan: Spans.MentionChipSpan
|
var mentionSpan: Spans.MentionChipSpan
|
||||||
for (i in mentionSpans.indices) {
|
for (i in mentionSpans.indices) {
|
||||||
mentionSpan = mentionSpans[i]
|
mentionSpan = mentionSpans[i]
|
||||||
val start = editable.getSpanStart(mentionSpan)
|
|
||||||
val end = editable.getSpanEnd(mentionSpan)
|
|
||||||
Log.d("Julius", "S:$start E:$end")
|
|
||||||
if (start >= editable.getSpanStart(mentionSpan) &&
|
|
||||||
start < editable.getSpanEnd(mentionSpan)
|
|
||||||
) {
|
|
||||||
val what = editable.subSequence(
|
|
||||||
editable.getSpanStart(mentionSpan),
|
|
||||||
editable.getSpanEnd(mentionSpan)
|
|
||||||
).toString()
|
|
||||||
|
|
||||||
if (what.trim { it <= ' ' } != mentionSpan.label
|
val what = editable.subSequence(
|
||||||
) {
|
editable.getSpanStart(mentionSpan),
|
||||||
Log.d("Julius", "What: $what")
|
editable.getSpanEnd(mentionSpan)
|
||||||
Log.d("Julius", "MentionSpan removed: $mentionSpan")
|
).toString().trim { it <= ' ' }
|
||||||
// FIXME error here- I knew it I was right, but why?
|
val error = what.length > mentionSpan.label.length
|
||||||
// editable.removeSpan(mentionSpan)
|
|
||||||
|
if (start >= editable.getSpanStart(mentionSpan) &&
|
||||||
|
start < editable.getSpanEnd(mentionSpan) &&
|
||||||
|
what != mentionSpan.label
|
||||||
|
) {
|
||||||
|
editable.removeSpan(mentionSpan)
|
||||||
|
if (error) {
|
||||||
|
Log.d("Julius", "Error: Fix mention")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user