diff options
author | andy <andy@strb.org> | 2014-04-12 01:36:44 +0200 |
---|---|---|
committer | andy <andy@strb.org> | 2014-04-12 03:46:54 +0200 |
commit | c2307337368e37fc3c7fec7d4b2e5cdf3be47212 (patch) | |
tree | adc61cb40591a84ee0228f8b5167afbd4d7f73da /src/eu/siacs/conversations/ui | |
parent | 3d6f03e859cfc4727c68bfda424b58228f4ffa61 (diff) |
More Contact Picture refactors
Use polymorphism to avoid dynamic dispatch based on nulled parameters.
Next up: Prettier MUC icons
Diffstat (limited to 'src/eu/siacs/conversations/ui')
4 files changed, 13 insertions, 6 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 06a72689..20d83961 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -164,8 +164,7 @@ public class ConversationActivity extends XmppActivity { ImageView imageView = (ImageView) view .findViewById(R.id.conversation_image); imageView.setImageBitmap(UIHelper.getContactPicture( - conv.getContact(), conv.getName(useSubject), 200, - activity.getApplicationContext())); + conv, 200, activity.getApplicationContext())); return view; } diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 04fb6f92..3796f83e 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -614,7 +614,12 @@ public class ConversationFragment extends Fragment { if (bitmaps.containsKey(name)) { return bitmaps.get(name); } else { - Bitmap bm = UIHelper.getContactPicture(contact, name, 200, context); + Bitmap bm; + if (contact != null){ + bm = UIHelper.getContactPicture(contact, 200, context); + } else { + bm = UIHelper.getContactPicture(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 bf36f156..b5ecd796 100644 --- a/src/eu/siacs/conversations/ui/MucDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/MucDetailsActivity.java @@ -179,7 +179,7 @@ public class MucDetailsActivity extends XmppActivity { role.setText(getReadableRole(contact.getRole())); ImageView imageView = (ImageView) view .findViewById(R.id.contact_photo); - imageView.setImageBitmap(UIHelper.getContactPicture(null,contact.getName(), 90,this.getApplicationContext())); + imageView.setImageBitmap(UIHelper.getContactPicture(contact.getName(), 89,this.getApplicationContext())); membersView.addView(view); } } diff --git a/src/eu/siacs/conversations/ui/ShareWithActivity.java b/src/eu/siacs/conversations/ui/ShareWithActivity.java index 51bad721..3a630485 100644 --- a/src/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/eu/siacs/conversations/ui/ShareWithActivity.java @@ -81,7 +81,9 @@ public class ShareWithActivity extends XmppActivity { } }); for(final Conversation conversation : convList) { - View view = createContactView(conversation.getName(useSubject), conversation.getLatestMessage().getBody().trim(), UIHelper.getContactPicture(conversation.getContact(),conversation.getName(useSubject), 90,this.getApplicationContext())); + View view = createContactView(conversation.getName(useSubject), + conversation.getLatestMessage().getBody().trim(), + UIHelper.getContactPicture(conversation, 90,this.getApplicationContext())); view.setOnClickListener(new OnClickListener() { @Override @@ -115,7 +117,8 @@ public class ShareWithActivity extends XmppActivity { for(int i = 0; i < contactsList.size(); ++i) { final Contact con = contactsList.get(i); - View view = createContactView(con.getDisplayName(), con.getJid(), UIHelper.getContactPicture(con,null, 90,this.getApplicationContext())); + View view = createContactView(con.getDisplayName(), con.getJid(), + UIHelper.getContactPicture(con, 90, this.getApplicationContext())); view.setOnClickListener(new OnClickListener() { @Override |