mirror of https://github.com/M66B/FairEmail.git
Body building
This commit is contained in:
parent
45a1b5db6c
commit
7de4e7b140
|
@ -3070,6 +3070,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
boolean text_color = prefs.getBoolean("text_color", true);
|
boolean text_color = prefs.getBoolean("text_color", true);
|
||||||
|
|
||||||
|
int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
EntityMessage draft = db.message().getMessage(id);
|
EntityMessage draft = db.message().getMessage(id);
|
||||||
if (draft == null || !draft.content)
|
if (draft == null || !draft.content)
|
||||||
|
@ -3078,6 +3080,19 @@ public class FragmentCompose extends FragmentBase {
|
||||||
String body = Helper.readText(draft.getFile(context));
|
String body = Helper.readText(draft.getFile(context));
|
||||||
Spanned spannedBody = HtmlHelper.fromHtml(body, cidGetter, null);
|
Spanned spannedBody = HtmlHelper.fromHtml(body, cidGetter, null);
|
||||||
|
|
||||||
|
SpannableStringBuilder bodyBuilder = new SpannableStringBuilder(spannedBody);
|
||||||
|
QuoteSpan[] bodySpans = bodyBuilder.getSpans(0, bodyBuilder.length(), QuoteSpan.class);
|
||||||
|
for (QuoteSpan quoteSpan : bodySpans) {
|
||||||
|
bodyBuilder.setSpan(
|
||||||
|
new StyledQuoteSpan(context, colorPrimary),
|
||||||
|
bodyBuilder.getSpanStart(quoteSpan),
|
||||||
|
bodyBuilder.getSpanEnd(quoteSpan),
|
||||||
|
bodyBuilder.getSpanFlags(quoteSpan));
|
||||||
|
bodyBuilder.removeSpan(quoteSpan);
|
||||||
|
}
|
||||||
|
|
||||||
|
spannedBody = bodyBuilder;
|
||||||
|
|
||||||
Spanned spannedRef = null;
|
Spanned spannedRef = null;
|
||||||
File refFile = draft.getRefFile(context);
|
File refFile = draft.getRefFile(context);
|
||||||
if (refFile.exists()) {
|
if (refFile.exists()) {
|
||||||
|
@ -3091,19 +3106,18 @@ public class FragmentCompose extends FragmentBase {
|
||||||
},
|
},
|
||||||
null);
|
null);
|
||||||
|
|
||||||
int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
SpannableStringBuilder refBuilder = new SpannableStringBuilder(spannedQuote);
|
||||||
SpannableStringBuilder builder = new SpannableStringBuilder(spannedQuote);
|
QuoteSpan[] refSpans = refBuilder.getSpans(0, refBuilder.length(), QuoteSpan.class);
|
||||||
QuoteSpan[] quoteSpans = builder.getSpans(0, builder.length(), QuoteSpan.class);
|
for (QuoteSpan quoteSpan : refSpans) {
|
||||||
for (QuoteSpan quoteSpan : quoteSpans) {
|
refBuilder.setSpan(
|
||||||
builder.setSpan(
|
|
||||||
new StyledQuoteSpan(context, colorPrimary),
|
new StyledQuoteSpan(context, colorPrimary),
|
||||||
builder.getSpanStart(quoteSpan),
|
refBuilder.getSpanStart(quoteSpan),
|
||||||
builder.getSpanEnd(quoteSpan),
|
refBuilder.getSpanEnd(quoteSpan),
|
||||||
builder.getSpanFlags(quoteSpan));
|
refBuilder.getSpanFlags(quoteSpan));
|
||||||
builder.removeSpan(quoteSpan);
|
refBuilder.removeSpan(quoteSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
spannedRef = builder;
|
spannedRef = refBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
args.putBoolean("ref_has_images", spannedRef != null &&
|
args.putBoolean("ref_has_images", spannedRef != null &&
|
||||||
|
|
Loading…
Reference in New Issue