We have been using a fixed time-step mechanism to manage the animations, but let's see what advantages it gives us to use a scroller class provided by Android to handle the animations, instead of handling all the animations by ourselves.
First, let's create a GestureDetector instance to handle the touch events:
private GestureDetectorCompat gestureDetector = new GestureDetectorCompat(context, new MenuGestureListener());
We are using the GestureDetectorCompat from the support library to guarantee the same behavior on older versions of Android.
As we covered in Chapter 3, Handling Events, by introducing a GestureDetector we can greatly simplify our onTouchEvent(), as all the logic will be handled by the ...