From 7b765fdcf8208406ede3d12dbbfe2ab96778351d Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 19 Dec 2019 08:59:56 +0100 Subject: [PATCH] Fixed always showing images for original messages --- .../eu/faircode/email/AdapterMessage.java | 71 +++++++------------ 1 file changed, 27 insertions(+), 44 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 9eb94e4789..004dce1b34 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -1313,6 +1313,9 @@ public class AdapterMessage extends RecyclerView.Adapter attachments = db.attachment().getAttachments(message.id); + for (EntityAttachment attachment : attachments) + if (attachment.isInline() && attachment.isImage() && + attachment.progress == null && !attachment.available) + EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id); + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + } + + // Format message if (show_full) { HtmlHelper.setViewport(document); if (inline || show_images) @@ -1618,8 +1640,11 @@ public class AdapterMessage extends RecyclerView.Adapter() { - @Override - protected Void onExecute(Context context, Bundle args) { - TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); - - DB db = DB.getInstance(context); - try { - db.beginTransaction(); - - List attachments = db.attachment().getAttachments(message.id); - for (EntityAttachment attachment : attachments) - if (attachment.isInline() && attachment.isImage() && - attachment.progress == null && !attachment.available) - EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id); - - db.setTransactionSuccessful(); - } finally { - db.endTransaction(); - } - - ServiceSynchronize.eval(context, "attachment"); - - return null; - } - - @Override - protected void onException(Bundle args, Throwable ex) { - Log.unexpectedError(parentFragment.getParentFragmentManager(), ex); - } - }.execute(context, owner, args, "show:images"); } private void onActionUnsubscribe(TupleMessageEx message) {