Android 12 Developer Preview is here! Try it out, and give us your feedback!

PressGestureScope

interface PressGestureScope : Density
androidx.compose.foundation.gestures.PressGestureScope

Receiver scope for detectTapGestures's onPress lambda. This offers two methods to allow waiting for the press to be released.

Summary

Public methods
abstract suspend Unit

Waits for the press to be released before returning.

abstract suspend Boolean

Waits for the press to be released before returning.

Inherited functions
Inherited properties

Public methods

awaitRelease

abstract suspend fun awaitRelease(): Unit

Waits for the press to be released before returning. If the gesture was canceled by motion being consumed by another gesture, GestureCancellationException will be thrown.

tryAwaitRelease

abstract suspend fun tryAwaitRelease(): Boolean

Waits for the press to be released before returning. If the press was released, true is returned, or if the gesture was canceled by motion being consumed by another gesture, false is returned .