mirror of https://github.com/M66B/FairEmail.git
Conditionally bind body on inline images downloaded
This commit is contained in:
parent
af2752d15a
commit
dd8a27bb00
|
@ -1389,21 +1389,25 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
db.attachment().liveAttachments(message.id).observe(cowner, new Observer<List<EntityAttachment>>() {
|
db.attachment().liveAttachments(message.id).observe(cowner, new Observer<List<EntityAttachment>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable List<EntityAttachment> attachments) {
|
public void onChanged(@Nullable List<EntityAttachment> attachments) {
|
||||||
int inlineImages = 0;
|
boolean show_images = properties.getValue("images", message.id);
|
||||||
if (attachments != null)
|
boolean inline = prefs.getBoolean("inline_images", false);
|
||||||
for (EntityAttachment attachment : attachments)
|
if (show_images || inline) {
|
||||||
if (attachment.available && attachment.isInline() && attachment.isImage())
|
int inlineImages = 0;
|
||||||
inlineImages++;
|
if (attachments != null)
|
||||||
|
for (EntityAttachment attachment : attachments)
|
||||||
|
if (attachment.available && attachment.isInline() && attachment.isImage())
|
||||||
|
inlineImages++;
|
||||||
|
|
||||||
int lastInlineImages = 0;
|
int lastInlineImages = 0;
|
||||||
List<EntityAttachment> lastAttachments = properties.getAttachments(message.id);
|
List<EntityAttachment> lastAttachments = properties.getAttachments(message.id);
|
||||||
if (lastAttachments != null)
|
if (lastAttachments != null)
|
||||||
for (EntityAttachment attachment : lastAttachments)
|
for (EntityAttachment attachment : lastAttachments)
|
||||||
if (attachment.available && attachment.isInline() && attachment.isImage())
|
if (attachment.available && attachment.isInline() && attachment.isImage())
|
||||||
lastInlineImages++;
|
lastInlineImages++;
|
||||||
|
|
||||||
if (inlineImages > lastInlineImages)
|
if (inlineImages > lastInlineImages)
|
||||||
bindBody(message, false);
|
bindBody(message, false);
|
||||||
|
}
|
||||||
|
|
||||||
bindAttachments(message, attachments);
|
bindAttachments(message, attachments);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue