mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-30 01:21:11 +01:00
Added setting to automatically show images for known contacts
This commit is contained in:
@@ -133,6 +133,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
private boolean avatars;
|
||||
private boolean preview;
|
||||
private boolean confirm;
|
||||
private boolean autoimages;
|
||||
private boolean debug;
|
||||
|
||||
private float textSize;
|
||||
@@ -499,9 +500,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
new SimpleTask<ContactInfo>() {
|
||||
@Override
|
||||
protected void onPreExecute(Bundle args) {
|
||||
ivAvatar.setTag(message.id);
|
||||
tvFrom.setTag(message.id);
|
||||
|
||||
itemView.setTag(message.id);
|
||||
ivAvatar.setVisibility(avatars ? View.INVISIBLE : View.GONE);
|
||||
tvFrom.setText(MessageHelper.formatAddresses(addresses, !compact, false));
|
||||
}
|
||||
@@ -515,17 +514,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, ContactInfo info) {
|
||||
Long id = args.getLong("id");
|
||||
|
||||
if (id.equals(ivAvatar.getTag())) {
|
||||
if (info.hasPhoto())
|
||||
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
||||
else
|
||||
ivAvatar.setImageResource(R.drawable.baseline_person_24);
|
||||
ivAvatar.setVisibility(avatars ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
if (id.equals(tvFrom.getTag()))
|
||||
tvFrom.setText(info.getDisplayName(compact));
|
||||
if (id != null && id.equals(itemView.getTag()))
|
||||
showContactInfo(info, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -533,14 +523,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.execute(context, owner, aargs, "message:avatar");
|
||||
} else {
|
||||
if (info.hasPhoto())
|
||||
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
||||
else
|
||||
ivAvatar.setImageResource(R.drawable.baseline_person_24);
|
||||
ivAvatar.setVisibility(avatars ? View.VISIBLE : View.GONE);
|
||||
tvFrom.setText(info.getDisplayName(compact));
|
||||
}
|
||||
} else
|
||||
showContactInfo(info, message);
|
||||
|
||||
vwColor.setBackgroundColor(message.accountColor == null ? Color.TRANSPARENT : message.accountColor);
|
||||
vwColor.setVisibility(View.VISIBLE);
|
||||
@@ -864,6 +848,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
itemView.setActivated(selectionTracker != null && selectionTracker.isSelected(message.id));
|
||||
}
|
||||
|
||||
private void showContactInfo(ContactInfo info, TupleMessageEx message) {
|
||||
if (info.hasPhoto())
|
||||
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
||||
else
|
||||
ivAvatar.setImageResource(R.drawable.baseline_person_24);
|
||||
ivAvatar.setVisibility(avatars ? View.VISIBLE : View.GONE);
|
||||
tvFrom.setText(info.getDisplayName(compact));
|
||||
|
||||
if (info.hasLookupUri() && autoimages &&
|
||||
!properties.getValue("images", message.id))
|
||||
onShowImagesConfirmed(message);
|
||||
}
|
||||
|
||||
void unbind() {
|
||||
if (liveAttachments != null) {
|
||||
liveAttachments.removeObserver(observerAttachments);
|
||||
@@ -2218,6 +2215,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
prefs.getBoolean("identicons", false));
|
||||
this.preview = prefs.getBoolean("preview", false);
|
||||
this.confirm = prefs.getBoolean("confirm", false);
|
||||
this.autoimages = prefs.getBoolean("autoimages", false);
|
||||
this.debug = prefs.getBoolean("debug", false);
|
||||
|
||||
this.textSize = Helper.getTextSize(context, zoom);
|
||||
|
||||
Reference in New Issue
Block a user