There is nothing new here, just another exercise.
Two things to be careful with:
- Try to call
validate()as fewer times as possible, it is expensive.
- If you want to handle the touch events in this manner, remember to return
onTouchEvent(). Otherwise, only the first event will be triggered(most likely DOWN in this case) and not the succeeding ones (like the MOVES).