From 2f2dabe919a7f2962ddfd19d2a765dc9a72f86dc Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 14 Aug 2018 09:22:53 +0000 Subject: [PATCH] Fixed message list flickering --- .../java/eu/faircode/email/EntityMessage.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityMessage.java b/app/src/main/java/eu/faircode/email/EntityMessage.java index d019041f..55c34a81 100644 --- a/app/src/main/java/eu/faircode/email/EntityMessage.java +++ b/app/src/main/java/eu/faircode/email/EntityMessage.java @@ -112,12 +112,12 @@ public class EntityMessage { (this.msgid == null ? other.msgid == null : this.msgid.equals(other.msgid)) && (this.references == null ? other.references == null : this.references.equals(other.references)) && (this.inreplyto == null ? other.inreplyto == null : this.inreplyto.equals(other.inreplyto)) && - (this.thread == null ? other.thread == null : thread.equals(other.thread)) && - (this.from == null ? other.from == null : this.from.equals(other.from)) && - (this.to == null ? other.to == null : this.to.equals(other.to)) && - (this.cc == null ? other.cc == null : this.cc.equals(other.cc)) && - (this.bcc == null ? other.bcc == null : this.bcc.equals(other.bcc)) && - (this.reply == null ? other.reply == null : this.reply.equals(other.reply)) && + (this.thread == null ? other.thread == null : this.thread.equals(other.thread)) && + equal(this.from, other.from) && + equal(this.to, other.to) && + equal(this.cc, other.cc) && + equal(this.bcc, other.bcc) && + equal(this.reply, other.reply) && (this.subject == null ? other.subject == null : this.subject.equals(other.subject)) && (this.body == null ? other.body == null : this.body.equals(other.body)) && (this.sent == null ? other.sent == null : this.sent.equals(other.sent)) && @@ -129,4 +129,21 @@ public class EntityMessage { } return false; } + + private static boolean equal(Address[] a1, Address[] a2) { + if (a1 == null && a2 == null) + return true; + + if (a1 == null || a2 == null) + return false; + + if (a1.length != a2.length) + return false; + + for (int i = 0; i < a1.length; i++) + if (!a1[i].toString().equals(a2[i].toString())) + return false; + + return true; + } }