prefer server side avatar on quicksy and address book avatar on conversations

This commit is contained in:
Daniel Gultsch 2018-11-22 13:03:13 +01:00
parent f63a209881
commit 65c9dd71c7
1 changed files with 7 additions and 2 deletions

View File

@ -67,12 +67,15 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
if (avatar != null || cachedOnly) { if (avatar != null || cachedOnly) {
return avatar; return avatar;
} }
if (contact.getAvatarFilename() != null) { if (contact.getAvatarFilename() != null && QuickConversationsService.isQuicksy()) {
avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatarFilename(), size); avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatarFilename(), size);
} }
if (avatar == null && contact.getProfilePhoto() != null) { if (avatar == null && contact.getProfilePhoto() != null) {
avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size); avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size);
} }
if (avatar == null && contact.getAvatarFilename() != null) {
avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatarFilename(), size);
}
if (avatar == null) { if (avatar == null) {
avatar = get(contact.getDisplayName(), contact.getJid().asBareJid().toString(), size, false); avatar = get(contact.getDisplayName(), contact.getJid().asBareJid().toString(), size, false);
} }
@ -517,10 +520,12 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
Contact contact = user.getContact(); Contact contact = user.getContact();
if (contact != null) { if (contact != null) {
Uri uri = null; Uri uri = null;
if (contact.getAvatarFilename() != null) { if (contact.getAvatarFilename() != null && QuickConversationsService.isQuicksy()) {
uri = mXmppConnectionService.getFileBackend().getAvatarUri(contact.getAvatarFilename()); uri = mXmppConnectionService.getFileBackend().getAvatarUri(contact.getAvatarFilename());
} else if (contact.getProfilePhoto() != null) { } else if (contact.getProfilePhoto() != null) {
uri = Uri.parse(contact.getProfilePhoto()); uri = Uri.parse(contact.getProfilePhoto());
} else if (contact.getAvatarFilename() != null) {
uri = mXmppConnectionService.getFileBackend().getAvatarUri(contact.getAvatarFilename());
} }
if (drawTile(canvas, uri, left, top, right, bottom)) { if (drawTile(canvas, uri, left, top, right, bottom)) {
return true; return true;