Fix emoji avatar missing after edit.

This commit is contained in:
Lucio Maciel
2021-09-16 13:40:51 -03:00
committed by Alex Hart
parent 5e968eb831
commit 18ba5fa291
15 changed files with 181 additions and 69 deletions

View File

@@ -45,7 +45,7 @@ public class GeneratedContactPhoto implements FallbackContactPhoto {
@Override
public Drawable asDrawable(@NonNull Context context, @NonNull AvatarColor color, boolean inverted) {
int targetSize = this.targetSize != -1
int targetSize = this.targetSize > 0
? this.targetSize
: context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);
@@ -54,7 +54,7 @@ public class GeneratedContactPhoto implements FallbackContactPhoto {
if (!TextUtils.isEmpty(character)) {
Avatars.ForegroundColor foregroundColor = Avatars.getForegroundColor(color);
Avatar.Text avatar = new Avatar.Text(character, new Avatars.ColorPair(color, foregroundColor), Avatar.DatabaseId.DoNotPersist.INSTANCE);
Drawable foreground = AvatarRenderer.createTextDrawable(context, avatar, inverted, targetSize);
Drawable foreground = AvatarRenderer.createTextDrawable(context, avatar, inverted, targetSize, false);
Drawable background = Objects.requireNonNull(ContextCompat.getDrawable(context, R.drawable.circle_tintable));
background.setColorFilter(new SimpleColorFilter(inverted ? foregroundColor.getColorInt() : color.colorInt()));