package p028j;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.CompoundButton;
import p001a0.C0012f;
import p007c.C0494j;
import p013e.C0640a;
import p023h0.C0829h1;
import p032k0.C1299i;

/* renamed from: j.i */
/* loaded from: classes.dex */
public class C1112i {

    /* renamed from: a */
    public final CompoundButton f2710a;

    /* renamed from: b */
    public ColorStateList f2711b = null;

    /* renamed from: c */
    public PorterDuff.Mode f2712c = null;

    /* renamed from: d */
    public boolean f2713d = false;

    /* renamed from: e */
    public boolean f2714e = false;

    /* renamed from: f */
    public boolean f2715f;

    public C1112i(CompoundButton compoundButton) {
        this.f2710a = compoundButton;
    }

    /* renamed from: a */
    public void m2128a() {
        Drawable m1690a = C1299i.m1690a(this.f2710a);
        if (m1690a != null) {
            if (this.f2713d || this.f2714e) {
                Drawable mutate = C0012f.m5083p(m1690a).mutate();
                if (this.f2713d) {
                    C0012f.m5085n(mutate, this.f2711b);
                }
                if (this.f2714e) {
                    C0012f.m5084o(mutate, this.f2712c);
                }
                if (mutate.isStateful()) {
                    mutate.setState(this.f2710a.getDrawableState());
                }
                this.f2710a.setButtonDrawable(mutate);
            }
        }
    }

    /* renamed from: b */
    public int m2127b(int i) {
        Drawable m1690a;
        return (Build.VERSION.SDK_INT >= 17 || (m1690a = C1299i.m1690a(this.f2710a)) == null) ? i : i + m1690a.getIntrinsicWidth();
    }

    /* renamed from: c */
    public ColorStateList m2126c() {
        return this.f2711b;
    }

    /* renamed from: d */
    public PorterDuff.Mode m2125d() {
        return this.f2712c;
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x003e A[Catch: all -> 0x0085, TRY_ENTER, TryCatch #1 {all -> 0x0085, blocks: (B:3:0x001d, B:5:0x0025, B:7:0x002b, B:12:0x003e, B:14:0x0046, B:16:0x004c, B:17:0x0059, B:19:0x0061, B:20:0x006a, B:22:0x0072), top: B:30:0x001d }] */
    /* JADX WARN: Removed duplicated region for block: B:19:0x0061 A[Catch: all -> 0x0085, TryCatch #1 {all -> 0x0085, blocks: (B:3:0x001d, B:5:0x0025, B:7:0x002b, B:12:0x003e, B:14:0x0046, B:16:0x004c, B:17:0x0059, B:19:0x0061, B:20:0x006a, B:22:0x0072), top: B:30:0x001d }] */
    /* JADX WARN: Removed duplicated region for block: B:22:0x0072 A[Catch: all -> 0x0085, TRY_LEAVE, TryCatch #1 {all -> 0x0085, blocks: (B:3:0x001d, B:5:0x0025, B:7:0x002b, B:12:0x003e, B:14:0x0046, B:16:0x004c, B:17:0x0059, B:19:0x0061, B:20:0x006a, B:22:0x0072), top: B:30:0x001d }] */
    /* renamed from: e */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void m2124e(AttributeSet attributeSet, int i) {
        boolean z;
        int i2;
        int i3;
        int m2168m;
        int m2168m2;
        Context context = this.f2710a.getContext();
        int[] iArr = C0494j.f1778U0;
        C1106g3 m2160u = C1106g3.m2160u(context, attributeSet, iArr, i, 0);
        CompoundButton compoundButton = this.f2710a;
        C0829h1.m2850M(compoundButton, compoundButton.getContext(), iArr, attributeSet, m2160u.m2164q(), i, 0);
        try {
            int i4 = C0494j.f1786W0;
            if (m2160u.m2163r(i4) && (m2168m2 = m2160u.m2168m(i4, 0)) != 0) {
                try {
                    CompoundButton compoundButton2 = this.f2710a;
                    compoundButton2.setButtonDrawable(C0640a.m3229b(compoundButton2.getContext(), m2168m2));
                    z = true;
                } catch (Resources.NotFoundException unused) {
                }
                if (!z) {
                    int i5 = C0494j.f1782V0;
                    if (m2160u.m2163r(i5) && (m2168m = m2160u.m2168m(i5, 0)) != 0) {
                        CompoundButton compoundButton3 = this.f2710a;
                        compoundButton3.setButtonDrawable(C0640a.m3229b(compoundButton3.getContext(), m2168m));
                    }
                }
                i2 = C0494j.f1790X0;
                if (m2160u.m2163r(i2)) {
                    C1299i.m1689b(this.f2710a, m2160u.m2178c(i2));
                }
                i3 = C0494j.f1794Y0;
                if (m2160u.m2163r(i3)) {
                    C1299i.m1688c(this.f2710a, C1115i2.m2115d(m2160u.m2171j(i3, -1), null));
                }
            }
            z = false;
            if (!z) {
            }
            i2 = C0494j.f1790X0;
            if (m2160u.m2163r(i2)) {
            }
            i3 = C0494j.f1794Y0;
            if (m2160u.m2163r(i3)) {
            }
        } finally {
            m2160u.m2159v();
        }
    }

    /* renamed from: f */
    public void m2123f() {
        if (this.f2715f) {
            this.f2715f = false;
            return;
        }
        this.f2715f = true;
        m2128a();
    }

    /* renamed from: g */
    public void m2122g(ColorStateList colorStateList) {
        this.f2711b = colorStateList;
        this.f2713d = true;
        m2128a();
    }

    /* renamed from: h */
    public void m2121h(PorterDuff.Mode mode) {
        this.f2712c = mode;
        this.f2714e = true;
        m2128a();
    }
}