diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-01-13 16:10:09 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-01-13 16:10:09 +0100 |
commit | 8644c4676a5fda9d642244ff70e72c5fe524a24d (patch) | |
tree | aa3638db5eb30c25cbd250f675a5a1e61b2a99ab /src/main/java/de/thedevstack/conversationsplus/ui/adapter | |
parent | 0fe5ce481fe72d3821a93b2792d6ae16b04bec7d (diff) |
Moved all avatar related work to AvatarService
- fetchAvatar, fetchAvatarPep, fetchAvatarVcard, checkForAvatar moved from XmppConnectionService to AvatarService
- Several unused imports removed
- XmppSendUtil introduced to enable presencePacket and iqPacket sending without using XmppConnectionService since the account has everything needed
- UiUpdateHelper introduced to enable UI updates without using XmppConnectionService directly
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/adapter')
4 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java index 08c9a0e1..6195f47b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java @@ -4,6 +4,7 @@ import java.util.List; import de.thedevstack.conversationsplus.R; import de.thedevstack.conversationsplus.entities.Account; +import de.thedevstack.conversationsplus.services.AvatarService; import de.thedevstack.conversationsplus.ui.XmppActivity; import de.thedevstack.conversationsplus.ui.ManageAccountActivity; import android.content.Context; @@ -37,7 +38,7 @@ public class AccountAdapter extends ArrayAdapter<Account> { jid.setText(account.getJid().toBareJid().toString()); TextView statusView = (TextView) view.findViewById(R.id.account_status); ImageView imageView = (ImageView) view.findViewById(R.id.account_image); - imageView.setImageBitmap(activity.avatarService().get(account, activity.getPixel(48))); + imageView.setImageBitmap(AvatarService.getInstance().get(account, activity.getPixel(48))); statusView.setText(getContext().getString(account.getStatus().getReadableId())); switch (account.getStatus()) { case ONLINE: diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java index 4e361c67..b6d861d4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java @@ -20,8 +20,8 @@ import java.lang.ref.WeakReference; import java.util.List; import java.util.concurrent.RejectedExecutionException; -import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; +import de.thedevstack.conversationsplus.services.AvatarService; import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener; import de.tzur.conversations.Settings; import de.thedevstack.conversationsplus.R; @@ -146,7 +146,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { @Override protected Bitmap doInBackground(Conversation... params) { - return activity.avatarService().get(params[0], activity.getPixel(56)); + return AvatarService.getInstance().get(params[0], activity.getPixel(56)); } @Override @@ -163,7 +163,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { public void loadAvatar(Conversation conversation, ImageView imageView) { if (cancelPotentialWork(conversation, imageView)) { - final Bitmap bm = activity.avatarService().get(conversation, activity.getPixel(56), true); + final Bitmap bm = AvatarService.getInstance().get(conversation, activity.getPixel(56), true); if (bm != null) { imageView.setImageBitmap(bm); imageView.setBackgroundColor(0x00000000); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java index 3f342528..4ecebd84 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.concurrent.RejectedExecutionException; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; +import de.thedevstack.conversationsplus.services.AvatarService; import de.tzur.conversations.Settings; import de.thedevstack.conversationsplus.R; import de.thedevstack.conversationsplus.entities.ListItem; @@ -110,7 +111,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { @Override protected Bitmap doInBackground(ListItem... params) { - return activity.avatarService().get(params[0], activity.getPixel(48)); + return AvatarService.getInstance().get(params[0], activity.getPixel(48)); } @Override @@ -127,7 +128,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { public void loadAvatar(ListItem item, ImageView imageView) { if (cancelPotentialWork(item, imageView)) { - final Bitmap bm = activity.avatarService().get(item,activity.getPixel(48),true); + final Bitmap bm = AvatarService.getInstance().get(item,activity.getPixel(48),true); if (bm != null) { imageView.setImageBitmap(bm); imageView.setBackgroundColor(0x00000000); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java index 9ab7abf0..647ef68d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java @@ -34,6 +34,7 @@ import de.thedevstack.conversationsplus.entities.DownloadableFile; import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.entities.Message.FileParams; import de.thedevstack.conversationsplus.persistance.FileBackend; +import de.thedevstack.conversationsplus.services.AvatarService; import de.thedevstack.conversationsplus.ui.ConversationActivity; import de.thedevstack.conversationsplus.utils.GeoHelper; import de.thedevstack.conversationsplus.utils.UIHelper; @@ -436,8 +437,7 @@ public class MessageAdapter extends ArrayAdapter<Message> { if (type == STATUS) { if (conversation.getMode() == Conversation.MODE_SINGLE) { - viewHolder.contact_picture.setImageBitmap(activity - .avatarService().get(conversation.getContact(), + viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get(conversation.getContact(), activity.getPixel(32))); viewHolder.contact_picture.setAlpha(0.5f); viewHolder.status_message.setText(message.getBody()); @@ -446,14 +446,14 @@ public class MessageAdapter extends ArrayAdapter<Message> { } else if (type == RECEIVED) { Contact contact = message.getContact(); if (contact != null) { - viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(contact, activity.getPixel(48))); + viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get(contact, activity.getPixel(48))); } else if (conversation.getMode() == Conversation.MODE_MULTI) { - viewHolder.contact_picture.setImageBitmap(activity.avatarService().get( + viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get( UIHelper.getMessageDisplayName(message), activity.getPixel(48))); } } else if (type == SENT) { - viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(account, activity.getPixel(48))); + viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get(account, activity.getPixel(48))); } viewHolder.contact_picture |