diff options
author | andy <andy@strb.org> | 2014-04-11 22:30:50 +0200 |
---|---|---|
committer | andy <andy@strb.org> | 2014-04-12 03:46:43 +0200 |
commit | 3d6f03e859cfc4727c68bfda424b58228f4ffa61 (patch) | |
tree | 5d3d382de44afb7e3ecfbd148f450d22ace87458 /src/eu/siacs | |
parent | 259bb446cac55ea7367488dfd63eb2b8a3eb6139 (diff) |
Refactor UIHelper to use getContactPicture
Normalize the interface, reduce code duplication
Diffstat (limited to 'src/eu/siacs')
-rw-r--r-- | src/eu/siacs/conversations/ui/ContactDetailsActivity.java | 2 | ||||
-rw-r--r-- | src/eu/siacs/conversations/utils/UIHelper.java | 16 |
2 files changed, 4 insertions, 14 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java index 5dc6eb3b..86535ba1 100644 --- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -230,7 +230,7 @@ public class ContactDetailsActivity extends XmppActivity { contactJid.setText(contact.getJid()); accountJid.setText(contact.getAccount().getJid()); - UIHelper.prepareContactBadge(this, badge, contact); + UIHelper.prepareContactBadge(this, badge, contact, getApplicationContext()); if (contact.getSystemAccount() == null) { badge.setOnClickListener(onBadgeClick); diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 73a0494b..0d0e7b91 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -260,7 +260,7 @@ public class UIHelper { if (notify) { if (vibrate) { int dat = 70; - long[] pattern = {0,3*dat,dat,dat,dat,3*dat,dat,dat}; + long[] pattern = {0,3*dat,dat,dat}; mBuilder.setVibrate(pattern); } mBuilder.setLights(0xffffffff, 2000, 4000); @@ -307,23 +307,13 @@ public class UIHelper { } public static void prepareContactBadge(final Activity activity, - QuickContactBadge badge, final Contact contact) { + QuickContactBadge badge, final Contact contact, Context context) { if (contact.getSystemAccount() != null) { String[] systemAccount = contact.getSystemAccount().split("#"); long id = Long.parseLong(systemAccount[0]); badge.assignContactUri(Contacts.getLookupUri(id, systemAccount[1])); - - if (contact.getProfilePhoto() != null) { - badge.setImageURI(Uri.parse(contact.getProfilePhoto())); - } else { - badge.setImageBitmap(UIHelper.getUnknownContactPicture( - contact.getDisplayName(), 400)); - } - } else { - badge.setImageBitmap(UIHelper.getUnknownContactPicture( - contact.getDisplayName(), 400)); } - + badge.setImageBitmap(UIHelper.getContactPicture(contact, "", 400, context)); } public static AlertDialog getVerifyFingerprintDialog( |