aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-02-18 18:12:43 +0100
committeriNPUTmice <daniel@gultsch.de>2015-02-18 18:12:43 +0100
commit9c2e6392ec0920e6c594aae7b784397d94cf5ba2 (patch)
tree3b6d4b9482f4eba6f02f34099eff1818b940f2ba /src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
parentb128b33e56d56920d3d5c1327eb15610e5b536f2 (diff)
always call to cancel before loading new avatars
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
index 00f90382..3e747b0a 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
@@ -135,18 +135,20 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
}
public void loadAvatar(Conversation conversation, ImageView imageView) {
- Bitmap bm = activity.avatarService().get(conversation,activity.getPixel(56),true);
- if (bm != null) {
- imageView.setImageBitmap(bm);
- imageView.setBackgroundColor(0x00000000);
- } else if (cancelPotentialWork(conversation, imageView)) {
- imageView.setBackgroundColor(UIHelper.getColorForName(conversation.getName()));
- final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
- final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
- imageView.setImageDrawable(asyncDrawable);
- try {
- task.execute(conversation);
- } catch (final RejectedExecutionException ignored) {
+ if (cancelPotentialWork(conversation, imageView)) {
+ final Bitmap bm = activity.avatarService().get(conversation, activity.getPixel(56), true);
+ if (bm != null) {
+ imageView.setImageBitmap(bm);
+ imageView.setBackgroundColor(0x00000000);
+ } else {
+ imageView.setBackgroundColor(UIHelper.getColorForName(conversation.getName()));
+ final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
+ final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
+ imageView.setImageDrawable(asyncDrawable);
+ try {
+ task.execute(conversation);
+ } catch (final RejectedExecutionException ignored) {
+ }
}
}
}