mirror of https://github.com/M66B/FairEmail.git
Changing UI flag state early
This commit is contained in:
parent
187ec27083
commit
4596f7c51a
|
@ -535,10 +535,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
else
|
else
|
||||||
ivExpander.setVisibility(View.GONE);
|
ivExpander.setVisibility(View.GONE);
|
||||||
|
|
||||||
int flagged = (message.count - message.unflagged);
|
bindFlagged(message);
|
||||||
ivFlagged.setImageResource(flagged > 0 ? R.drawable.baseline_star_24 : R.drawable.baseline_star_border_24);
|
|
||||||
ivFlagged.setImageTintList(ColorStateList.valueOf(flagged > 0 ? colorAccent : textColorSecondary));
|
|
||||||
ivFlagged.setVisibility(message.uid == null ? View.INVISIBLE : View.VISIBLE);
|
|
||||||
|
|
||||||
tvSize.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true));
|
tvSize.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true));
|
||||||
tvSize.setVisibility(message.size == null || message.content ? View.GONE : View.VISIBLE);
|
tvSize.setVisibility(message.size == null || message.content ? View.GONE : View.VISIBLE);
|
||||||
|
@ -852,6 +849,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
itemView.setActivated(selectionTracker != null && selectionTracker.isSelected(message.id));
|
itemView.setActivated(selectionTracker != null && selectionTracker.isSelected(message.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void bindFlagged(TupleMessageEx message) {
|
||||||
|
int flagged = (message.count - message.unflagged);
|
||||||
|
ivFlagged.setImageResource(flagged > 0 ? R.drawable.baseline_star_24 : R.drawable.baseline_star_border_24);
|
||||||
|
ivFlagged.setImageTintList(ColorStateList.valueOf(flagged > 0 ? colorAccent : textColorSecondary));
|
||||||
|
ivFlagged.setVisibility(message.uid == null ? View.INVISIBLE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
private void showContactInfo(ContactInfo info, TupleMessageEx message) {
|
private void showContactInfo(ContactInfo info, TupleMessageEx message) {
|
||||||
if (info.hasPhoto())
|
if (info.hasPhoto())
|
||||||
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
||||||
|
@ -933,11 +937,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onToggleFlag(TupleMessageEx message) {
|
private void onToggleFlag(TupleMessageEx message) {
|
||||||
|
Log.i("Set message id=" + message.id +
|
||||||
|
" flagged=" + message.ui_flagged + " " + message.unflagged + "/" + message.count);
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLong("id", message.id);
|
args.putLong("id", message.id);
|
||||||
args.putBoolean("flagged", !message.ui_flagged);
|
args.putBoolean("flagged", !message.ui_flagged);
|
||||||
args.putBoolean("thread", viewType != ViewType.THREAD);
|
args.putBoolean("thread", viewType != ViewType.THREAD);
|
||||||
Log.i("Set message id=" + message.id + " flagged=" + !message.ui_flagged);
|
|
||||||
|
message.unflagged = message.ui_flagged ? message.count : 0;
|
||||||
|
message.ui_flagged = !message.ui_flagged;
|
||||||
|
bindFlagged(message);
|
||||||
|
|
||||||
new SimpleTask<Void>() {
|
new SimpleTask<Void>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue