removed unnecessary uihelper method

This commit is contained in:
Daniel Gultsch 2014-03-13 13:28:16 +01:00
parent eec3906692
commit 53fa87b414
5 changed files with 7 additions and 16 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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;
}
};

View file

@ -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);
}
}