package X6FRs_4.IMuAHx_6.WwEq_13;

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;
/* compiled from: CompoundButtonCompat.java */
/* loaded from: classes.dex */
public final class PGPF6hQ_2 {
    public static Field KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public static boolean f506KQgRr5e_0;

    public static void KQgRr5e_0(CompoundButton compoundButton, ColorStateList colorStateList) {
        if (Build.VERSION.SDK_INT >= 21) {
            compoundButton.setButtonTintList(colorStateList);
        } else if (compoundButton instanceof XnFJ5_9) {
            ((XnFJ5_9) compoundButton).setSupportButtonTintList(colorStateList);
        }
    }

    public static void KQgRr5e_0(CompoundButton compoundButton, PorterDuff.Mode mode) {
        if (Build.VERSION.SDK_INT >= 21) {
            compoundButton.setButtonTintMode(mode);
        } else if (compoundButton instanceof XnFJ5_9) {
            ((XnFJ5_9) compoundButton).setSupportButtonTintMode(mode);
        }
    }

    public static Drawable KQgRr5e_0(CompoundButton compoundButton) {
        if (Build.VERSION.SDK_INT >= 23) {
            return compoundButton.getButtonDrawable();
        }
        if (!f506KQgRr5e_0) {
            try {
                Field declaredField = CompoundButton.class.getDeclaredField("mButtonDrawable");
                KQgRr5e_0 = declaredField;
                declaredField.setAccessible(true);
            } catch (NoSuchFieldException e) {
                Log.i("CompoundButtonCompat", "Failed to retrieve mButtonDrawable field", e);
            }
            f506KQgRr5e_0 = true;
        }
        Field field = KQgRr5e_0;
        if (field != null) {
            try {
                return (Drawable) field.get(compoundButton);
            } catch (IllegalAccessException e2) {
                Log.i("CompoundButtonCompat", "Failed to get button drawable via reflection", e2);
                KQgRr5e_0 = null;
            }
        }
        return null;
    }
}
