mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Separate avatar colors from chat colors.
This commit is contained in:
@@ -65,12 +65,11 @@ public class InsightsRepository implements InsightsDashboardViewModel.Repository
|
||||
@Override
|
||||
public void getUserAvatar(@NonNull Consumer<InsightsUserAvatar> avatarConsumer) {
|
||||
SimpleTask.run(() -> {
|
||||
Recipient self = Recipient.self().resolve();
|
||||
String name = Optional.fromNullable(self.getDisplayName(context)).or("");
|
||||
ChatColors fallbackColor = self.getChatColors();
|
||||
Recipient self = Recipient.self().resolve();
|
||||
String name = Optional.fromNullable(self.getDisplayName(context)).or("");
|
||||
|
||||
return new InsightsUserAvatar(new ProfileContactPhoto(self, self.getProfileAvatar()),
|
||||
fallbackColor,
|
||||
self.getAvatarColor(),
|
||||
new GeneratedContactPhoto(name, R.drawable.ic_profile_outline_40));
|
||||
}, avatarConsumer::accept);
|
||||
}
|
||||
|
||||
@@ -10,22 +10,22 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
|
||||
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.ProfileContactPhoto;
|
||||
import org.thoughtcrime.securesms.conversation.colors.ChatColors;
|
||||
import org.thoughtcrime.securesms.conversation.colors.AvatarColor;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
|
||||
class InsightsUserAvatar {
|
||||
private final ProfileContactPhoto profileContactPhoto;
|
||||
private final ChatColors fallbackColor;
|
||||
private final AvatarColor fallbackColor;
|
||||
private final FallbackContactPhoto fallbackContactPhoto;
|
||||
|
||||
InsightsUserAvatar(@NonNull ProfileContactPhoto profileContactPhoto, @NonNull ChatColors fallbackColor, @NonNull FallbackContactPhoto fallbackContactPhoto) {
|
||||
InsightsUserAvatar(@NonNull ProfileContactPhoto profileContactPhoto, @NonNull AvatarColor fallbackColor, @NonNull FallbackContactPhoto fallbackContactPhoto) {
|
||||
this.profileContactPhoto = profileContactPhoto;
|
||||
this.fallbackColor = fallbackColor;
|
||||
this.fallbackContactPhoto = fallbackContactPhoto;
|
||||
}
|
||||
|
||||
private Drawable fallbackDrawable(@NonNull Context context) {
|
||||
return fallbackContactPhoto.asDrawable(context, fallbackColor);
|
||||
return fallbackContactPhoto.asDrawable(context, fallbackColor.colorInt());
|
||||
}
|
||||
|
||||
void load(ImageView into) {
|
||||
|
||||
Reference in New Issue
Block a user