Delay binding calendar

This commit is contained in:
M66B 2021-02-16 14:17:49 +01:00
parent 195ad614d5
commit 03d85eb86c
1 changed files with 8 additions and 12 deletions

View File

@ -2537,7 +2537,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
} }
private void bindAttachments(final TupleMessageEx message, @Nullable List<EntityAttachment> attachments, boolean bind_images) { private void bindAttachments(final TupleMessageEx message, @Nullable List<EntityAttachment> attachments, boolean bind_extras) {
if (attachments == null) if (attachments == null)
attachments = new ArrayList<>(); attachments = new ArrayList<>();
properties.setAttachments(message.id, attachments); properties.setAttachments(message.id, attachments);
@ -2551,7 +2551,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int download = 0; int download = 0;
boolean save = (attachments.size() > 1); boolean save = (attachments.size() > 1);
boolean downloading = false; boolean downloading = false;
boolean calendar = false; EntityAttachment calendar = null;
List<EntityAttachment> a = new ArrayList<>(); List<EntityAttachment> a = new ArrayList<>();
for (EntityAttachment attachment : attachments) { for (EntityAttachment attachment : attachments) {
@ -2569,18 +2569,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (show_inline || !inline || !attachment.available) if (show_inline || !inline || !attachment.available)
a.add(attachment); a.add(attachment);
if (attachment.available && "text/calendar".equals(attachment.getMimeType())) { if (attachment.available &&
calendar = true; "text/calendar".equals(attachment.getMimeType()))
bindCalendar(message, attachment); calendar = attachment;
}
} }
adapterAttachment.set(a); adapterAttachment.set(a);
if (!calendar) { if (calendar != null && bind_extras)
clearCalendar(); bindCalendar(message, calendar);
grpCalendar.setVisibility(View.GONE);
grpCalendarResponse.setVisibility(View.GONE);
}
cbInline.setOnCheckedChangeListener(null); cbInline.setOnCheckedChangeListener(null);
cbInline.setChecked(show_inline); cbInline.setChecked(show_inline);
@ -2605,7 +2601,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}); });
List<EntityAttachment> images = new ArrayList<>(); List<EntityAttachment> images = new ArrayList<>();
if (thumbnails && bind_images) if (thumbnails && bind_extras)
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (attachment.isAttachment() && attachment.isImage()) if (attachment.isAttachment() && attachment.isImage())
images.add(attachment); images.add(attachment);