package skin.support.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
/**
* Created by pengfengwang on 2017/1/13.
*/
public class SkinCompatRelativeLayout extends RelativeLayout implements SkinCompatSupportable {
private final SkinCompatBackgroundHelper mBackgroundTintHelper;
public SkinCompatRelativeLayout(Context context) {
this(context, null);
}
public SkinCompatRelativeLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public SkinCompatRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
@Override
public void setBackgroundResource(int resid) {
super.setBackgroundResource(resid);
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}