1212import androidx .annotation .NonNull ;
1313import androidx .annotation .Nullable ;
1414import androidx .annotation .Px ;
15+ import androidx .appcompat .widget .AppCompatImageView ;
1516import androidx .fragment .app .FragmentActivity ;
1617
1718import com .bumptech .glide .Glide ;
5455import java .util .List ;
5556import java .util .Objects ;
5657
57- public final class AvatarImageView extends ShapeableImageView {
58+ public final class AvatarImageView extends AppCompatImageView {
5859
5960 private static final int SIZE_LARGE = 1 ;
6061 private static final int SIZE_SMALL = 2 ;
@@ -77,12 +78,15 @@ public final class AvatarImageView extends ShapeableImageView {
7778
7879
7980 public AvatarImageView (Context context ) {
80- super (context );
81- initialize (context , null );
81+ this (context , null );
8282 }
8383
8484 public AvatarImageView (Context context , AttributeSet attrs ) {
85- super (context , attrs );
85+ this (context , attrs , 0 );
86+ }
87+
88+ public AvatarImageView (Context context , @ Nullable AttributeSet attrs , int defStyle ) {
89+ super (context , attrs , defStyle );
8690 initialize (context , attrs );
8791 }
8892
@@ -96,16 +100,9 @@ public void initialize(@NonNull Context context, @Nullable AttributeSet attrs) {
96100 typedArray .recycle ();
97101 }
98102
99- unknownRecipientDrawable = new FallbackAvatarDrawable (context , new FallbackAvatar .Resource .Person (AvatarColor .UNKNOWN ));
103+ unknownRecipientDrawable = new FallbackAvatarDrawable (context , new FallbackAvatar .Resource .Person (AvatarColor .UNKNOWN )). circleCrop () ;
100104 blurred = false ;
101105 chatColors = null ;
102-
103- setShapeAppearanceModel (ShapeAppearanceModel .builder ().setAllCorners (new RoundedCornerTreatment ()).setAllCornerSizes (new RelativeCornerSize (0.5f )).build ());
104- }
105-
106- @ Override
107- public void setClipBounds (Rect clipBounds ) {
108- super .setClipBounds (clipBounds );
109106 }
110107
111108 @ Override
@@ -198,7 +195,7 @@ private void setAvatar(@NonNull RequestManager requestManager, @Nullable Recipie
198195 };
199196 }
200197
201- Drawable fallback = new FallbackAvatarDrawable (getContext (), activeFallbackPhotoProvider .getFallbackAvatar (recipient ));
198+ Drawable fallback = new FallbackAvatarDrawable (getContext (), activeFallbackPhotoProvider .getFallbackAvatar (recipient )). circleCrop () ;
202199
203200 if (fixedSizeTarget != null ) {
204201 requestManager .clear (fixedSizeTarget );
@@ -267,7 +264,7 @@ private void setAvatarClickHandler(@NonNull final Recipient recipient, boolean q
267264
268265 public void setImageBytesForGroup (@ Nullable byte [] avatarBytes , @ NonNull AvatarColor color )
269266 {
270- Drawable fallback = new FallbackAvatarDrawable (getContext (), new FallbackAvatar .Resource .Group (color ));
267+ Drawable fallback = new FallbackAvatarDrawable (getContext (), new FallbackAvatar .Resource .Group (color )). circleCrop () ;
271268
272269 Glide .with (this )
273270 .load (avatarBytes )
0 commit comments