1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 02:07:12 +00:00

Fixed flicker on rebinding body

This commit is contained in:
M66B 2020-02-28 11:55:11 +01:00
parent ee37f1febd
commit e5911a5284

View file

@ -1475,8 +1475,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
bindBody(message);
db.attachment().liveAttachments(message.id).observe(cowner, new Observer<List<EntityAttachment>>() {
private int lastInlineImages = 0;
@Override
public void onChanged(@Nullable List<EntityAttachment> attachments) {
bindAttachments(message, attachments);
@ -1487,10 +1485,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (attachment.available && attachment.isInline() && attachment.isImage())
inlineImages++;
if (inlineImages != lastInlineImages) {
lastInlineImages = inlineImages;
int lastInlineImages = 0;
List<EntityAttachment> lastAttachments = properties.getAttachments(message.id);
if (lastAttachments != null)
for (EntityAttachment attachment : lastAttachments)
if (attachment.available && attachment.isInline() && attachment.isImage())
lastInlineImages++;
if (inlineImages != lastInlineImages)
bindBody(message);
}
properties.setAttachments(message.id, attachments);
if (scroll)
properties.scrollTo(getAdapterPosition());