InProgressStrokesFinishedListener


@UiThread
public interface InProgressStrokesFinishedListener


Notifies the client app when a Stroke (or more than one) has been completed on InProgressStrokesView.

Summary

Public methods

default void

Called when there are no longer any in-progress strokes in the InProgressStrokesView for a short period.

Public methods

onStrokesFinished

Added in 1.0.0-alpha01
default void onStrokesFinished(
    @NonNull Map<@NonNull InProgressStrokeId, @NonNull Stroke> strokes
)

Called when there are no longer any in-progress strokes in the InProgressStrokesView for a short period. All strokes that were in progress simultaneously will be delivered in the same callback, running on the UI thread.

An implementation of this function should start rendering the given strokes in an android.view.View by calling its android.view.View.invalidate function and using the new Stroke data in the next call to android.view.View.onDraw.

In the same UI thread run loop as calling android.view.View.invalidate, call InProgressStrokesView.removeFinishedStrokes with the IDs of the strokes that are now being rendered in the other android.view.View. If that happens in a different run loop of the UI thread, there may be brief rendering errors (appearing as flickers) between InProgressStrokesView and the other android.view.View - either a gap where the stroke is not drawn during a frame, or a double draw where the stroke is drawn twice and translucent strokes appear more opaque than they should.