Gesturedeck

open class Gesturedeck @JvmOverloads constructor(val context: Context = GlobalApplication.context, var tapAction: () -> Unit? = { Log.d(TAG, "2 finger tap") }, var swipeLeftAction: () -> Unit? = { Log.d(TAG, "2 finger swipe left") }, var swipeRightAction: () -> Unit? = { Log.d(TAG, "2 finger swipe right") }, var panAction: (event: MotionEvent, swipeDirection: SwipeDirection, state: GestureState) -> Unit? = { _, _, _ -> Log.d(TAG, "2 finger pan") }, var panSensitivity: PanSensitivity? = null, var longPressAction: (state: GestureState) -> Unit? = { Log.d(TAG, "2 finger long press") }, val autoStart: Boolean = true, val observingRootView: Boolean = true, val activationKey: String? = null)

This is the low-level API that allows you to build custom functionalities on top of Gesturedeck, with seamless callbacks for Gesturedeck's gestures.

The library provides callbacks for each gesture, allowing developers to perform custom actions in response to user input.

It allows developers to easily add support for multi-finger and single-finger gestures such as taps, swipes, pans, and long presses to their apps, that are active on top of the entire UI and do not interfere with the apps' UI elements.

To use Gesturedeck, create an instance of the Gesturedeck class and pass in the required parameters. When a gesture is detected, the corresponding callback will be invoked.

Gesturedeck requires an activation key to remove watermarks. The activation key can be obtained by contacting Navideck, the creators of Gesturedeck. The watermarked mode is available for free for developers who want to use it without setting an activation key.

Parameters

context

Context of the current activity.

tapAction

The action to perform when tapping with two fingers.

swipeLeftAction

The action to perform when swipping left with two fingers.

swipeRightAction

The action to perform when swipping right with two fingers.

panAction

The action to perform when panning vertically with two fingers or double tapping and sliding with a single finger.

panSensitivity

The sensitivity of Gesturedeck when panning.

longPressAction

The action to perform when long pressing with two fingers.

autoStart

Start gesturedeck automatically.

observingRootView

Set the touch listener on the root view of the activity, set to false if you want to set the touch listener on a specific view or activity and call onTouchEvent manually.

activationKey

An optional activation key to remove watermarks. If not provided, Gesturedeck will present a watermark.

Inheritors

Constructors

Link copied to clipboard
constructor(context: Context = GlobalApplication.context, tapAction: () -> Unit? = { Log.d(TAG, "2 finger tap") }, swipeLeftAction: () -> Unit? = { Log.d(TAG, "2 finger swipe left") }, swipeRightAction: () -> Unit? = { Log.d(TAG, "2 finger swipe right") }, panAction: (event: MotionEvent, swipeDirection: SwipeDirection, state: GestureState) -> Unit? = { _, _, _ -> Log.d(TAG, "2 finger pan") }, panSensitivity: PanSensitivity? = null, longPressAction: (state: GestureState) -> Unit? = { Log.d(TAG, "2 finger long press") }, autoStart: Boolean = true, observingRootView: Boolean = true, activationKey: String? = null)

Properties

Link copied to clipboard
val activationKey: String? = null
Link copied to clipboard
val autoStart: Boolean = true
Link copied to clipboard
Link copied to clipboard

Checks if Gesturedeck is currently running.

Link copied to clipboard
open var longPressAction: (state: GestureState) -> Unit?
Link copied to clipboard
Link copied to clipboard
open var panAction: (event: MotionEvent, swipeDirection: SwipeDirection, state: GestureState) -> Unit?
Link copied to clipboard
Link copied to clipboard
open var swipeLeftAction: () -> Unit?
Link copied to clipboard
open var swipeRightAction: () -> Unit?
Link copied to clipboard
open var tapAction: () -> Unit?

Functions

Link copied to clipboard
open fun onTouchEvent(event: MotionEvent)

Passes touch events to Gesturedeck from the onTouchEvent method of the activity to detect gestures.

Link copied to clipboard
open fun start()

Starts listening for gestures. Call this method after creating an instance of the Gesturedeck class and passing in the required parameters.

Link copied to clipboard
open fun stop()

Stops listening for gestures. Call this method to stop detecting gestures.