package ῲ.ῲ.㴹;

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 androidx.appcompat.R$styleable;
import ῲ.ᨨ.ᨨ.C1729;
import ῲ.ῲ.ῲ.K.C1940;
import K.K.K.ʬ.C2369;

/* renamed from: ῲ.ῲ.㴹.ඓ  reason: contains not printable characters */
/* compiled from: AppCompatCompoundButtonHelper */
public class C2008 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public PorterDuff.Mode f6821 = null;

    /* renamed from: ඓ  reason: contains not printable characters */
    public boolean f6822 = false;

    /* renamed from: ῲ  reason: contains not printable characters */
    public ColorStateList f6823 = null;

    /* renamed from: K  reason: contains not printable characters */
    public final CompoundButton f6824;

    /* renamed from: 㴹  reason: contains not printable characters */
    public boolean f6825;

    /* renamed from: 㸾  reason: contains not printable characters */
    public boolean f6826 = false;

    public C2008(CompoundButton compoundButton) {
        this.f6824 = compoundButton;
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x0068  */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x0080  */
    /* renamed from: K  reason: contains not printable characters */
    public void m5198(AttributeSet attributeSet, int i) {
        boolean z;
        int r11;
        int r112;
        C2019 r0 = C2019.m5223(this.f6824.getContext(), attributeSet, R$styleable.CompoundButton, i, 0);
        CompoundButton compoundButton = this.f6824;
        C1729.m4475(compoundButton, compoundButton.getContext(), R$styleable.CompoundButton, attributeSet, r0.f6846, i, 0);
        try {
            if (r0.m5237(R$styleable.CompoundButton_buttonCompat) && (r112 = r0.m5230(R$styleable.CompoundButton_buttonCompat, 0)) != 0) {
                try {
                    this.f6824.setButtonDrawable(C1940.m5017(this.f6824.getContext(), r112));
                    z = true;
                } catch (Resources.NotFoundException unused) {
                }
                if (!z && r0.m5237(R$styleable.CompoundButton_android_button) && (r11 = r0.m5230(R$styleable.CompoundButton_android_button, 0)) != 0) {
                    this.f6824.setButtonDrawable(C1940.m5017(this.f6824.getContext(), r11));
                }
                if (r0.m5237(R$styleable.CompoundButton_buttonTint)) {
                    CompoundButton compoundButton2 = this.f6824;
                    ColorStateList r12 = r0.m5233(R$styleable.CompoundButton_buttonTint);
                    int i2 = Build.VERSION.SDK_INT;
                    compoundButton2.setButtonTintList(r12);
                }
                if (r0.m5237(R$styleable.CompoundButton_buttonTintMode)) {
                    CompoundButton compoundButton3 = this.f6824;
                    PorterDuff.Mode r122 = C2021.m5242(r0.m5238(R$styleable.CompoundButton_buttonTintMode, -1), null);
                    int i3 = Build.VERSION.SDK_INT;
                    compoundButton3.setButtonTintMode(r122);
                }
            }
            z = false;
            this.f6824.setButtonDrawable(C1940.m5017(this.f6824.getContext(), r11));
            if (r0.m5237(R$styleable.CompoundButton_buttonTint)) {
            }
            if (r0.m5237(R$styleable.CompoundButton_buttonTintMode)) {
            }
        } finally {
            r0.f6846.recycle();
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5197() {
        Drawable r0 = C2369.m6307(this.f6824);
        if (r0 == null) {
            return;
        }
        if (this.f6826 || this.f6822) {
            Drawable mutate = C2369.m6273(r0).mutate();
            if (this.f6826) {
                ColorStateList colorStateList = this.f6823;
                int i = Build.VERSION.SDK_INT;
                mutate.setTintList(colorStateList);
            }
            if (this.f6822) {
                PorterDuff.Mode mode = this.f6821;
                int i2 = Build.VERSION.SDK_INT;
                mutate.setTintMode(mode);
            }
            if (mutate.isStateful()) {
                mutate.setState(this.f6824.getDrawableState());
            }
            this.f6824.setButtonDrawable(mutate);
        }
    }
}
