aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-12-04 21:36:48 +0100
committerChristian S <christian@pix-art.de>2015-12-06 10:57:23 +0100
commitef97ce119a92355236a49aeccec81872a7452141 (patch)
treeb4ba4506e0e5aa76185c6b5fca35f110a1731562 /src/main/java/eu/siacs/conversations/services
parent7eac947c2bfa387fedc781fed24e8b612236b28a (diff)
properly clear muc user avatar caches
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r--src/main/java/eu/siacs/conversations/services/AvatarService.java22
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java6
2 files changed, 19 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java
index 55d941e00..899cbf9ea 100644
--- a/src/main/java/eu/siacs/conversations/services/AvatarService.java
+++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java
@@ -197,8 +197,7 @@ public class AvatarService {
public void clear(MucOptions options) {
synchronized (this.sizes) {
for (Integer size : sizes) {
- this.mXmppConnectionService.getBitmapCache().remove(
- key(options, size));
+ this.mXmppConnectionService.getBitmapCache().remove(key(options, size));
}
}
}
@@ -253,8 +252,15 @@ public class AvatarService {
public void clear(Account account) {
synchronized (this.sizes) {
for (Integer size : sizes) {
- this.mXmppConnectionService.getBitmapCache().remove(
- key(account, size));
+ this.mXmppConnectionService.getBitmapCache().remove(key(account, size));
+ }
+ }
+ }
+
+ public void clear(MucOptions.User user) {
+ synchronized (this.sizes) {
+ for (Integer size : sizes) {
+ this.mXmppConnectionService.getBitmapCache().remove(key(user, size));
}
}
}
@@ -351,12 +357,12 @@ public class AvatarService {
if (avatar != null) {
Uri uri = mXmppConnectionService.getFileBackend().getAvatarUri(avatar);
if (uri != null) {
- drawTile(canvas, uri, left, top, right, bottom);
+ if (drawTile(canvas, uri, left, top, right, bottom)) {
+ return true;
+ }
}
- } else {
- drawTile(canvas, account.getJid().toBareJid().toString(), left, top, right, bottom);
}
- return true;
+ return drawTile(canvas, account.getJid().toBareJid().toString(), left, top, right, bottom);
}
private boolean drawTile(Canvas canvas, String name, int left, int top, int right, int bottom) {
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 776069568..dbc4825c9 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -2367,7 +2367,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) {
MucOptions.User user = conversation.getMucOptions().findUser(avatar.owner.getResourcepart());
if (user != null) {
- user.setAvatar(avatar);
+ if (user.setAvatar(avatar)) {
+ getAvatarService().clear(user);
+ updateConversationUi();
+ updateMucRosterUi();
+ }
}
}
}