|
|
|
@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
|
|
|
|
|
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
|
|
|
|
import org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto;
|
|
|
|
|
import org.thoughtcrime.securesms.logging.Log;
|
|
|
|
|
import org.thoughtcrime.securesms.loki.todo.AvatarPlaceholderGenerator;
|
|
|
|
|
import org.thoughtcrime.securesms.loki.utilities.NotificationUtilities;
|
|
|
|
|
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader;
|
|
|
|
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
|
|
|
@ -80,9 +81,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
|
|
|
|
addPerson(recipient.getContactUri().toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContactPhoto contactPhoto = recipient.getContactPhoto();
|
|
|
|
|
FallbackContactPhoto fallbackContactPhoto = recipient.getFallbackContactPhoto();
|
|
|
|
|
|
|
|
|
|
ContactPhoto contactPhoto = recipient.getContactPhoto();
|
|
|
|
|
if (contactPhoto != null) {
|
|
|
|
|
try {
|
|
|
|
|
setLargeIcon(GlideApp.with(context.getApplicationContext())
|
|
|
|
@ -94,10 +93,10 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
|
|
|
|
.get());
|
|
|
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
|
|
|
Log.w(TAG, e);
|
|
|
|
|
setLargeIcon(fallbackContactPhoto.asDrawable(context, recipient.getColor().toConversationColor(context)));
|
|
|
|
|
setLargeIcon(obtainAvatarPlaceholderDrawable(context, recipient));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setLargeIcon(fallbackContactPhoto.asDrawable(context, recipient.getColor().toConversationColor(context)));
|
|
|
|
|
setLargeIcon(obtainAvatarPlaceholderDrawable(context, recipient));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
@ -321,4 +320,14 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
|
|
|
|
return content;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Drawable obtainAvatarPlaceholderDrawable(Context context, Recipient recipient) {
|
|
|
|
|
//TODO Copied from ProfilePictureView#setProfilePictureIfNeeded
|
|
|
|
|
// Refactor this code to use the same recipient placeholder generator method across the app.
|
|
|
|
|
String publicKey = recipient.getAddress().serialize();
|
|
|
|
|
String hepk = (recipient.isLocalNumber() && publicKey != null)
|
|
|
|
|
? TextSecurePreferences.getMasterHexEncodedPublicKey(context)
|
|
|
|
|
: publicKey;
|
|
|
|
|
String displayName = recipient.getName();
|
|
|
|
|
return AvatarPlaceholderGenerator.INSTANCE.generate(context, 128, hepk, displayName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|