diff --git a/app/src/main/java/eu/faircode/email/ActivityEml.java b/app/src/main/java/eu/faircode/email/ActivityEml.java index 950e7cbaf9..559aa687be 100644 --- a/app/src/main/java/eu/faircode/email/ActivityEml.java +++ b/app/src/main/java/eu/faircode/email/ActivityEml.java @@ -103,7 +103,7 @@ public class ActivityEml extends ActivityBase { result.parts = HtmlHelper.fromHtml(sb.toString()); result.html = parts.getHtml(context); - result.body = HtmlHelper.fromHtml(HtmlHelper.sanitize(context, result.html, true)); + result.body = HtmlHelper.fromHtml(HtmlHelper.sanitize(context, result.html)); ByteArrayOutputStream bos = new ByteArrayOutputStream(); mmessage.writeTo(bos); diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 27297df8e3..0d05e67234 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -51,6 +51,7 @@ import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; import android.text.method.ArrowKeyMovementMethod; +import android.text.style.DynamicDrawableSpan; import android.text.style.ImageSpan; import android.text.style.QuoteSpan; import android.text.style.StyleSpan; @@ -244,7 +245,6 @@ public class AdapterMessage extends RecyclerView.Adapter 0 ? View.INVISIBLE : View.GONE); @@ -1528,7 +1526,6 @@ public class AdapterMessage extends RecyclerView.Adapter bodyTask = new SimpleTask() { @Override - protected SpannableStringBuilder onExecute(Context context, final Bundle args) { + protected SpannableStringBuilder onExecute(final Context context, final Bundle args) { DB db = DB.getInstance(context); TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); + boolean show_quotes = args.getBoolean("show_quotes"); String body; try { @@ -1749,6 +1744,23 @@ public class AdapterMessage extends RecyclerView.Adapter 0); args.putBoolean("has_images", builder.getSpans(0, body.length(), ImageSpan.class).length > 0); @@ -1774,12 +1786,11 @@ public class AdapterMessage extends RecyclerView.Adapter 0 ? View.VISIBLE : View.GONE); @@ -1792,10 +1803,9 @@ public class AdapterMessage extends RecyclerView.Adapter"; @@ -1819,10 +1829,10 @@ public class AdapterMessage extends RecyclerView.Adapter 0 && image[0].getSource() != null) { - boolean show_images = properties.getValue("images", id); + boolean show_images = properties.getValue("images", message.id); if (show_images) { onOpenImage(image[0].getDrawable()); return true; @@ -1865,6 +1875,16 @@ public class AdapterMessage extends RecyclerView.Adapter 0) { + properties.setValue("quotes", message.id, true); + + Bundle args = new Bundle(); + args.putSerializable("message", message); + args.putBoolean("show_quotes", true); + bodyTask.execute(context, owner, args, "message:body"); + } } return super.onTouchEvent(widget, buffer, event); diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index c239b028d3..19c06ebc83 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2755,7 +2755,7 @@ public class FragmentCompose extends FragmentBase { Spanned spannedReference = null; File refFile = draft.getRefFile(context); if (refFile.exists()) { - String quote = HtmlHelper.sanitize(context, Helper.readText(refFile), true); + String quote = HtmlHelper.sanitize(context, Helper.readText(refFile)); Spanned spannedQuote = HtmlHelper.fromHtml(quote, new Html.ImageGetter() { @Override diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 81e856c6b9..6213505d28 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -110,7 +110,7 @@ public class HtmlHelper { return document.outerHtml(); } - static String sanitize(Context context, String html, boolean showQuotes) { + static String sanitize(Context context, String html) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean paranoid = prefs.getBoolean("paranoid", true); @@ -125,11 +125,6 @@ public class HtmlHelper { .addProtocols("img", "src", "data"); final Document document = new Cleaner(whitelist).clean(parsed); - // Quotes - if (!showQuotes) - for (Element quote : document.select("blockquote")) - quote.html("…"); - // Short quotes for (Element q : document.select("q")) { q.prependText("\""); diff --git a/app/src/main/res/layout/item_message_compact.xml b/app/src/main/res/layout/item_message_compact.xml index cd84dea690..1bf4b5fc45 100644 --- a/app/src/main/res/layout/item_message_compact.xml +++ b/app/src/main/res/layout/item_message_compact.xml @@ -507,17 +507,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/bnvActions" /> - - + app:constraint_referenced_ids="tbHtml,ibImages,ibFull" /> - - + app:constraint_referenced_ids="tbHtml,ibImages,ibFull" />