use of org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto in project Signal-Android by signalapp.
the class SingleRecipientNotificationBuilder method setThread.
public void setThread(@NonNull Recipient recipient) {
if (privacy.isDisplayContact()) {
setContentTitle(recipient.toShortString());
if (recipient.getContactUri() != null) {
addPerson(recipient.getContactUri().toString());
}
ContactPhoto contactPhoto = recipient.getContactPhoto();
FallbackContactPhoto fallbackContactPhoto = recipient.getFallbackContactPhoto();
if (contactPhoto != null) {
try {
setLargeIcon(GlideApp.with(context.getApplicationContext()).load(contactPhoto).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().submit(context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width), context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height)).get());
} catch (InterruptedException | ExecutionException e) {
Log.w(TAG, e);
setLargeIcon(fallbackContactPhoto.asDrawable(context, recipient.getColor().toConversationColor(context)));
}
} else {
setLargeIcon(fallbackContactPhoto.asDrawable(context, recipient.getColor().toConversationColor(context)));
}
} else {
setContentTitle(context.getString(R.string.SingleRecipientNotificationBuilder_signal));
setLargeIcon(new GeneratedContactPhoto("Unknown").asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context)));
}
}
use of org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto in project Signal-Android by WhisperSystems.
the class InsightsRepository method getUserAvatar.
@Override
public void getUserAvatar(@NonNull Consumer<InsightsUserAvatar> avatarConsumer) {
SimpleTask.run(() -> {
Recipient self = Recipient.self().resolve();
String name = Optional.fromNullable(self.getDisplayName(context)).or("");
return new InsightsUserAvatar(new ProfileContactPhoto(self, self.getProfileAvatar()), self.getAvatarColor(), new GeneratedContactPhoto(name, R.drawable.ic_profile_outline_40));
}, avatarConsumer::accept);
}
use of org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto in project Signal-Android by signalapp.
the class InsightsRepository method getUserAvatar.
@Override
public void getUserAvatar(@NonNull Consumer<InsightsUserAvatar> avatarConsumer) {
SimpleTask.run(() -> {
Recipient self = Recipient.self().resolve();
String name = Optional.fromNullable(self.getDisplayName(context)).or("");
return new InsightsUserAvatar(new ProfileContactPhoto(self, self.getProfileAvatar()), self.getAvatarColor(), new GeneratedContactPhoto(name, R.drawable.ic_profile_outline_40));
}, avatarConsumer::accept);
}
Aggregations