package p037.p041.p051;

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 p037.p041.C1477;
import p037.p041.p043.p044.C1527;
import p037.p065.p078.C1920;

/* JADX INFO: renamed from: މ.ؠ.ގ.ފ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1619 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final ImageView f5261;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public C1687 f5262;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public C1687 f5263;

    public C1619(ImageView imageView) {
        this.f5261 = imageView;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3167() {
        Drawable drawable = this.f5261.getDrawable();
        if (drawable != null) {
            C1650.m3242(drawable);
        }
        if (drawable != null) {
            int i = Build.VERSION.SDK_INT;
            boolean z = true;
            if (i <= 21 && i == 21) {
                if (this.f5263 == null) {
                    this.f5263 = new C1687();
                }
                C1687 c1687 = this.f5263;
                c1687.f5491 = null;
                c1687.f5494 = false;
                c1687.f5492 = null;
                c1687.f5493 = false;
                ColorStateList imageTintList = this.f5261.getImageTintList();
                if (imageTintList != null) {
                    c1687.f5494 = true;
                    c1687.f5491 = imageTintList;
                }
                PorterDuff.Mode imageTintMode = this.f5261.getImageTintMode();
                if (imageTintMode != null) {
                    c1687.f5493 = true;
                    c1687.f5492 = imageTintMode;
                }
                if (c1687.f5494 || c1687.f5493) {
                    C1615.m3157(drawable, c1687, this.f5261.getDrawableState());
                } else {
                    z = false;
                }
                if (z) {
                    return;
                }
            }
            C1687 c16872 = this.f5262;
            if (c16872 != null) {
                C1615.m3157(drawable, c16872, this.f5261.getDrawableState());
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3168(int i) {
        if (i != 0) {
            Drawable drawableM3025 = C1527.m3025(this.f5261.getContext(), i);
            if (drawableM3025 != null) {
                C1650.m3242(drawableM3025);
            }
            this.f5261.setImageDrawable(drawableM3025);
        } else {
            this.f5261.setImageDrawable(null);
        }
        m3167();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3169(ColorStateList colorStateList) {
        if (this.f5262 == null) {
            this.f5262 = new C1687();
        }
        C1687 c1687 = this.f5262;
        c1687.f5491 = colorStateList;
        c1687.f5494 = true;
        m3167();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3170(PorterDuff.Mode mode) {
        if (this.f5262 == null) {
            this.f5262 = new C1687();
        }
        C1687 c1687 = this.f5262;
        c1687.f5492 = mode;
        c1687.f5493 = true;
        m3167();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3171(AttributeSet attributeSet, int i) {
        Drawable drawable;
        Drawable drawable2;
        int iM3305;
        C1689 c1689M3294 = C1689.m3294(this.f5261.getContext(), attributeSet, C1477.AppCompatImageView, i, 0);
        ImageView imageView = this.f5261;
        C1920.m3742(imageView, imageView.getContext(), C1477.AppCompatImageView, attributeSet, c1689M3294.f5496, i, 0);
        try {
            Drawable drawable3 = this.f5261.getDrawable();
            if (drawable3 == null && (iM3305 = c1689M3294.m3305(C1477.AppCompatImageView_srcCompat, -1)) != -1 && (drawable3 = C1527.m3025(this.f5261.getContext(), iM3305)) != null) {
                this.f5261.setImageDrawable(drawable3);
            }
            if (drawable3 != null) {
                C1650.m3242(drawable3);
            }
            if (c1689M3294.m3307(C1477.AppCompatImageView_tint)) {
                ImageView imageView2 = this.f5261;
                imageView2.setImageTintList(c1689M3294.m3296(C1477.AppCompatImageView_tint));
                if (Build.VERSION.SDK_INT == 21 && (drawable2 = imageView2.getDrawable()) != null && imageView2.getImageTintList() != null) {
                    if (drawable2.isStateful()) {
                        drawable2.setState(imageView2.getDrawableState());
                    }
                    imageView2.setImageDrawable(drawable2);
                }
            }
            if (c1689M3294.m3307(C1477.AppCompatImageView_tintMode)) {
                ImageView imageView3 = this.f5261;
                imageView3.setImageTintMode(C1650.m3240(c1689M3294.m3301(C1477.AppCompatImageView_tintMode, -1), null));
                if (Build.VERSION.SDK_INT == 21 && (drawable = imageView3.getDrawable()) != null && imageView3.getImageTintList() != null) {
                    if (drawable.isStateful()) {
                        drawable.setState(imageView3.getDrawableState());
                    }
                    imageView3.setImageDrawable(drawable);
                }
            }
            c1689M3294.f5496.recycle();
        } catch (Throwable th) {
            c1689M3294.f5496.recycle();
            throw th;
        }
    }
}
