Simplify/fix scroll to message

pull/177/head
M66B 5 years ago
parent 4720232c68
commit 4976902cc6

@ -815,7 +815,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
private void bindTo(final TupleMessageEx message, int position, boolean scroll) { private void bindTo(final TupleMessageEx message, int position) {
boolean inbox = EntityFolder.INBOX.equals(message.folderType); boolean inbox = EntityFolder.INBOX.equals(message.folderType);
boolean outbox = EntityFolder.OUTBOX.equals(message.folderType); boolean outbox = EntityFolder.OUTBOX.equals(message.folderType);
boolean outgoing = isOutgoing(message); boolean outgoing = isOutgoing(message);
@ -1098,7 +1098,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (viewType == ViewType.THREAD) if (viewType == ViewType.THREAD)
if (expanded) if (expanded)
bindExpanded(message, scroll); bindExpanded(message);
else else
clearExpanded(message); clearExpanded(message);
@ -1310,7 +1310,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
} }
private void bindExpanded(final TupleMessageEx message, final boolean scroll) { private void bindExpanded(final TupleMessageEx message) {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
cowner.recreate(); cowner.recreate();
@ -1486,9 +1486,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
bindBody(message); bindBody(message);
properties.setAttachments(message.id, attachments); properties.setAttachments(message.id, attachments);
if (scroll)
properties.scrollTo(getAdapterPosition());
} }
}); });
@ -2634,7 +2631,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else { } else {
message.ui_seen = !message.ui_seen; message.ui_seen = !message.ui_seen;
message.unseen = (message.ui_seen ? 0 : message.count); message.unseen = (message.ui_seen ? 0 : message.count);
bindTo(message, getAdapterPosition(), false); bindTo(message, getAdapterPosition());
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", message.id); args.putLong("id", message.id);
@ -3010,14 +3007,15 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
else { else {
boolean expanded = !properties.getValue("expanded", message.id); boolean expanded = !properties.getValue("expanded", message.id);
properties.setExpanded(message, expanded); properties.setExpanded(message, expanded);
bindTo(message, getAdapterPosition(), expanded); bindTo(message, getAdapterPosition());
properties.scrollTo(getAdapterPosition());
} }
} }
private void onToggleAddresses(TupleMessageEx message) { private void onToggleAddresses(TupleMessageEx message) {
boolean addresses = !properties.getValue("addresses", message.id); boolean addresses = !properties.getValue("addresses", message.id);
properties.setValue("addresses", message.id, addresses); properties.setValue("addresses", message.id, addresses);
bindExpanded(message, false); bindExpanded(message);
} }
private void onDownloadAttachments(final TupleMessageEx message) { private void onDownloadAttachments(final TupleMessageEx message) {
@ -3619,7 +3617,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
properties.setExpanded(message, false); properties.setExpanded(message, false);
message.ui_seen = args.getBoolean("seen"); message.ui_seen = args.getBoolean("seen");
message.unseen = (message.ui_seen ? 0 : message.count); message.unseen = (message.ui_seen ? 0 : message.count);
bindTo(message, getAdapterPosition(), false); bindTo(message, getAdapterPosition());
} }
@Override @Override
@ -4024,7 +4022,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
}.execute(context, owner, args, "message:headers"); }.execute(context, owner, args, "message:headers");
} else } else
bindExpanded(message, false); bindExpanded(message);
} }
private void onMenuRawSave(TupleMessageEx message) { private void onMenuRawSave(TupleMessageEx message) {
@ -4884,7 +4882,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
holder.unwire(); holder.unwire();
holder.bindTo(message, position, false); holder.bindTo(message, position);
holder.wire(); holder.wire();
} }

Loading…
Cancel
Save