@Override
    public boolean setState(int[] stateSet) {
        if (stateSet == null)
            return false;

        // Call super
        boolean status = super.setState(stateSet);

        boolean oldChecked = mChecked;
        boolean oldEnabled = mEnabled;
        mChecked = false;
        mEnabled = true;
        for (int i : stateSet) {
            if (i == android.R.attr.state_checked) {
                mChecked = true;
            } else if (i == -android.R.attr.state_enabled) {
                mEnabled = false;
            }
        }

        if (status || oldChecked != mChecked || oldEnabled != mEnabled) {
            //We've changed states
            onStateChange(getColor(), oldChecked, mChecked);
            invalidateSelf();
        }

        return status;
    }
A drawable that changes it's ColorStateList color depending on the Drawable State
<p>
Subclasses should implement {@link #onStateChange(int, boolean, boolean)} if new color != current color call this }
</p>
caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/CheckStateDrawable.java