package l;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.CheckedTextView;
import androidx.annotation.Nullable;

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

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public ColorStateList f29921b = null;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public PorterDuff.Mode f29922c = null;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f29923d = false;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f29924e = false;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public boolean f29925f;

    public z(CheckedTextView checkedTextView) {
        this.f29920a = checkedTextView;
    }

    public final void a() {
        CheckedTextView checkedTextView = this.f29920a;
        Drawable checkMarkDrawable = u0.c.getCheckMarkDrawable(checkedTextView);
        if (checkMarkDrawable != null) {
            if (this.f29923d || this.f29924e) {
                Drawable drawableMutate = checkMarkDrawable.mutate();
                if (this.f29923d) {
                    k0.a.setTintList(drawableMutate, this.f29921b);
                }
                if (this.f29924e) {
                    k0.a.setTintMode(drawableMutate, this.f29922c);
                }
                if (drawableMutate.isStateful()) {
                    drawableMutate.setState(checkedTextView.getDrawableState());
                }
                checkedTextView.setCheckMarkDrawable(drawableMutate);
            }
        }
    }

    public void loadFromAttributes(@Nullable AttributeSet attributeSet, int i10) {
        int i11;
        int resourceId;
        int resourceId2;
        CheckedTextView checkedTextView = this.f29920a;
        Context context = checkedTextView.getContext();
        int[] iArr = d.j.CheckedTextView;
        p3 p3VarD = p3.d(context, attributeSet, iArr, i10);
        TypedArray typedArray = p3VarD.f29809b;
        androidx.core.view.s1.saveAttributeDataForStyleable(checkedTextView, checkedTextView.getContext(), iArr, attributeSet, p3VarD.f29809b, i10, 0);
        try {
            int i12 = d.j.CheckedTextView_checkMarkCompat;
            if (!typedArray.hasValue(i12) || (resourceId2 = typedArray.getResourceId(i12, 0)) == 0) {
                i11 = d.j.CheckedTextView_android_checkMark;
                if (typedArray.hasValue(i11) && (resourceId = typedArray.getResourceId(i11, 0)) != 0) {
                    checkedTextView.setCheckMarkDrawable(f.a.getDrawable(checkedTextView.getContext(), resourceId));
                }
            } else {
                try {
                    checkedTextView.setCheckMarkDrawable(f.a.getDrawable(checkedTextView.getContext(), resourceId2));
                } catch (Resources.NotFoundException unused) {
                    i11 = d.j.CheckedTextView_android_checkMark;
                    if (typedArray.hasValue(i11)) {
                        checkedTextView.setCheckMarkDrawable(f.a.getDrawable(checkedTextView.getContext(), resourceId));
                    }
                }
            }
            int i13 = d.j.CheckedTextView_checkMarkTint;
            if (typedArray.hasValue(i13)) {
                u0.c.setCheckMarkTintList(checkedTextView, p3VarD.a(i13));
            }
            int i14 = d.j.CheckedTextView_checkMarkTintMode;
            if (typedArray.hasValue(i14)) {
                u0.c.setCheckMarkTintMode(checkedTextView, p1.c(typedArray.getInt(i14, -1), null));
            }
        } finally {
            p3VarD.e();
        }
    }

    public void setSupportCheckMarkTintMode(@Nullable PorterDuff.Mode mode) {
        this.f29922c = mode;
        this.f29924e = true;
        a();
    }
}
