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:
parent
ee37f1febd
commit
e5911a5284
1 changed files with 10 additions and 5 deletions
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue