@Override
public Bitmap downloadContactImage(Context context, Contact contact) {
if (contact != null && TextUtils.isEmpty(contact.getImageURL())) {
return null;
}
Bitmap attachedImage = ImageUtils.getBitMapFromLocalPath(contact.getLocalImageUrl());
if (attachedImage != null) {
return attachedImage;
}
Bitmap bitmap = fileClientService.downloadBitmap(contact, null);
if (bitmap != null) {
File file = FileClientService.getFilePath(contact.getContactIds(), context.getApplicationContext(), "image", true);
String imageLocalPath = ImageUtils.saveImageToInternalStorage(file, bitmap);
contact.setLocalImageUrl(imageLocalPath);
}
if (!TextUtils.isEmpty(contact.getLocalImageUrl())) {
updateLocalImageUri(contact);
}
return bitmap;
}