Reduced conversation view flicker

This commit is contained in:
M66B 2018-12-04 18:42:45 +01:00
parent 6346f408a6
commit c00351f3de
3 changed files with 52 additions and 3 deletions

View File

@ -443,7 +443,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivAddContact.setVisibility(viewType == ViewType.THREAD && show_expanded && contacts && message.from != null ? View.VISIBLE : View.GONE);
pbHeaders.setVisibility(View.GONE);
grpHeaders.setVisibility(show_headers && show_expanded ? View.VISIBLE : View.GONE);
bnvActions.setVisibility(View.GONE);
bnvActions.setVisibility(viewType == ViewType.THREAD && show_expanded ? View.INVISIBLE : View.GONE);
vSeparatorBody.setVisibility(View.GONE);
btnHtml.setVisibility(View.GONE);
btnImages.setVisibility(View.GONE);
@ -1601,7 +1601,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
public boolean areContentsTheSame(
@NonNull TupleMessageEx prev, @NonNull TupleMessageEx next) {
return prev.equals(next);
return prev.uiEquals(next);
}
};

View File

@ -253,6 +253,50 @@ public class EntityMessage implements Serializable {
HtmlHelper.sanitize(EntityMessage.read(context, id)));
}
public boolean uiEquals(Object obj) {
if (obj instanceof EntityMessage) {
EntityMessage other = (EntityMessage) obj;
return (true &&
//(this.account == null ? other.account == null : this.account.equals(other.account)) &&
//this.folder.equals(other.folder) &&
//(this.identity == null ? other.identity == null : this.identity.equals(other.identity)) &&
//(this.replying == null ? other.replying == null : this.replying.equals(other.replying)) &&
//(this.forwarding == null ? other.forwarding == null : this.forwarding.equals(other.forwarding)) &&
//(this.uid == null ? other.uid == null : this.uid.equals(other.uid)) &&
(this.msgid == null ? other.msgid == null : this.msgid.equals(other.msgid)) && // debug info
//(this.references == null ? other.references == null : this.references.equals(other.references)) &&
//(this.deliveredto == null ? other.deliveredto == null : this.deliveredto.equals(other.deliveredto)) &&
//(this.inreplyto == null ? other.inreplyto == null : this.inreplyto.equals(other.inreplyto)) &&
(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.preview == null ? other.preview == null : this.preview.equals(other.preview)) &&
//(this.sent == null ? other.sent == null : this.sent.equals(other.sent)) &&
this.received.equals(other.received) &&
//this.stored.equals(other.stored) &&
//this.seen.equals(other.seen) &&
//this.answered.equals(other.answered) &&
//this.flagged.equals(other.flagged) &&
Helper.equal(this.keywords, other.keywords) &&
this.ui_seen.equals(other.ui_seen) &&
this.ui_answered.equals(other.ui_answered) &&
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;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof EntityMessage) {

View File

@ -32,6 +32,11 @@ public class TupleMessageEx extends EntityMessage {
public int attachments;
public boolean duplicate;
@Override
public boolean uiEquals(Object obj) {
return super.uiEquals(obj);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof TupleMessageEx) {
@ -49,6 +54,6 @@ public class TupleMessageEx extends EntityMessage {
this.attachments == other.attachments &&
this.duplicate == other.duplicate);
}
return super.equals(obj);
return false;
}
}