Always bind media

master
M66B 2 weeks ago
parent 378f71d586
commit 575384a08d

@ -2176,7 +2176,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
List<EntityAttachment> attachments = (attachments_alt List<EntityAttachment> attachments = (attachments_alt
? new ArrayList<>() : properties.getAttachments(message.id)); ? new ArrayList<>() : properties.getAttachments(message.id));
bindAttachments(message, attachments, false); bindAttachments(message, attachments, false, false);
// Actions // Actions
vSeparator.setVisibility(View.VISIBLE); vSeparator.setVisibility(View.VISIBLE);
@ -2308,7 +2308,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
(inlineImages > lastInlineImages && (show_images || inline))) (inlineImages > lastInlineImages && (show_images || inline)))
bindBody(message, false); bindBody(message, false);
bindAttachments(message, attachments, true); bindAttachments(message, attachments, true, true);
if (!scroll) if (!scroll)
properties.ready(message.id); properties.ready(message.id);
@ -2354,7 +2354,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return; return;
if (!attachments_alt && bind) if (!attachments_alt && bind)
bindAttachments(message, data.attachments, false); bindAttachments(message, data.attachments, false, false);
boolean hasInbox = false; boolean hasInbox = false;
boolean hasArchive = false; boolean hasArchive = false;
@ -3768,7 +3768,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
? View.VISIBLE : View.INVISIBLE); ? View.VISIBLE : View.INVISIBLE);
} }
private void bindAttachments(final TupleMessageEx message, @Nullable List<EntityAttachment> attachments, boolean bind_extras) { private void bindAttachments(final TupleMessageEx message, @Nullable List<EntityAttachment> attachments,
boolean bind_extras, boolean bind_media) {
if (attachments == null) if (attachments == null)
attachments = new ArrayList<>(); attachments = new ArrayList<>();
properties.setAttachments(message.id, attachments); properties.setAttachments(message.id, attachments);
@ -3848,9 +3849,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (calendar != null && bind_extras) if (calendar != null && bind_extras)
bindCalendar(message, calendar); bindCalendar(message, calendar);
if (bind_media) {
int iavailable = 0; int iavailable = 0;
List<EntityAttachment> media = new ArrayList<>(); List<EntityAttachment> media = new ArrayList<>();
if (thumbnails && !EntityFolder.JUNK.equals(message.folderType) && bind_extras) { if (thumbnails && !EntityFolder.JUNK.equals(message.folderType)) {
for (EntityAttachment attachment : attachments) { for (EntityAttachment attachment : attachments) {
String type = attachment.getMimeType(); String type = attachment.getMimeType();
if ((pdf_preview && attachment.isPDF()) || if ((pdf_preview && attachment.isPDF()) ||
@ -3874,6 +3876,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
? View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE);
ibShareImages.setVisibility(iavailable > 0 ? View.VISIBLE : View.GONE); ibShareImages.setVisibility(iavailable > 0 ? View.VISIBLE : View.GONE);
} }
}
private void bindCalendar(final TupleMessageEx message, EntityAttachment attachment) { private void bindCalendar(final TupleMessageEx message, EntityAttachment attachment) {
// https://tools.ietf.org/html/rfc5546 // https://tools.ietf.org/html/rfc5546
@ -5738,13 +5741,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean hide_attachments = properties.getValue("hide_attachments", message.id, hide_attachments_default); boolean hide_attachments = properties.getValue("hide_attachments", message.id, hide_attachments_default);
properties.setValue("hide_attachments", message.id, !hide_attachments); properties.setValue("hide_attachments", message.id, !hide_attachments);
cowner.restart(); cowner.restart();
bindAttachments(message, properties.getAttachments(message.id), false); bindAttachments(message, properties.getAttachments(message.id), false, true);
} }
private void onShowInlineAttachments(TupleMessageEx message, boolean isChecked) { private void onShowInlineAttachments(TupleMessageEx message, boolean isChecked) {
properties.setValue("inline", message.id, isChecked); properties.setValue("inline", message.id, isChecked);
cowner.restart(); cowner.restart();
bindAttachments(message, properties.getAttachments(message.id), false); bindAttachments(message, properties.getAttachments(message.id), false, true);
} }
private void onSaveAttachments(TupleMessageEx message) { private void onSaveAttachments(TupleMessageEx message) {

Loading…
Cancel
Save