mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 15:07:20 +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() {
|
private void initializeProfileIcon() {
|
||||||
ImageView icon = findViewById(R.id.toolbar_icon);
|
ImageView icon = findViewById(R.id.toolbar_icon);
|
||||||
Address localAddress = Address.fromSerialized(TextSecurePreferences.getLocalNumber(this));
|
Address localAddress = Address.fromSerialized(TextSecurePreferences.getLocalNumber(this));
|
||||||
String profileName = Optional.fromNullable(TextSecurePreferences.getProfileName(this)).or("");
|
Recipient recipient = Recipient.from(this, localAddress, true);
|
||||||
MaterialColor fallbackColor = TextUtils.isEmpty(profileName) ? MaterialColor.STEEL : ContactColors.generateFor(profileName);
|
String name = Optional.fromNullable(recipient.getName()).or(Optional.fromNullable(TextSecurePreferences.getProfileName(this))).or("");
|
||||||
Drawable fallback = new GeneratedContactPhoto(profileName, R.drawable.ic_profile_default).asDrawable(this, fallbackColor.toAvatarColor(this));
|
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)
|
GlideApp.with(this)
|
||||||
.load(new ProfileContactPhoto(localAddress, String.valueOf(TextSecurePreferences.getProfileAvatarId(this))))
|
.load(new ProfileContactPhoto(localAddress, String.valueOf(TextSecurePreferences.getProfileAvatarId(this))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user