refactored MyGestureDetector class