mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-24 07:59:14 +00:00
Display contact color in background for generated avatars
Fixes #7028 // FREEBIE
This commit is contained in:
@@ -36,6 +36,7 @@ import android.widget.TextView;
|
||||
import org.thoughtcrime.securesms.color.MaterialColor;
|
||||
import org.thoughtcrime.securesms.color.MaterialColors;
|
||||
import org.thoughtcrime.securesms.components.ThreadPhotoRailView;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyParcelable;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
@@ -203,7 +204,13 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
}
|
||||
|
||||
private void setHeader(@NonNull Recipient recipient) {
|
||||
this.avatar.setImageDrawable(recipient.getContactPhoto().asCallCard(this));
|
||||
ContactPhoto contactPhoto = recipient.getContactPhoto();
|
||||
|
||||
if (contactPhoto.isGenerated() || contactPhoto.isResource()) this.avatar.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
else this.avatar.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
this.avatar.setImageDrawable(contactPhoto.asCallCard(this));
|
||||
this.avatar.setBackgroundColor(recipient.getColor().toActionBarColor(this));
|
||||
this.toolbarLayout.setTitle(recipient.toShortString());
|
||||
this.toolbarLayout.setContentScrimColor(recipient.getColor().toActionBarColor(this));
|
||||
}
|
||||
|
||||
@@ -37,4 +37,9 @@ public class BitmapContactPhoto implements ContactPhoto {
|
||||
public boolean isGenerated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResource() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,6 @@ public interface ContactPhoto {
|
||||
public Drawable asDrawable(Context context, int color, boolean inverted);
|
||||
public Drawable asCallCard(Context context);
|
||||
public boolean isGenerated();
|
||||
public boolean isResource();
|
||||
|
||||
}
|
||||
|
||||
@@ -55,4 +55,9 @@ public class GeneratedContactPhoto implements ContactPhoto {
|
||||
public boolean isGenerated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResource() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,11 @@ public class ResourceContactPhoto implements ContactPhoto {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResource() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class ExpandingLayerDrawable extends LayerDrawable {
|
||||
public ExpandingLayerDrawable(Drawable[] layers) {
|
||||
super(layers);
|
||||
|
||||
@@ -31,4 +31,9 @@ public class TransparentContactPhoto implements ContactPhoto {
|
||||
public boolean isGenerated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResource() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user