package c.a.g;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;

/* JADX INFO: loaded from: classes.dex */
public class i {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final ImageView f4989a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public j0 f4990b;

    public i(ImageView imageView) {
        this.f4989a = imageView;
    }

    public void a() {
        j0 j0Var;
        Drawable drawable = this.f4989a.getDrawable();
        if (drawable != null) {
            int[] iArr = t.f5069a;
        }
        if (drawable == null || (j0Var = this.f4990b) == null) {
            return;
        }
        f.e(drawable, j0Var, this.f4989a.getDrawableState());
    }

    public void b(AttributeSet attributeSet, int i2) {
        int i3;
        Context context = this.f4989a.getContext();
        int[] iArr = c.a.b.f4753f;
        l0 l0VarN = l0.n(context, attributeSet, iArr, i2, 0);
        ImageView imageView = this.f4989a;
        c.c.i.k.e(imageView, imageView.getContext(), iArr, attributeSet, l0VarN.f5000b, i2, 0);
        try {
            Drawable drawable = this.f4989a.getDrawable();
            if (drawable == null && (i3 = l0VarN.i(1, -1)) != -1 && (drawable = c.a.d.a.a.a(this.f4989a.getContext(), i3)) != null) {
                this.f4989a.setImageDrawable(drawable);
            }
            if (drawable != null) {
                int[] iArr2 = t.f5069a;
            }
            if (l0VarN.l(2)) {
                this.f4989a.setImageTintList(l0VarN.b(2));
            }
            if (l0VarN.l(3)) {
                this.f4989a.setImageTintMode(t.b(l0VarN.g(3, -1), null));
            }
            l0VarN.f5000b.recycle();
        } catch (Throwable th) {
            l0VarN.f5000b.recycle();
            throw th;
        }
    }

    public void c(int i2) {
        if (i2 != 0) {
            Drawable drawableA = c.a.d.a.a.a(this.f4989a.getContext(), i2);
            if (drawableA != null) {
                int[] iArr = t.f5069a;
            }
            this.f4989a.setImageDrawable(drawableA);
        } else {
            this.f4989a.setImageDrawable(null);
        }
        a();
    }

    public void d(ColorStateList colorStateList) {
        if (this.f4990b == null) {
            this.f4990b = new j0();
        }
        j0 j0Var = this.f4990b;
        j0Var.f4994a = colorStateList;
        j0Var.f4997d = true;
        a();
    }

    public void e(PorterDuff.Mode mode) {
        if (this.f4990b == null) {
            this.f4990b = new j0();
        }
        j0 j0Var = this.f4990b;
        j0Var.f4995b = mode;
        j0Var.f4996c = true;
        a();
    }
}
