mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Correctly load group avatars in RecipientPreferencesActivity
Fixes #7102 // FREEBIE
This commit is contained in:
parent
e87aa85bae
commit
7a8bd0597a
@ -216,10 +216,20 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
|||||||
Uri contentUri = ContactsContract.Contacts.lookupContact(getContentResolver(), recipient.getContactUri());
|
Uri contentUri = ContactsContract.Contacts.lookupContact(getContentResolver(), recipient.getContactUri());
|
||||||
windowManager.getDefaultDisplay().getMetrics(metrics);
|
windowManager.getDefaultDisplay().getMetrics(metrics);
|
||||||
|
|
||||||
|
if (recipient.isGroupRecipient()) {
|
||||||
|
Optional<GroupDatabase.GroupRecord> groupRecord = DatabaseFactory.getGroupDatabase(RecipientPreferenceActivity.this).getGroup(recipient.getAddress().toGroupString());
|
||||||
|
|
||||||
|
if (groupRecord.isPresent() && groupRecord.get().getAvatar() != null) {
|
||||||
|
return ContactPhotoFactory.getGroupContactPhoto(groupRecord.get().getAvatar());
|
||||||
|
} else {
|
||||||
|
return ContactPhotoFactory.getDefaultGroupPhoto();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
return ContactPhotoFactory.getContactPhoto(RecipientPreferenceActivity.this, contentUri,
|
return ContactPhotoFactory.getContactPhoto(RecipientPreferenceActivity.this, contentUri,
|
||||||
recipient.getAddress(), recipient.getName(),
|
recipient.getAddress(), recipient.getName(),
|
||||||
metrics.widthPixels);
|
metrics.widthPixels);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void onPostExecute(@NonNull ContactPhoto contactPhoto) {
|
protected void onPostExecute(@NonNull ContactPhoto contactPhoto) {
|
||||||
if (contactPhoto.isGenerated() || contactPhoto.isResource()) avatar.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
if (contactPhoto.isGenerated() || contactPhoto.isResource()) avatar.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||||
|
Loading…
Reference in New Issue
Block a user