package defpackage;

import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableWrapper;
import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet;

/* JADX INFO: renamed from: ˋˑˁ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C1493 extends C5299 {

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public static final int[][] f6037 = {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: ᵯᵷʽ, reason: contains not printable characters */
    public ColorStateList f6038;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public boolean f6039;

    public C1493(Context context, AttributeSet attributeSet) {
        super(ᵲᵧˇ.ˉᵵᵜ(context, attributeSet, ar.tvplayer.tv.R.attr._4jh_res_0x7f040524, ar.tvplayer.tv.R.style._4g0_res_0x7f1406af, new int[0]), attributeSet);
        Context context2 = getContext();
        ᵸᵺᵜ.ʽˈˋ(context2, attributeSet, ar.tvplayer.tv.R.attr._4jh_res_0x7f040524, ar.tvplayer.tv.R.style._4g0_res_0x7f1406af);
        int[] iArr = AbstractC2172.f8641;
        ᵸᵺᵜ.ːˏᵟᵯ(context2, attributeSet, iArr, ar.tvplayer.tv.R.attr._4jh_res_0x7f040524, ar.tvplayer.tv.R.style._4g0_res_0x7f1406af, new int[0]);
        TypedArray typedArrayObtainStyledAttributes = context2.obtainStyledAttributes(attributeSet, iArr, ar.tvplayer.tv.R.attr._4jh_res_0x7f040524, ar.tvplayer.tv.R.style._4g0_res_0x7f1406af);
        if (typedArrayObtainStyledAttributes.hasValue(0)) {
            setButtonTintList(ᵺᵘ.ˉᵲ(context2, typedArrayObtainStyledAttributes, 0));
        }
        if (typedArrayObtainStyledAttributes.hasValue(1)) {
            setRippleColor(ᵺᵘ.ˉᵲ(context2, typedArrayObtainStyledAttributes, 1));
        }
        this.f6039 = typedArrayObtainStyledAttributes.getBoolean(2, false);
        typedArrayObtainStyledAttributes.recycle();
    }

    private ColorStateList getMaterialThemeColorsTintList() {
        if (this.f6038 == null) {
            int i = ᵲᵧˇ.ᵶᵥᵝ(this, ar.tvplayer.tv.R.attr._4j2_res_0x7f04013b);
            int i2 = ᵲᵧˇ.ᵶᵥᵝ(this, ar.tvplayer.tv.R.attr._2gf_res_0x7f040158);
            int i3 = ᵲᵧˇ.ᵶᵥᵝ(this, ar.tvplayer.tv.R.attr._36g_res_0x7f040172);
            this.f6038 = new ColorStateList(f6037, new int[]{ᵲᵧˇ.ˊᵙᵾᵲ(1.0f, i3, i), ᵲᵧˇ.ˊᵙᵾᵲ(0.54f, i3, i2), ᵲᵧˇ.ˊᵙᵾᵲ(0.38f, i3, i2), ᵲᵧˇ.ˊᵙᵾᵲ(0.38f, i3, i2)});
        }
        return this.f6038;
    }

    private void setRippleColor(ColorStateList colorStateList) {
        if (colorStateList == null) {
            return;
        }
        Drawable background = getBackground();
        if (background instanceof DrawableWrapper) {
            background = ((DrawableWrapper) background).getDrawable();
        }
        if (background instanceof RippleDrawable) {
            ((RippleDrawable) background).setColor(colorStateList);
        }
    }

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

    public void setUseMaterialThemeColors(boolean z) {
        this.f6039 = z;
        if (z) {
            setButtonTintList(getMaterialThemeColorsTintList());
        } else {
            setButtonTintList(null);
        }
    }
}
