package skin.support.widget;
import android.content.Context;
import android.support.annotation.DrawableRes;
import android.support.v7.widget.AppCompatRadioButton;
import android.util.AttributeSet;
import skin.support.R;
/**
* Created by ximsfei on 17-1-14.
*/
public class SkinCompatRadioButton extends AppCompatRadioButton implements SkinCompatSupportable {
private final SkinCompatCompoundButtonHelper mCompoundButtonHelper;
public SkinCompatRadioButton(Context context) {
this(context, null);
}
public SkinCompatRadioButton(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.radioButtonStyle);
}
public SkinCompatRadioButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mCompoundButtonHelper = new SkinCompatCompoundButtonHelper(this);
mCompoundButtonHelper.loadFromAttributes(attrs, defStyleAttr);
}
@Override
public void setButtonDrawable(@DrawableRes int resId) {
super.setButtonDrawable(resId);
if (mCompoundButtonHelper != null) {
mCompoundButtonHelper.setButtonDrawable(resId);
}
}
@Override
public void applySkin() {
if (mCompoundButtonHelper != null) {
mCompoundButtonHelper.applySkin();
}
}
}