4

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.

artem
  • 16,382
  • 34
  • 113
  • 189

3 Answers3

8

I found the solution:

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

And it works instantly :)

artem
  • 16,382
  • 34
  • 113
  • 189
1

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

Bercik
  • 139
  • 1
  • 14
  • Can I change this time? It's not user-friendly in my use case with this timings :) – artem May 04 '12 at 15:49
  • Hi, im doing some reseacrch about this now , but i dont think you can change this :/ I'll post and edit or comment if i find something :) – Bercik May 04 '12 at 15:52
1

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)

Damien Praca
  • 3,126
  • 21
  • 14