Why does changing the StrokeType of a GestureOverlayView object affect the standard behavior of the view?

I recently introduced multi-gesture gestures into my application. This is preference, so I dynamically set StrokeType to Activity.OnCreate. I found that if you dynamically install StrokeType, it changes the behavior of the GestureOverlayView as follows.

The normal behavior is that you draw a gesture, and it stays on the screen after you draw it. However, when a stroke type is dynamically changed, any gesture drawn on the screen disappears immediately after the OnGestureEnded event has been fired. I reloaded the GesturesBuilder sample application and confirmed that it has the same problem if you added the second line shown here:

    GestureOverlayView overlay = (GestureOverlayView) findViewById(R.id.gestures_overlay);
    overlay.setGestureStrokeType(GestureOverlayView.GESTURE_STROKE_TYPE_SINGLE);
    overlay.addOnGestureListener(new GesturesProcessor());
}

Is this a bug in the Android gesture library and does anyone know a workaround?

Please note that this is on HTC Magic, so this may be a handset problem.

+3
source share
1 answer

You can set the stroke type statically in a gesture overlay XML file.

<android.gesture.GestureOverlayView
android:id="@+id/gestures_alpha"
android:layout_width="fill_parent" 
android:layout_height="0dip"
android:layout_weight="1.0" 
android:gestureStrokeType="multiple"
android:fadeOffset="1000"
/>

The gesture disappears quickly because fadeOffset is set to a low number. If you install it yourself, as above, it will take so long before the gesture disappears. After this time, OnGestureEvent or OnGesturePerformedListener is called, depending on which one you are using.

+1
source

Source: https://habr.com/ru/post/1745928/


All Articles