From 3d6f03e859cfc4727c68bfda424b58228f4ffa61 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 11 Apr 2014 22:30:50 +0200 Subject: Refactor UIHelper to use getContactPicture Normalize the interface, reduce code duplication --- src/eu/siacs/conversations/utils/UIHelper.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src/eu/siacs/conversations/utils') 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( -- cgit v1.2.3