package X6FRs_4.KQgRr5e_0.LGe8pk_15;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/* compiled from: AppCompatImageHelper.java */
/* loaded from: classes.dex */
public class FSaI4_7 {
    public WGk6X_27 KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final ImageView f672KQgRr5e_0;
    public WGk6X_27 PGPF6hQ_2;
    public WGk6X_27 QxJ9d_1;

    public FSaI4_7(ImageView imageView) {
        this.f672KQgRr5e_0 = imageView;
    }

    public void KQgRr5e_0(AttributeSet attributeSet, int i) {
        int IMuAHx_62;
        NzhupJ_29 KQgRr5e_0 = NzhupJ_29.KQgRr5e_0(this.f672KQgRr5e_0.getContext(), attributeSet, X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatImageView, i, 0);
        try {
            Drawable drawable = this.f672KQgRr5e_0.getDrawable();
            if (drawable == null && (IMuAHx_62 = KQgRr5e_0.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatImageView_srcCompat, -1)) != -1 && (drawable = X6FRs_4.KQgRr5e_0.KNBe_11.KQgRr5e_0.KQgRr5e_0.m380KQgRr5e_0(this.f672KQgRr5e_0.getContext(), IMuAHx_62)) != null) {
                this.f672KQgRr5e_0.setImageDrawable(drawable);
            }
            if (drawable != null) {
                YghfZG_14.m446KQgRr5e_0(drawable);
            }
            if (KQgRr5e_0.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatImageView_tint)) {
                X6FRs_4.IMuAHx_6.WwEq_13.X6FRs_4.KQgRr5e_0(this.f672KQgRr5e_0, KQgRr5e_0.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatImageView_tint));
            }
            if (KQgRr5e_0.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatImageView_tintMode)) {
                X6FRs_4.IMuAHx_6.WwEq_13.X6FRs_4.KQgRr5e_0(this.f672KQgRr5e_0, YghfZG_14.KQgRr5e_0(KQgRr5e_0.Mqv2r_3(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatImageView_tintMode, -1), null));
            }
        } finally {
            KQgRr5e_0.KQgRr5e_0();
        }
    }

    public final boolean QxJ9d_1() {
        int i = Build.VERSION.SDK_INT;
        return i > 21 ? this.KQgRr5e_0 != null : i == 21;
    }

    public void KQgRr5e_0(int i) {
        if (i != 0) {
            Drawable m380KQgRr5e_0 = X6FRs_4.KQgRr5e_0.KNBe_11.KQgRr5e_0.KQgRr5e_0.m380KQgRr5e_0(this.f672KQgRr5e_0.getContext(), i);
            if (m380KQgRr5e_0 != null) {
                YghfZG_14.m446KQgRr5e_0(m380KQgRr5e_0);
            }
            this.f672KQgRr5e_0.setImageDrawable(m380KQgRr5e_0);
        } else {
            this.f672KQgRr5e_0.setImageDrawable(null);
        }
        m385KQgRr5e_0();
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m386KQgRr5e_0() {
        return Build.VERSION.SDK_INT < 21 || !(this.f672KQgRr5e_0.getBackground() instanceof RippleDrawable);
    }

    public void KQgRr5e_0(ColorStateList colorStateList) {
        if (this.QxJ9d_1 == null) {
            this.QxJ9d_1 = new WGk6X_27();
        }
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        wGk6X_27.KQgRr5e_0 = colorStateList;
        wGk6X_27.QxJ9d_1 = true;
        m385KQgRr5e_0();
    }

    public ColorStateList KQgRr5e_0() {
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        if (wGk6X_27 != null) {
            return wGk6X_27.KQgRr5e_0;
        }
        return null;
    }

    public void KQgRr5e_0(PorterDuff.Mode mode) {
        if (this.QxJ9d_1 == null) {
            this.QxJ9d_1 = new WGk6X_27();
        }
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        wGk6X_27.f763KQgRr5e_0 = mode;
        wGk6X_27.f764KQgRr5e_0 = true;
        m385KQgRr5e_0();
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public PorterDuff.Mode m384KQgRr5e_0() {
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        if (wGk6X_27 != null) {
            return wGk6X_27.f763KQgRr5e_0;
        }
        return null;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m385KQgRr5e_0() {
        Drawable drawable = this.f672KQgRr5e_0.getDrawable();
        if (drawable != null) {
            YghfZG_14.m446KQgRr5e_0(drawable);
        }
        if (drawable != null) {
            if (QxJ9d_1() && KQgRr5e_0(drawable)) {
                return;
            }
            WGk6X_27 wGk6X_27 = this.QxJ9d_1;
            if (wGk6X_27 != null) {
                IFxWkV_5.KQgRr5e_0(drawable, wGk6X_27, this.f672KQgRr5e_0.getDrawableState());
                return;
            }
            WGk6X_27 wGk6X_272 = this.KQgRr5e_0;
            if (wGk6X_272 != null) {
                IFxWkV_5.KQgRr5e_0(drawable, wGk6X_272, this.f672KQgRr5e_0.getDrawableState());
            }
        }
    }

    public final boolean KQgRr5e_0(Drawable drawable) {
        if (this.PGPF6hQ_2 == null) {
            this.PGPF6hQ_2 = new WGk6X_27();
        }
        WGk6X_27 wGk6X_27 = this.PGPF6hQ_2;
        wGk6X_27.KQgRr5e_0();
        ColorStateList KQgRr5e_0 = X6FRs_4.IMuAHx_6.WwEq_13.X6FRs_4.KQgRr5e_0(this.f672KQgRr5e_0);
        if (KQgRr5e_0 != null) {
            wGk6X_27.QxJ9d_1 = true;
            wGk6X_27.KQgRr5e_0 = KQgRr5e_0;
        }
        PorterDuff.Mode m327KQgRr5e_0 = X6FRs_4.IMuAHx_6.WwEq_13.X6FRs_4.m327KQgRr5e_0(this.f672KQgRr5e_0);
        if (m327KQgRr5e_0 != null) {
            wGk6X_27.f764KQgRr5e_0 = true;
            wGk6X_27.f763KQgRr5e_0 = m327KQgRr5e_0;
        }
        if (wGk6X_27.QxJ9d_1 || wGk6X_27.f764KQgRr5e_0) {
            IFxWkV_5.KQgRr5e_0(drawable, wGk6X_27, this.f672KQgRr5e_0.getDrawableState());
            return true;
        }
        return false;
    }
}
