package X6FRs_4.LGe8pk_15.KQgRr5e_0;

import X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.Shader;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Build;
import android.view.animation.Animation;
import android.widget.ImageView;
/* compiled from: CircleImageView.java */
/* loaded from: classes.dex */
public class KQgRr5e_0 extends ImageView {
    public int KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Animation.AnimationListener f973KQgRr5e_0;

    /* compiled from: CircleImageView.java */
    /* renamed from: X6FRs_4.LGe8pk_15.KQgRr5e_0.KQgRr5e_0$KQgRr5e_0  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public class C0058KQgRr5e_0 extends OvalShape {

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public Paint f974KQgRr5e_0 = new Paint();

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public RadialGradient f975KQgRr5e_0;

        public C0058KQgRr5e_0(int i) {
            KQgRr5e_0.this.KQgRr5e_0 = i;
            KQgRr5e_0((int) rect().width());
        }

        public final void KQgRr5e_0(int i) {
            float f = i / 2;
            RadialGradient radialGradient = new RadialGradient(f, f, KQgRr5e_0.this.KQgRr5e_0, new int[]{1023410176, 0}, (float[]) null, Shader.TileMode.CLAMP);
            this.f975KQgRr5e_0 = radialGradient;
            this.f974KQgRr5e_0.setShader(radialGradient);
        }

        @Override // android.graphics.drawable.shapes.OvalShape, android.graphics.drawable.shapes.RectShape, android.graphics.drawable.shapes.Shape
        public void draw(Canvas canvas, Paint paint) {
            int width;
            float width2 = KQgRr5e_0.this.getWidth() / 2;
            float height = KQgRr5e_0.this.getHeight() / 2;
            canvas.drawCircle(width2, height, width2, this.f974KQgRr5e_0);
            canvas.drawCircle(width2, height, width - KQgRr5e_0.this.KQgRr5e_0, paint);
        }

        @Override // android.graphics.drawable.shapes.RectShape, android.graphics.drawable.shapes.Shape
        public void onResize(float f, float f2) {
            super.onResize(f, f2);
            KQgRr5e_0((int) f);
        }
    }

    public KQgRr5e_0(Context context, int i) {
        super(context);
        ShapeDrawable shapeDrawable;
        float f = getContext().getResources().getDisplayMetrics().density;
        int i2 = (int) (1.75f * f);
        int i3 = (int) (0.0f * f);
        this.KQgRr5e_0 = (int) (3.5f * f);
        if (KQgRr5e_0()) {
            shapeDrawable = new ShapeDrawable(new OvalShape());
            ZzDuCHW_20.KQgRr5e_0(this, f * 4.0f);
        } else {
            ShapeDrawable shapeDrawable2 = new ShapeDrawable(new C0058KQgRr5e_0(this.KQgRr5e_0));
            setLayerType(1, shapeDrawable2.getPaint());
            shapeDrawable2.getPaint().setShadowLayer(this.KQgRr5e_0, i3, i2, 503316480);
            int i4 = this.KQgRr5e_0;
            setPadding(i4, i4, i4, i4);
            shapeDrawable = shapeDrawable2;
        }
        shapeDrawable.getPaint().setColor(i);
        ZzDuCHW_20.KQgRr5e_0(this, shapeDrawable);
    }

    public final boolean KQgRr5e_0() {
        return Build.VERSION.SDK_INT >= 21;
    }

    @Override // android.view.View
    public void onAnimationEnd() {
        super.onAnimationEnd();
        Animation.AnimationListener animationListener = this.f973KQgRr5e_0;
        if (animationListener != null) {
            animationListener.onAnimationEnd(getAnimation());
        }
    }

    @Override // android.view.View
    public void onAnimationStart() {
        super.onAnimationStart();
        Animation.AnimationListener animationListener = this.f973KQgRr5e_0;
        if (animationListener != null) {
            animationListener.onAnimationStart(getAnimation());
        }
    }

    @Override // android.widget.ImageView, android.view.View
    public void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        if (KQgRr5e_0()) {
            return;
        }
        setMeasuredDimension(getMeasuredWidth() + (this.KQgRr5e_0 * 2), getMeasuredHeight() + (this.KQgRr5e_0 * 2));
    }

    @Override // android.view.View
    public void setBackgroundColor(int i) {
        if (getBackground() instanceof ShapeDrawable) {
            ((ShapeDrawable) getBackground()).getPaint().setColor(i);
        }
    }

    public void KQgRr5e_0(Animation.AnimationListener animationListener) {
        this.f973KQgRr5e_0 = animationListener;
    }
}
