Converted code from https://developer.android.com/samples/BasicGestureDetect/index.html converted to Android Studio 0.8.2