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

        int[] oldState = getState();
        boolean oldPressed = false;
        for (int i : oldState) {
            if (i == android.R.attr.state_pressed) {
                oldPressed = true;
            }
        }
        // Call super
        boolean status = super.setState(stateSet);

        boolean focused = false;
        boolean pressed = false;
        for (int i : stateSet) {
            if (i == android.R.attr.state_focused) {
                focused = true;
            } else if (i == android.R.attr.state_pressed) {
                pressed = true;
            }
        }

        if (pressed) {
            animateToPressed();
        } else if (oldPressed) {
            animateToNormal();
        } else if (focused) {
            mCurrentScale = 1f;
            invalidateSelf();
        } else {
            // Other none show
            mCurrentScale = 0;
            invalidateSelf();
        }

        return status;
    }
This is a touch foreground ripple drawable extends to StatePaintDrawable
caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/AlmostRippleDrawable.java