package ῲ.ῲ.㴹;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
import androidx.appcompat.R$styleable;
import ῲ.ᨨ.ᨨ.C1729;
import ῲ.ῲ.ῲ.K.C1940;

/* renamed from: ῲ.ῲ.㴹.ⁱ  reason: contains not printable characters */
/* compiled from: AppCompatImageHelper */
public class C2026 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C2029 f6859;

    /* renamed from: ῲ  reason: contains not printable characters */
    public C2029 f6860;

    /* renamed from: K  reason: contains not printable characters */
    public final ImageView f6861;

    /* renamed from: 㸾  reason: contains not printable characters */
    public C2029 f6862;

    public C2026(ImageView imageView) {
        this.f6861 = imageView;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5252(AttributeSet attributeSet, int i) {
        int r1;
        C2019 r0 = C2019.m5223(this.f6861.getContext(), attributeSet, R$styleable.AppCompatImageView, i, 0);
        ImageView imageView = this.f6861;
        C1729.m4475(imageView, imageView.getContext(), R$styleable.AppCompatImageView, attributeSet, r0.f6846, i, 0);
        try {
            Drawable drawable = this.f6861.getDrawable();
            if (!(drawable != null || (r1 = r0.m5230(R$styleable.AppCompatImageView_srcCompat, -1)) == -1 || (drawable = C1940.m5017(this.f6861.getContext(), r1)) == null)) {
                this.f6861.setImageDrawable(drawable);
            }
            if (drawable != null) {
                C2021.m5241(drawable);
            }
            if (r0.m5237(R$styleable.AppCompatImageView_tint)) {
                ImageView imageView2 = this.f6861;
                ColorStateList r12 = r0.m5233(R$styleable.AppCompatImageView_tint);
                int i2 = Build.VERSION.SDK_INT;
                imageView2.setImageTintList(r12);
                int i3 = Build.VERSION.SDK_INT;
            }
            if (r0.m5237(R$styleable.AppCompatImageView_tintMode)) {
                ImageView imageView3 = this.f6861;
                PorterDuff.Mode r10 = C2021.m5242(r0.m5238(R$styleable.AppCompatImageView_tintMode, -1), null);
                int i4 = Build.VERSION.SDK_INT;
                imageView3.setImageTintMode(r10);
                int i5 = Build.VERSION.SDK_INT;
            }
            r0.f6846.recycle();
        } catch (Throwable th) {
            r0.f6846.recycle();
            throw th;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5249(int i) {
        if (i != 0) {
            Drawable r2 = C1940.m5017(this.f6861.getContext(), i);
            if (r2 != null) {
                C2021.m5241(r2);
            }
            this.f6861.setImageDrawable(r2);
        } else {
            this.f6861.setImageDrawable(null);
        }
        m5248();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5250(ColorStateList colorStateList) {
        if (this.f6859 == null) {
            this.f6859 = new C2029();
        }
        C2029 r0 = this.f6859;
        r0.f6876 = colorStateList;
        r0.f6877 = true;
        m5248();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5251(PorterDuff.Mode mode) {
        if (this.f6859 == null) {
            this.f6859 = new C2029();
        }
        C2029 r0 = this.f6859;
        r0.f6875 = mode;
        r0.f6874 = true;
        m5248();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5248() {
        Drawable drawable = this.f6861.getDrawable();
        if (drawable != null) {
            C2021.m5241(drawable);
        }
        if (drawable != null) {
            int i = Build.VERSION.SDK_INT;
            boolean z = true;
            if (this.f6860 != null) {
                if (this.f6862 == null) {
                    this.f6862 = new C2029();
                }
                C2029 r1 = this.f6862;
                r1.m5261();
                ImageView imageView = this.f6861;
                int i2 = Build.VERSION.SDK_INT;
                ColorStateList imageTintList = imageView.getImageTintList();
                if (imageTintList != null) {
                    r1.f6877 = true;
                    r1.f6876 = imageTintList;
                }
                ImageView imageView2 = this.f6861;
                int i3 = Build.VERSION.SDK_INT;
                PorterDuff.Mode imageTintMode = imageView2.getImageTintMode();
                if (imageTintMode != null) {
                    r1.f6874 = true;
                    r1.f6875 = imageTintMode;
                }
                if (r1.f6877 || r1.f6874) {
                    C2044.m5314(drawable, r1, this.f6861.getDrawableState());
                } else {
                    z = false;
                }
                if (z) {
                    return;
                }
            }
            C2029 r12 = this.f6859;
            if (r12 != null) {
                C2044.m5314(drawable, r12, this.f6861.getDrawableState());
                return;
            }
            C2029 r13 = this.f6860;
            if (r13 != null) {
                C2044.m5314(drawable, r13, this.f6861.getDrawableState());
            }
        }
    }
}
