package p032k0;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import android.widget.CompoundButton;
import java.lang.reflect.Field;

/* renamed from: k0.i */
/* loaded from: classes.dex */
public final class C1299i {

    /* renamed from: a */
    public static Field f2996a;

    /* renamed from: b */
    public static boolean f2997b;

    /* renamed from: k0.i$a */
    /* loaded from: classes.dex */
    public static class C1300a {
        /* renamed from: a */
        public static ColorStateList m1687a(CompoundButton compoundButton) {
            ColorStateList buttonTintList;
            buttonTintList = compoundButton.getButtonTintList();
            return buttonTintList;
        }

        /* renamed from: b */
        public static PorterDuff.Mode m1686b(CompoundButton compoundButton) {
            PorterDuff.Mode buttonTintMode;
            buttonTintMode = compoundButton.getButtonTintMode();
            return buttonTintMode;
        }

        /* renamed from: c */
        public static void m1685c(CompoundButton compoundButton, ColorStateList colorStateList) {
            compoundButton.setButtonTintList(colorStateList);
        }

        /* renamed from: d */
        public static void m1684d(CompoundButton compoundButton, PorterDuff.Mode mode) {
            compoundButton.setButtonTintMode(mode);
        }
    }

    /* renamed from: k0.i$b */
    /* loaded from: classes.dex */
    public static class C1301b {
        /* renamed from: a */
        public static Drawable m1683a(CompoundButton compoundButton) {
            Drawable buttonDrawable;
            buttonDrawable = compoundButton.getButtonDrawable();
            return buttonDrawable;
        }
    }

    /* renamed from: a */
    public static Drawable m1690a(CompoundButton compoundButton) {
        if (Build.VERSION.SDK_INT >= 23) {
            return C1301b.m1683a(compoundButton);
        }
        if (!f2997b) {
            try {
                Field declaredField = CompoundButton.class.getDeclaredField("mButtonDrawable");
                f2996a = declaredField;
                declaredField.setAccessible(true);
            } catch (NoSuchFieldException e) {
                Log.i("CompoundButtonCompat", "Failed to retrieve mButtonDrawable field", e);
            }
            f2997b = true;
        }
        Field field = f2996a;
        if (field != null) {
            try {
                return (Drawable) field.get(compoundButton);
            } catch (IllegalAccessException e2) {
                Log.i("CompoundButtonCompat", "Failed to get button drawable via reflection", e2);
                f2996a = null;
            }
        }
        return null;
    }

    /* renamed from: b */
    public static void m1689b(CompoundButton compoundButton, ColorStateList colorStateList) {
        if (Build.VERSION.SDK_INT >= 21) {
            C1300a.m1685c(compoundButton, colorStateList);
        } else if (compoundButton instanceof InterfaceC1280a1) {
            ((InterfaceC1280a1) compoundButton).setSupportButtonTintList(colorStateList);
        }
    }

    /* renamed from: c */
    public static void m1688c(CompoundButton compoundButton, PorterDuff.Mode mode) {
        if (Build.VERSION.SDK_INT >= 21) {
            C1300a.m1684d(compoundButton, mode);
        } else if (compoundButton instanceof InterfaceC1280a1) {
            ((InterfaceC1280a1) compoundButton).setSupportButtonTintMode(mode);
        }
    }
}