Break all character styles

This commit is contained in:
M66B 2020-06-23 08:08:59 +02:00
parent 474c8d503e
commit 76f25aea16
1 changed files with 5 additions and 4 deletions

View File

@ -61,6 +61,7 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.text.style.QuoteSpan;
@ -516,18 +517,18 @@ public class FragmentCompose extends FragmentBase {
}
if (broken) {
StyleSpan[] sspan = ssb.getSpans(start + 1, start + 1, StyleSpan.class);
for (StyleSpan span : sspan) {
CharacterStyle[] sspan = ssb.getSpans(start + 1, start + 1, CharacterStyle.class);
for (CharacterStyle span : sspan) {
int s = ssb.getSpanStart(span);
int e = ssb.getSpanEnd(span);
int f = ssb.getSpanFlags(span);
Log.i("Style span " + s + "..." + e + " start=" + start);
StyleSpan s1 = new StyleSpan(span.getStyle());
CharacterStyle s1 = CharacterStyle.wrap(span);
ssb.setSpan(s1, s, start, f);
Log.i("Style span " + s + "..." + start);
StyleSpan s2 = new StyleSpan(span.getStyle());
CharacterStyle s2 = CharacterStyle.wrap(span);
ssb.setSpan(s2, start + 1, e, f);
Log.i("Style span " + (start + 1) + "..." + e);