Gestures (API Reference)
Class Gestures
Use this class to process touch events from the platform and detect gesture induced actions on the map view. Please note that this class holds strong references to the gesture listeners. On Android Auto, processing touch events is not needed. Instead, gestures get detected by android auto platform and provided via callbacks. For more information see onClick, onFling and onScale methods in https://developer.android.com/reference/androidx/car/app/SurfaceCallback.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddisableDefaultAction(GestureType gestureType) Disables default action for a specified gesture.voidenableDefaultAction(GestureType gestureType) Enables default action to be performed for a specified gesture.Gets aDoubleTapListenerthat notifies when a double-tap gesture occurs.Returns fling handler.Gets aLongPressListenerthat notifies when a long-press gesture occurs.Gets aPanListenerthat notifies when a pan gesture occurs.Gets aPinchRotateListenerthat notifies when a pinch-rotate gesture occurs.Returns scale handler.Returns scroll handler.Gets aTapListenerthat notifies when a tap gesture occurs.Gets aTwoFingerPanListenerthat notifies when a two-finger pan gesture occurs.Gets aTwoFingerTapListenerthat notifies when a two-finger tap gesture occurs.voidSets aDoubleTapListenerthat notifies when a double-tap gesture occurs.voidSets aLongPressListenerthat notifies when a long-press gesture occurs.voidsetPanListener(PanListener value) Sets aPanListenerthat notifies when a pan gesture occurs.voidSets aPinchRotateListenerthat notifies when a pinch-rotate gesture occurs.voidsetTapListener(TapListener value) Sets aTapListenerthat notifies when a tap gesture occurs.voidSets aTwoFingerPanListenerthat notifies when a two-finger pan gesture occurs.voidSets aTwoFingerTapListenerthat notifies when a two-finger tap gesture occurs.
-
Method Details
-
enableDefaultAction
Enables default action to be performed for a specified gesture.
- Parameters:
gestureType-The gesture type.
-
disableDefaultAction
Disables default action for a specified gesture.
- Parameters:
gestureType-The gesture type.
-
getTapListener
Gets a
TapListenerthat notifies when a tap gesture occurs.Gesturesholds a strong reference to the listener.- Returns:
TapListenerthat notifies when a tap gesture occurs.
-
setTapListener
Sets a
TapListenerthat notifies when a tap gesture occurs.- Parameters:
value-TapListenerthat notifies when a tap gesture occurs.
-
getDoubleTapListener
Gets a
DoubleTapListenerthat notifies when a double-tap gesture occurs.Gesturesholds a strong reference to the listener.- Returns:
DoubleTapListenerthat notifies when a double-tap gesture occurs.
-
setDoubleTapListener
Sets a
DoubleTapListenerthat notifies when a double-tap gesture occurs.- Parameters:
value-DoubleTapListenerthat notifies when a double-tap gesture occurs.
-
getPinchRotateListener
Gets a
PinchRotateListenerthat notifies when a pinch-rotate gesture occurs.Gesturesholds a strong reference to the listener.- Returns:
PinchRotateListenerthat notifies when a pinch-rotate gesture occurs.
-
setPinchRotateListener
Sets a
PinchRotateListenerthat notifies when a pinch-rotate gesture occurs.- Parameters:
value-PinchRotateListenerthat notifies when a pinch-rotate gesture occurs.
-
getLongPressListener
Gets a
LongPressListenerthat notifies when a long-press gesture occurs.Gesturesholds a strong reference to the listener.- Returns:
LongPressListenerthat notifies when a long-press gesture occurs.
-
setLongPressListener
Sets a
LongPressListenerthat notifies when a long-press gesture occurs.- Parameters:
value-LongPressListenerthat notifies when a long-press gesture occurs.
-
getPanListener
Gets a
PanListenerthat notifies when a pan gesture occurs.Gesturesholds a strong reference to the listener.- Returns:
PanListenerthat notifies when a pan gesture occurs.
-
setPanListener
Sets a
PanListenerthat notifies when a pan gesture occurs.- Parameters:
value-PanListenerthat notifies when a pan gesture occurs.
-
getTwoFingerTapListener
Gets a
TwoFingerTapListenerthat notifies when a two-finger tap gesture occurs.Gesturesholds a strong reference to the listener.- Returns:
TwoFingerTapListenerthat notifies when a two-finger tap gesture occurs.
-
setTwoFingerTapListener
Sets a
TwoFingerTapListenerthat notifies when a two-finger tap gesture occurs.- Parameters:
value-TwoFingerTapListenerthat notifies when a two-finger tap gesture occurs.
-
getTwoFingerPanListener
Gets a
TwoFingerPanListenerthat notifies when a two-finger pan gesture occurs.Gesturesholds a strong reference to the listener.- Returns:
TwoFingerPanListenerthat notifies when a two-finger pan gesture occurs.
-
setTwoFingerPanListener
Sets a
TwoFingerPanListenerthat notifies when a two-finger pan gesture occurs.- Parameters:
value-TwoFingerPanListenerthat notifies when a two-finger pan gesture occurs.
-
getScrollHandler
Returns scroll handler. See
ScrollHandler.onScroll(float, float)for more details.- Returns:
Scroll handler.
-
getScaleHandler
Returns scale handler. See
ScaleHandler.onScale(float, float, float)for more details.- Returns:
Scale handler.
-
getFlingHandler
Returns fling handler. See
FlingHandler.onFling(float, float)for more details.- Returns:
Fling handler.
-