private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { setClickable(true); mSwitchIconAnimator = new SwitchIconAnimator(); applyStyle(context, attrs, defStyleAttr, defStyleRes); mStyleId = ThemeManager.getStyleId(context, attrs, defStyleAttr, defStyleRes); }
@Override public void onThemeChanged(ThemeManager.OnThemeChangedEvent event) { int style = ThemeManager.getInstance().getCurrentStyle(mStyleId); if (mCurrentStyle != style) { mCurrentStyle = style; applyStyle(mCurrentStyle); } }
public void applyStyle(int resId) { ViewUtil.applyStyle(this, resId); applyStyle(getContext(), null, 0, resId); }