From 006533b15e094c288e0a5b907adae79e49b7e360 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 14 Dec 2019 16:09:12 +0100 Subject: [PATCH] Revert "Consider images without name as inline" This reverts commit f88879f8df8bc6be20ccb711cbef90e7bdcad78e. --- .../main/java/eu/faircode/email/AdapterAttachment.java | 2 +- app/src/main/java/eu/faircode/email/AdapterMessage.java | 8 ++++---- app/src/main/java/eu/faircode/email/EntityAttachment.java | 4 ---- app/src/main/java/eu/faircode/email/FragmentCompose.java | 5 +++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterAttachment.java b/app/src/main/java/eu/faircode/email/AdapterAttachment.java index fc3108e58f..6dca0161c2 100644 --- a/app/src/main/java/eu/faircode/email/AdapterAttachment.java +++ b/app/src/main/java/eu/faircode/email/AdapterAttachment.java @@ -106,7 +106,7 @@ public class AdapterAttachment extends RecyclerView.Adapter a = new ArrayList<>(); for (EntityAttachment attachment : attachments) { - boolean inline = ((attachment.isInlineImage()) || attachment.encryption != null); + boolean inline = ((attachment.isInline() && attachment.isImage()) || attachment.encryption != null); if (inline) has_inline = true; if (attachment.progress == null && !attachment.available) @@ -1701,7 +1701,7 @@ public class AdapterMessage extends RecyclerView.Adapter images = new ArrayList<>(); for (EntityAttachment attachment : attachments) - if (!attachment.isInlineImage()) + if (!attachment.isInline() && attachment.isImage()) images.add(attachment); adapterImage.set(images); grpImages.setVisibility(images.size() > 0 ? View.VISIBLE : View.GONE); @@ -2715,7 +2715,7 @@ public class AdapterMessage extends RecyclerView.Adapter attachments = db.attachment().getAttachments(message.id); for (EntityAttachment attachment : attachments) - if (attachment.isInlineImage() && + if (attachment.isInline() && attachment.isImage() && attachment.progress == null && !attachment.available) EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id); diff --git a/app/src/main/java/eu/faircode/email/EntityAttachment.java b/app/src/main/java/eu/faircode/email/EntityAttachment.java index cb746df2df..08c5937fad 100644 --- a/app/src/main/java/eu/faircode/email/EntityAttachment.java +++ b/app/src/main/java/eu/faircode/email/EntityAttachment.java @@ -109,10 +109,6 @@ public class EntityAttachment { return IMAGE_TYPES.contains(type); } - boolean isInlineImage() { - return ((isInline() || TextUtils.isEmpty(name)) && isImage()); - } - File getFile(Context context) { return getFile(context, id, name); } diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 82e0675bd9..7463e9f3c4 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2978,7 +2978,8 @@ public class FragmentCompose extends FragmentBase { for (EntityAttachment attachment : attachments) if (attachment.encryption == null && ("forward".equals(action) || "editasnew".equals(action) || - (cid.contains(attachment.cid) || attachment.isInlineImage()))) { + (cid.contains(attachment.cid) || + (attachment.isInline() && attachment.isImage())))) { if (attachment.available) { File source = attachment.getFile(context); @@ -3130,7 +3131,7 @@ public class FragmentCompose extends FragmentBase { available++; if (attachment.progress != null) downloading = true; - if (attachment.isInlineImage()) + if (attachment.isInline() && attachment.isImage()) inline_images = true; }