diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b63d138..fe407c35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,6 @@ cache: - .gradle/ before_script: - - apt-get update -qq && apt-get install -y -qq pandoc wget # Get sdk version from project - export ANDROID_COMPILE_SDK=`egrep '^[[:blank:]]+compileSdkVersion' app/build.gradle | awk '{print $2}'` # Explict output for logging purpose only diff --git a/app/src/main/java/org/dystopia/email/AdapterMessage.java b/app/src/main/java/org/dystopia/email/AdapterMessage.java index 33c0dfb7..9e9a5d72 100644 --- a/app/src/main/java/org/dystopia/email/AdapterMessage.java +++ b/app/src/main/java/org/dystopia/email/AdapterMessage.java @@ -424,7 +424,7 @@ public class AdapterMessage extends PagedListAdapter 0 ? Typeface.BOLD : Typeface.NORMAL); + int typeface = (message.unseen <= 0 || show_expanded ? Typeface.NORMAL : Typeface.BOLD); tvFrom.setTypeface(null, typeface); tvTime.setTypeface(null, typeface); tvSubject.setTypeface(null, typeface); @@ -448,8 +448,8 @@ public class AdapterMessage extends PagedListAdapter DIFF_CALLBACK = new DiffUtil.ItemCallback() { @Override - public boolean areItemsTheSame(@NonNull TupleMessageEx prev, @NonNull TupleMessageEx next) { + public boolean areItemsTheSame( + @NonNull TupleMessageEx prev, @NonNull TupleMessageEx next) { return prev.id.equals(next.id); } @Override public boolean areContentsTheSame( @NonNull TupleMessageEx prev, @NonNull TupleMessageEx next) { - return prev.equals(next); + return prev.shallowEquals(next); } }; diff --git a/app/src/main/java/org/dystopia/email/EntityMessage.java b/app/src/main/java/org/dystopia/email/EntityMessage.java index e8cf85d9..ffd82143 100644 --- a/app/src/main/java/org/dystopia/email/EntityMessage.java +++ b/app/src/main/java/org/dystopia/email/EntityMessage.java @@ -83,6 +83,7 @@ import javax.mail.Address; @Index(value = {"ui_found"}), @Index(value = {"ui_ignored"}) }) + public class EntityMessage implements Serializable { static final String TABLE_NAME = "message"; @@ -230,6 +231,32 @@ public class EntityMessage implements Serializable { return false; } + public boolean shallowEquals(Object obj) { + if (obj instanceof EntityMessage) { + EntityMessage other = (EntityMessage) obj; + return ((this.msgid == null ? other.msgid == null : this.msgid.equals(other.msgid)) + && (this.thread == null ? other.thread == null : this.thread.equals(other.thread)) + && (this.avatar == null ? other.avatar == null : this.avatar.equals(other.avatar)) + && 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.headers == null ? other.headers == null : this.headers.equals(other.headers)) + && (this.subject == null ? other.subject == null : this.subject.equals(other.subject)) + && (this.size == null ? other.size == null : this.size.equals(other.size)) + && this.content == other.content + && this.received.equals(other.received) + && this.ui_seen.equals(other.ui_seen) + && this.ui_flagged.equals(other.ui_flagged) + && this.ui_hide.equals(other.ui_hide) + && this.ui_found.equals(other.ui_found) + && this.ui_ignored.equals(other.ui_ignored) + && (this.error == null ? other.error == null : this.error.equals(other.error))); + } + return false; + } + private static boolean equal(Address[] a1, Address[] a2) { if (a1 == null && a2 == null) { return true; diff --git a/app/src/main/java/org/dystopia/email/TupleMessageEx.java b/app/src/main/java/org/dystopia/email/TupleMessageEx.java index b15dcfd7..0eed5908 100644 --- a/app/src/main/java/org/dystopia/email/TupleMessageEx.java +++ b/app/src/main/java/org/dystopia/email/TupleMessageEx.java @@ -31,6 +31,11 @@ public class TupleMessageEx extends EntityMessage { public int unflagged; public int attachments; + @Override + public boolean shallowEquals(Object obj) { + return super.shallowEquals(obj); + } + @Override public boolean equals(Object obj) { if (obj instanceof TupleMessageEx) { @@ -52,6 +57,6 @@ public class TupleMessageEx extends EntityMessage { && this.unflagged == other.unflagged && this.attachments == other.attachments); } - return super.equals(obj); + return false; } }