package com.google.android.material.radiobutton;

import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatRadioButton;
import com.google.android.material.internal.q0;
import h9.a;
import u0.d;
import x8.c;
import x8.l;
import x8.m;

/* JADX INFO: loaded from: classes2.dex */
public class MaterialRadioButton extends AppCompatRadioButton {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final int f22988f = l.Widget_MaterialComponents_CompoundButton_RadioButton;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final int[][] f22989g = {new int[]{R.attr.state_enabled, R.attr.state_checked}, new int[]{R.attr.state_enabled, -16842912}, new int[]{-16842910, R.attr.state_checked}, new int[]{-16842910, -16842912}};

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

    @Nullable
    private ColorStateList materialThemeColorsTintList;

    public MaterialRadioButton(@NonNull Context context) {
        this(context, null);
    }

    private ColorStateList getMaterialThemeColorsTintList() {
        if (this.materialThemeColorsTintList == null) {
            int iB = a.b(d.a.colorControlActivated, this);
            int iB2 = a.b(c.colorOnSurface, this);
            int iB3 = a.b(c.colorSurface, this);
            this.materialThemeColorsTintList = new ColorStateList(f22989g, new int[]{a.e(1.0f, iB3, iB), a.e(0.54f, iB3, iB2), a.e(0.38f, iB3, iB2), a.e(0.38f, iB3, iB2)});
        }
        return this.materialThemeColorsTintList;
    }

    @Override // android.widget.TextView, android.view.View
    public final void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (this.f22990e && d.getButtonTintList(this) == null) {
            setUseMaterialThemeColors(true);
        }
    }

    public void setUseMaterialThemeColors(boolean z10) {
        this.f22990e = z10;
        if (z10) {
            d.setButtonTintList(this, getMaterialThemeColorsTintList());
        } else {
            d.setButtonTintList(this, null);
        }
    }

    public MaterialRadioButton(@NonNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, d.a.radioButtonStyle);
    }

    /* JADX WARN: Illegal instructions before constructor call */
    public MaterialRadioButton(@NonNull Context context, @Nullable AttributeSet attributeSet, int i10) {
        int i11 = f22988f;
        super(x9.a.wrap(context, attributeSet, i10, i11), attributeSet, i10);
        Context context2 = getContext();
        TypedArray typedArrayC = q0.c(context2, attributeSet, m.MaterialRadioButton, i10, i11, new int[0]);
        int i12 = m.MaterialRadioButton_buttonTint;
        if (typedArrayC.hasValue(i12)) {
            d.setButtonTintList(this, q9.d.getColorStateList(context2, typedArrayC, i12));
        }
        this.f22990e = typedArrayC.getBoolean(m.MaterialRadioButton_useMaterialThemeColors, false);
        typedArrayC.recycle();
    }
}
