diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AvatarService.java | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AvatarService.java b/src/main/java/de/pixart/messenger/services/AvatarService.java index 96114727e..e7096a558 100644 --- a/src/main/java/de/pixart/messenger/services/AvatarService.java +++ b/src/main/java/de/pixart/messenger/services/AvatarService.java @@ -8,6 +8,7 @@ import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.Typeface; import android.net.Uri; +import android.support.annotation.Nullable; import android.util.DisplayMetrics; import android.util.Log; import android.util.LruCache; @@ -145,8 +146,13 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { this.sizes.add(size); } } - return PREFIX_CONTACT + "_" + contact.getAccount().getJid().asBareJid() + "_" - + contact.getJid() + "_" + String.valueOf(size); + return PREFIX_CONTACT + + '\0' + + contact.getAccount().getJid().asBareJid() + + '\0' + + emptyOnNull(contact.getJid()) + + '\0' + + size; } private String key(MucOptions.User user, int size) { @@ -155,8 +161,15 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { this.sizes.add(size); } } - return PREFIX_CONTACT + "_" + user.getAccount().getJid().asBareJid() + "_" - + user.getFullJid() + "_" + String.valueOf(size); + return PREFIX_CONTACT + + '\0' + + user.getAccount().getJid().asBareJid() + + '\0' + + emptyOnNull(user.getFullJid()) + + '\0' + + emptyOnNull(user.getRealJid()) + + '\0' + + size; } public Bitmap get(ListItem item, int size) { @@ -298,10 +311,12 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { for (MucOptions.User user : users) { builder.append("\0"); - builder.append(user.getRealJid() == null ? "" : user.getRealJid().asBareJid().toString()); + builder.append(emptyOnNull(user.getRealJid())); builder.append("\0"); - builder.append(user.getFullJid() == null ? "" : user.getFullJid().toString()); + builder.append(emptyOnNull(user.getFullJid())); } + builder.append('\0'); + builder.append(size); final String key = builder.toString(); synchronized (this.conversationDependentKeys) { Set<String> keys; @@ -441,8 +456,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { return true; } - private boolean drawTile(Canvas canvas, MucOptions.User user, int left, - int top, int right, int bottom) { + private boolean drawTile(Canvas canvas, MucOptions.User user, int left, int top, int right, int bottom) { Contact contact = user.getContact(); if (contact != null) { Uri uri = null; @@ -542,4 +556,8 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { } } } + + private static String emptyOnNull(@Nullable Jid value) { + return value == null ? "" : value.toString(); + } } |