aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java26
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java26
2 files changed, 28 insertions, 24 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) {
+ }
}
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
index 254721e5..60e47019 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
@@ -121,18 +121,20 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
}
public void loadAvatar(ListItem item, ImageView imageView) {
- Bitmap bm = activity.avatarService().get(item,activity.getPixel(48),true);
- if (bm != null) {
- imageView.setImageBitmap(bm);
- imageView.setBackgroundColor(0x00000000);
- } else if (cancelPotentialWork(item, imageView)) {
- imageView.setBackgroundColor(UIHelper.getColorForName(item.getDisplayName()));
- final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
- final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
- imageView.setImageDrawable(asyncDrawable);
- try {
- task.execute(item);
- } catch (final RejectedExecutionException ignored) {
+ if (cancelPotentialWork(item, imageView)) {
+ final Bitmap bm = activity.avatarService().get(item,activity.getPixel(48),true);
+ if (bm != null) {
+ imageView.setImageBitmap(bm);
+ imageView.setBackgroundColor(0x00000000);
+ } else {
+ imageView.setBackgroundColor(UIHelper.getColorForName(item.getDisplayName()));
+ final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
+ final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
+ imageView.setImageDrawable(asyncDrawable);
+ try {
+ task.execute(item);
+ } catch (final RejectedExecutionException ignored) {
+ }
}
}
}