From 53fa87b414b87de73a79f0e60aa1a4d7d21c3dc9 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 13 Mar 2014 13:28:16 +0100 Subject: [PATCH] removed unnecessary uihelper method --- .../siacs/conversations/ui/ConversationActivity.java | 2 +- .../siacs/conversations/ui/ConversationFragment.java | 7 +------ src/eu/siacs/conversations/ui/MucDetailsActivity.java | 2 +- .../conversations/ui/NewConversationActivity.java | 2 +- src/eu/siacs/conversations/utils/UIHelper.java | 10 +++------- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index a4309cd00..e471d46dc 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -179,7 +179,7 @@ public class ConversationActivity extends XmppActivity { .setText(UIHelper.readableTimeDifference(conv.getLatestMessage().getTimeSent())); ImageView imageView = (ImageView) view.findViewById(R.id.conversation_image); - imageView.setImageBitmap(UIHelper.getContactPicture(getItem(position).getContact(), 200, activity.getApplicationContext())); + imageView.setImageBitmap(UIHelper.getContactPicture(conv.getContact(), conv.getName(),200, activity.getApplicationContext())); return view; } diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 208f6f6f3..2aabec873 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -563,12 +563,7 @@ public class ConversationFragment extends Fragment { if (bitmaps.containsKey(name)) { return bitmaps.get(name); } else { - Bitmap bm; - if (contact == null) { - bm = UIHelper.getContactPictureByName(name, 200); - } else { - bm = UIHelper.getContactPicture(contact, 200, context); - } + Bitmap bm = UIHelper.getContactPicture(contact, name, 200, context); bitmaps.put(name, bm); return bm; } diff --git a/src/eu/siacs/conversations/ui/MucDetailsActivity.java b/src/eu/siacs/conversations/ui/MucDetailsActivity.java index 124fdadc7..5bd3556cd 100644 --- a/src/eu/siacs/conversations/ui/MucDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/MucDetailsActivity.java @@ -162,7 +162,7 @@ public class MucDetailsActivity extends XmppActivity { role.setText(getReadableRole(contact.getRole())); ImageView imageView = (ImageView) view .findViewById(R.id.contact_photo); - imageView.setImageBitmap(UIHelper.getContactPictureByName(contact.getName(), 90)); + imageView.setImageBitmap(UIHelper.getContactPicture(null,contact.getName(), 90,this.getApplicationContext())); membersView.addView(view); } } diff --git a/src/eu/siacs/conversations/ui/NewConversationActivity.java b/src/eu/siacs/conversations/ui/NewConversationActivity.java index e4fb6d146..0ad830ece 100644 --- a/src/eu/siacs/conversations/ui/NewConversationActivity.java +++ b/src/eu/siacs/conversations/ui/NewConversationActivity.java @@ -137,7 +137,7 @@ public class NewConversationActivity extends XmppActivity { contactJid.setText(contact.getJid()); ImageView imageView = (ImageView) view .findViewById(R.id.contact_photo); - imageView.setImageBitmap(UIHelper.getContactPicture(contact,90,this.getContext())); + imageView.setImageBitmap(UIHelper.getContactPicture(contact,null,90,this.getContext())); return view; } }; diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 528a0bb2e..544f94298 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -91,9 +91,9 @@ public class UIHelper { return bitmap; } - public static Bitmap getContactPicture(Contact contact, int size, Context context) { + public static Bitmap getContactPicture(Contact contact, String fallback, int size, Context context) { if (contact==null) { - return getUnknownContactPicture(contact.getDisplayName(), size); + return getUnknownContactPicture(fallback, size); } String uri = contact.getProfilePhoto(); if (uri==null) { @@ -171,7 +171,7 @@ public class UIHelper { conversation.getName(), (int) res .getDimension(android.R.dimen.notification_large_icon_width)));*/ - mBuilder.setLargeIcon(UIHelper.getContactPicture(conversation.getContact(), (int) res + mBuilder.setLargeIcon(UIHelper.getContactPicture(conversation.getContact(), conversation.getName(), (int) res .getDimension(android.R.dimen.notification_large_icon_width), context)); mBuilder.setContentTitle(conversation.getName()); if (notify) { @@ -315,8 +315,4 @@ public class UIHelper { } return getUnknownContactPicture(account.getJid(), size); } - - public static Bitmap getContactPictureByName(String name, int size) { - return getUnknownContactPicture(name, size); - } }