ZoomGestureDetector.OnZoomGestureListener


public fun interface ZoomGestureDetector.OnZoomGestureListener


The listener for receiving notifications when gestures occur.

An application will receive events in the following order:

Summary

Public methods

abstract boolean

Responds to the events of a zooming gesture.

Public methods

onZoomEvent

Added in 1.4.0-alpha05
@UiThread
abstract boolean onZoomEvent(int type, @NonNull ZoomGestureDetector detector)

Responds to the events of a zooming gesture.

Return true to indicate the event is handled by the listener.

  • For ZOOM_GESTURE_MOVE events, the detector will continue to accumulate movement if it's not handled. This can be useful if an application, for example, only wants to update scaling factors if the change is greater than 0.01.

  • For ZOOM_GESTURE_BEGIN events, the detector will ignore the rest of the gesture if it's not handled. For example, if a gesture is beginning with a focal point outside of a region where it makes sense, ZOOM_GESTURE_BEGIN event may return false to ignore the rest of the gesture.

  • For ZOOM_GESTURE_END events, the return value is ignored and the zoom gesture will end regardless of what is returned.

Once receiving ZOOM_GESTURE_END event, focusX and focusY will return focal point of the pointers remaining on the screen.

Parameters
int type

The type of the event. Possible values include ZOOM_GESTURE_MOVE, ZOOM_GESTURE_BEGIN and ZOOM_GESTURE_END.

@NonNull ZoomGestureDetector detector

The detector reporting the event - use this to retrieve extended info about event state.

Returns
boolean

Whether or not the detector should consider this event as handled.