diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-26 22:37:40 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-26 22:37:40 +0100 |
commit | fb5825bd8696a8a8b651c18000c5c73e0b265254 (patch) | |
tree | 18b74bf60391af1fa1bf7631e35b74f77606ea56 /src/main/java | |
parent | d827482d9085b5e560c5fd6d4287cc3ea9b6fbb7 (diff) |
make avatars from contacts configurable
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AvatarService.java | 15 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/SettingsActivity.java | 1 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AvatarService.java b/src/main/java/de/pixart/messenger/services/AvatarService.java index fc6235a55..f4a9b9818 100644 --- a/src/main/java/de/pixart/messenger/services/AvatarService.java +++ b/src/main/java/de/pixart/messenger/services/AvatarService.java @@ -44,6 +44,7 @@ import de.pixart.messenger.xmpp.XmppConnection; import rocks.xmpp.addr.Jid; import static de.pixart.messenger.Config.SYSTEM_UI_AVATAR_SIZE; +import static de.pixart.messenger.ui.SettingsActivity.PREFER_XMPP_AVATAR; public class AvatarService implements OnAdvancedStreamFeaturesLoaded { @@ -80,15 +81,15 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { if (avatar != null || cachedOnly) { return avatar; } - if (contact.getAvatarFilename() != null && QuickConversationsService.isQuicksy()) { + if (contact.getAvatarFilename() != null && QuickConversationsService.isQuicksy() && mXmppConnectionService.getPreferences().getBoolean(PREFER_XMPP_AVATAR, mXmppConnectionService.getResources().getBoolean(R.bool.prefer_xmpp_avatar))) { + avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatarFilename(), size); + } + if (avatar == null && contact.getAvatarFilename() != null && mXmppConnectionService.getPreferences().getBoolean(PREFER_XMPP_AVATAR, mXmppConnectionService.getResources().getBoolean(R.bool.prefer_xmpp_avatar))) { avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatarFilename(), size); } if (avatar == null && contact.getProfilePhoto() != null) { 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) { avatar = get(contact.getDisplayName(), contact.getJid().asBareJid().toString(), size, false); } @@ -558,12 +559,12 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { Contact contact = user.getContact(); if (contact != null) { Uri uri = null; - if (contact.getAvatarFilename() != null && QuickConversationsService.isQuicksy()) { + if (contact.getAvatarFilename() != null && QuickConversationsService.isQuicksy() && mXmppConnectionService.getPreferences().getBoolean(PREFER_XMPP_AVATAR, mXmppConnectionService.getResources().getBoolean(R.bool.prefer_xmpp_avatar))) { + uri = mXmppConnectionService.getFileBackend().getAvatarUri(contact.getAvatarFilename()); + } else if (contact.getAvatarFilename() != null && mXmppConnectionService.getPreferences().getBoolean(PREFER_XMPP_AVATAR, mXmppConnectionService.getResources().getBoolean(R.bool.prefer_xmpp_avatar))) { uri = mXmppConnectionService.getFileBackend().getAvatarUri(contact.getAvatarFilename()); } else if (contact.getProfilePhoto() != null) { uri = Uri.parse(contact.getProfilePhoto()); - } else if (contact.getAvatarFilename() != null) { - uri = mXmppConnectionService.getFileBackend().getAvatarUri(contact.getAvatarFilename()); } if (drawTile(canvas, uri, left, top, right, bottom)) { return true; diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index a8080f482..37fb8bb6d 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -64,6 +64,7 @@ public class SettingsActivity extends XmppActivity implements public static final String QUICK_SHARE_ATTACHMENT_CHOICE = "quick_share_attachment_choice"; public static final String NUMBER_OF_ACCOUNTS = "number_of_accounts"; public static final String PLAY_GIF_INSIDE = "play_gif_inside"; + public static final String PREFER_XMPP_AVATAR = "prefer_xmpp_avatar"; public static final int REQUEST_CREATE_BACKUP = 0xbf8701; Preference multiAccountPreference; |