public boolean onTouch(MotionEvent event) {
        switch (event.getActionMasked()) {
            case MotionEvent.ACTION_CANCEL: {
                isTouchReleased = true;
                onTouchCancel(event.getX(), event.getY());
            }
            break;
            case MotionEvent.ACTION_UP: {
                isTouchReleased = true;
                onTouchReleased(event.getX(), event.getY());
            }
            break;
            case MotionEvent.ACTION_DOWN: {
                isTouchReleased = false;
                onTouchDown(event.getX(), event.getY());
            }
            break;
            case MotionEvent.ACTION_MOVE: {
                onTouchMove(event.getX(), event.getY());
            }
            break;
            default:
                return false;
        }
        return true;
    }
Called from the drawable's draw() method after the canvas has been set to
draw the shape at (0,0). Subclasses can override for special effects such
as multiple layers, stroking, etc.
caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/TouchEffectDrawable.java