|
|
@ -73,17 +73,13 @@ public class RecipientProvider {
|
|
|
|
else details = getRecipientDetails(context, number);
|
|
|
|
else details = getRecipientDetails(context, number);
|
|
|
|
|
|
|
|
|
|
|
|
if (details != null) {
|
|
|
|
if (details != null) {
|
|
|
|
recipient = new Recipient(details.name, details.number, recipientId, details.contactUri, details.avatar,
|
|
|
|
recipient = new Recipient(details.name, details.number, recipientId, details.contactUri, details.avatar);
|
|
|
|
details.croppedAvatar);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
final Bitmap defaultPhoto = isGroupRecipient
|
|
|
|
final Bitmap defaultPhoto = isGroupRecipient
|
|
|
|
? ContactPhotoFactory.getDefaultGroupPhoto(context)
|
|
|
|
? ContactPhotoFactory.getDefaultGroupPhoto(context)
|
|
|
|
: ContactPhotoFactory.getDefaultContactPhoto(context);
|
|
|
|
: ContactPhotoFactory.getDefaultContactPhoto(context);
|
|
|
|
final Bitmap defaultCroppedPhoto = isGroupRecipient
|
|
|
|
|
|
|
|
? ContactPhotoFactory.getDefaultGroupPhotoCropped(context)
|
|
|
|
|
|
|
|
: ContactPhotoFactory.getDefaultContactPhotoCropped(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recipient = new Recipient(null, number, recipientId, null, defaultPhoto, defaultCroppedPhoto);
|
|
|
|
recipient = new Recipient(null, number, recipientId, null, defaultPhoto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
recipientCache.put(recipientId, recipient);
|
|
|
|
recipientCache.put(recipientId, recipient);
|
|
|
@ -109,17 +105,14 @@ public class RecipientProvider {
|
|
|
|
asyncRecipientResolver.submit(future);
|
|
|
|
asyncRecipientResolver.submit(future);
|
|
|
|
|
|
|
|
|
|
|
|
Bitmap contactPhoto;
|
|
|
|
Bitmap contactPhoto;
|
|
|
|
Bitmap contactPhotoCropped;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isGroupRecipient) {
|
|
|
|
if (isGroupRecipient) {
|
|
|
|
contactPhoto = ContactPhotoFactory.getDefaultGroupPhoto(context);
|
|
|
|
contactPhoto = ContactPhotoFactory.getDefaultGroupPhoto(context);
|
|
|
|
contactPhotoCropped = ContactPhotoFactory.getDefaultGroupPhotoCropped(context);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
contactPhoto = ContactPhotoFactory.getDefaultContactPhoto(context);
|
|
|
|
contactPhoto = ContactPhotoFactory.getDefaultContactPhoto(context);
|
|
|
|
contactPhotoCropped = ContactPhotoFactory.getDefaultContactPhotoCropped(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Recipient recipient = new Recipient(number, contactPhoto, contactPhotoCropped, recipientId, future);
|
|
|
|
Recipient recipient = new Recipient(number, contactPhoto, recipientId, future);
|
|
|
|
recipientCache.put(recipientId, recipient);
|
|
|
|
recipientCache.put(recipientId, recipient);
|
|
|
|
|
|
|
|
|
|
|
|
return recipient;
|
|
|
|
return recipient;
|
|
|
@ -144,8 +137,7 @@ public class RecipientProvider {
|
|
|
|
Uri contactUri = Contacts.getLookupUri(cursor.getLong(2), cursor.getString(1));
|
|
|
|
Uri contactUri = Contacts.getLookupUri(cursor.getLong(2), cursor.getString(1));
|
|
|
|
Bitmap contactPhoto = ContactPhotoFactory.getContactPhoto(context, Uri.withAppendedPath(Contacts.CONTENT_URI,
|
|
|
|
Bitmap contactPhoto = ContactPhotoFactory.getContactPhoto(context, Uri.withAppendedPath(Contacts.CONTENT_URI,
|
|
|
|
cursor.getLong(2)+""));
|
|
|
|
cursor.getLong(2)+""));
|
|
|
|
return new RecipientDetails(cursor.getString(0), cursor.getString(3), contactUri, contactPhoto,
|
|
|
|
return new RecipientDetails(cursor.getString(0), cursor.getString(3), contactUri, contactPhoto);
|
|
|
|
BitmapUtil.getCircleCroppedBitmap(contactPhoto));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
if (cursor != null)
|
|
|
|
if (cursor != null)
|
|
|
@ -167,7 +159,7 @@ public class RecipientProvider {
|
|
|
|
if (avatarBytes == null) avatar = ContactPhotoFactory.getDefaultGroupPhoto(context);
|
|
|
|
if (avatarBytes == null) avatar = ContactPhotoFactory.getDefaultGroupPhoto(context);
|
|
|
|
else avatar = BitmapFactory.decodeByteArray(avatarBytes, 0, avatarBytes.length);
|
|
|
|
else avatar = BitmapFactory.decodeByteArray(avatarBytes, 0, avatarBytes.length);
|
|
|
|
|
|
|
|
|
|
|
|
return new RecipientDetails(record.getTitle(), groupId, null, avatar, BitmapUtil.getCircleCroppedBitmap(avatar));
|
|
|
|
return new RecipientDetails(record.getTitle(), groupId, null, avatar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
@ -181,14 +173,12 @@ public class RecipientProvider {
|
|
|
|
public final String name;
|
|
|
|
public final String name;
|
|
|
|
public final String number;
|
|
|
|
public final String number;
|
|
|
|
public final Bitmap avatar;
|
|
|
|
public final Bitmap avatar;
|
|
|
|
public final Bitmap croppedAvatar;
|
|
|
|
|
|
|
|
public final Uri contactUri;
|
|
|
|
public final Uri contactUri;
|
|
|
|
|
|
|
|
|
|
|
|
public RecipientDetails(String name, String number, Uri contactUri, Bitmap avatar, Bitmap croppedAvatar) {
|
|
|
|
public RecipientDetails(String name, String number, Uri contactUri, Bitmap avatar) {
|
|
|
|
this.name = name;
|
|
|
|
this.name = name;
|
|
|
|
this.number = number;
|
|
|
|
this.number = number;
|
|
|
|
this.avatar = avatar;
|
|
|
|
this.avatar = avatar;
|
|
|
|
this.croppedAvatar = croppedAvatar;
|
|
|
|
|
|
|
|
this.contactUri = contactUri;
|
|
|
|
this.contactUri = contactUri;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|