From fe78f858bacf54f8285db31b7d6aa65ff3628f15 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 16 May 2016 01:35:46 +0200 Subject: avatar displayed as a circle, positioning adjusted, colors changed back to correct ones, positioning moved to own class file --- .../conversationsplus/services/AvatarService.java | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/main/java/de/thedevstack/conversationsplus/services') diff --git a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java b/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java index ed9c259f..1ab1dfd6 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java @@ -156,8 +156,32 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { } } + public Bitmap getCircled(Conversation conversation, int size) { + return getCircled(conversation, size, false); + } + + private Bitmap getCircled(Conversation conversation, int size, boolean cachedOnly) { + Bitmap squareAvatar = get(conversation, size, cachedOnly); + String key = ""; + if (conversation.getMode() == Conversation.MODE_SINGLE) { + key = key(conversation.getContact(), size); + } else { + key = key(conversation.getMucOptions(), size); + } + key += "_circle"; + + Bitmap circleAvatar = ImageUtil.getBitmapFromCache(key); + if (null != circleAvatar || cachedOnly) { + return circleAvatar; + } + circleAvatar = ImageUtil.getCircleBitmap(squareAvatar); + ImageUtil.addBitmapToCache(key, circleAvatar); + + return circleAvatar; + } + public Bitmap get(Conversation conversation, int size) { - return get(conversation,size,false); + return get(conversation, size, false); } public Bitmap get(Conversation conversation, int size, boolean cachedOnly) { -- cgit v1.2.3