mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-05 04:19:21 +01:00
Switched to QuoteSpan
There is special processing for QuoteSpans in Android that doesn't work on extended QuoteSpans
This commit is contained in:
@@ -77,20 +77,27 @@ public class EditTextCompose extends FixedEditText {
|
||||
return false;
|
||||
html = "<div>" + HtmlHelper.formatPre(text.toString()) + "</div>";
|
||||
}
|
||||
|
||||
Document document = HtmlHelper.sanitizeCompose(context, html, false);
|
||||
Spanned paste = HtmlHelper.fromDocument(context, document);
|
||||
Spanned paste = HtmlHelper.fromHtml(document.html());
|
||||
|
||||
int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
||||
int dp3 = Helper.dp2pixels(context, 3);
|
||||
int dp6 = Helper.dp2pixels(context, 6);
|
||||
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder(paste);
|
||||
QuoteSpan[] spans = ssb.getSpans(0, ssb.length(), QuoteSpan.class);
|
||||
for (QuoteSpan span : spans) {
|
||||
ssb.setSpan(
|
||||
new StyledQuoteSpan(context, colorPrimary),
|
||||
ssb.getSpanStart(span),
|
||||
ssb.getSpanEnd(span),
|
||||
for (QuoteSpan quoteSpan : spans) {
|
||||
QuoteSpan q;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
||||
q = new QuoteSpan(colorPrimary);
|
||||
else
|
||||
q = new QuoteSpan(colorPrimary, dp3, dp6);
|
||||
ssb.setSpan(q,
|
||||
ssb.getSpanStart(quoteSpan),
|
||||
ssb.getSpanEnd(quoteSpan),
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
ssb.removeSpan(span);
|
||||
ssb.removeSpan(quoteSpan);
|
||||
}
|
||||
|
||||
int start = getSelectionStart();
|
||||
|
||||
Reference in New Issue
Block a user