artem
artem

Reputation: 16777

Why GestureOverlayView is so slow?

I detect swipe gesture on 2 views with different methods: first is via GestureDetector, and the second is GestureOverlayView (I need this because the 2nd view is the GridView and GestureDetector does not work properly on this).

The first is almost instant, but the second has delay about 1 second (Nexus S, ICS). Why, and how can I fix it?

I can not change the method, because I'll need to recognize more complicated gestures later, but I want it to work instantly.

Upvotes: 3

Views: 1019

Answers (3)

Damien Praca
Damien Praca

Reputation: 3136

If you don't have the GestureOverlayView set in the xml but directly in the code you can use the following which do the same as RankoR solution :

mGestureOverlayView.setFadeEnabled(false);
mGestureOverlayView.setFadeOffset(0);

The method onGesturePerformed is then called instantly after onGesturingEnded (8 ms after in my case)

Upvotes: 1

artem
artem

Reputation: 16777

I found the solution:

android:fadeOffset="0"
android:fadeDuration="0"

And it works instantly :)

Upvotes: 7

RealBercik
RealBercik

Reputation: 139

Because of its nature GestureOverlayView relies on timings before it starts recognizing a shape. It's not a matter of performance.

EDIT

Sorry, but i do not think it is possible to change the reaction time of the GestureOverlayView :(

EDIT-END

Upvotes: 1

Related Questions