mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
Workaround: remove suggestions spans without composing flag
This commit is contained in:
@@ -53,12 +53,14 @@ import android.text.style.QuoteSpan;
|
||||
import android.text.style.RelativeSizeSpan;
|
||||
import android.text.style.StrikethroughSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.SuggestionSpan;
|
||||
import android.text.style.TypefaceSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.Base64;
|
||||
import android.util.Patterns;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -3935,6 +3937,21 @@ public class HtmlHelper {
|
||||
.remove("x-keep-line");
|
||||
}
|
||||
|
||||
static void clearComposingText(TextView view) {
|
||||
view.clearComposingText();
|
||||
|
||||
CharSequence text = view.getText();
|
||||
if (text instanceof Spannable) {
|
||||
Spannable edit = (Spannable) text;
|
||||
Object[] spans = edit.getSpans(0, edit.length(), Object.class);
|
||||
if (spans == null || spans.length == 0)
|
||||
return;
|
||||
for (Object span : spans)
|
||||
if (span instanceof SuggestionSpan)
|
||||
edit.removeSpan(span);
|
||||
}
|
||||
}
|
||||
|
||||
static Spanned fromHtml(@NonNull String html, Context context) {
|
||||
Document document = JsoupEx.parse(html);
|
||||
return fromDocument(context, document, null, null);
|
||||
|
||||
Reference in New Issue
Block a user