mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Make avatar color in toolbar match conversation color.
Relates to #8252
This commit is contained in:
parent
43ebcfdee5
commit
eb11d5ceda
@ -177,9 +177,15 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||
private void initializeProfileIcon() {
|
||||
ImageView icon = findViewById(R.id.toolbar_icon);
|
||||
Address localAddress = Address.fromSerialized(TextSecurePreferences.getLocalNumber(this));
|
||||
String profileName = Optional.fromNullable(TextSecurePreferences.getProfileName(this)).or("");
|
||||
MaterialColor fallbackColor = TextUtils.isEmpty(profileName) ? MaterialColor.STEEL : ContactColors.generateFor(profileName);
|
||||
Drawable fallback = new GeneratedContactPhoto(profileName, R.drawable.ic_profile_default).asDrawable(this, fallbackColor.toAvatarColor(this));
|
||||
Recipient recipient = Recipient.from(this, localAddress, true);
|
||||
String name = Optional.fromNullable(recipient.getName()).or(Optional.fromNullable(TextSecurePreferences.getProfileName(this))).or("");
|
||||
MaterialColor fallbackColor = recipient.getColor();
|
||||
|
||||
if (fallbackColor == ContactColors.UNKNOWN_COLOR && !TextUtils.isEmpty(name)) {
|
||||
fallbackColor = ContactColors.generateFor(name);
|
||||
}
|
||||
|
||||
Drawable fallback = new GeneratedContactPhoto(name, R.drawable.ic_profile_default).asDrawable(this, fallbackColor.toAvatarColor(this));
|
||||
|
||||
GlideApp.with(this)
|
||||
.load(new ProfileContactPhoto(localAddress, String.valueOf(TextSecurePreferences.getProfileAvatarId(this))))
|
||||
|
Loading…
Reference in New Issue
Block a user