Browse Source

Fixed showing empty photos

main
M66B 6 years ago
parent
commit
84be266b7c
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      app/src/main/java/eu/faircode/email/AdapterMessage.java

+ 6
- 2
app/src/main/java/eu/faircode/email/AdapterMessage.java View File

@ -151,12 +151,16 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
itemView.setAlpha(viewType == ViewType.THREAD && EntityFolder.ARCHIVE.equals(message.folderType) ? 0.5f : 1.0f);
boolean photo = false;
if (avatars && message.avatar != null) {
ContentResolver resolver = context.getContentResolver();
InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(resolver, Uri.parse(message.avatar));
ivAvatar.setImageDrawable(Drawable.createFromStream(is, "avatar"));
if (is != null) {
photo = true;
ivAvatar.setImageDrawable(Drawable.createFromStream(is, "avatar"));
}
}
ivAvatar.setVisibility(!avatars || message.avatar == null ? View.GONE : View.VISIBLE);
ivAvatar.setVisibility(photo ? View.VISIBLE : View.GONE);
if (avatars && message.from != null && message.from.length > 0) {
final long id = message.id;


Loading…
Cancel
Save