{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

PressGestureScope

public interface PressGestureScope extends Density


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

Summary

Public methods

abstract void

Waits for the press to be released before returning.

abstract boolean

Waits for the press to be released before returning.

Inherited methods

From androidx.compose.ui.unit.Density
abstract float

The logical density of the display.

abstract float

Current user preference for the scaling factor for fonts.

default int

Convert Dp to Int by rounding

default int

Convert Sp to Int by rounding

default @NonNull Dp

Convert Sp to Dp.

default @NonNull Dp
orgKt.toDp(int receiver)

Convert an Int pixel value to Dp.

default @NonNull Dp
orgKt.toDp(float receiver)

Convert a Float pixel value to a Dp

default @NonNull DpSize

Convert a Size to a DpSize.

default float
orgKt.toPx(@NonNull Dp receiver)

Convert Dp to pixels.

default float

Convert Sp to pixels.

default @NonNull Rect

Convert a DpRect to a Rect.

default @NonNull Size

Convert a DpSize to a Size.

default @NonNull TextUnit
orgKt.toSp(@NonNull Dp receiver)

Convert Dp to Sp.

default @NonNull TextUnit
orgKt.toSp(int receiver)

Convert an Int pixel value to Sp.

default @NonNull TextUnit
orgKt.toSp(float receiver)

Convert a Float pixel value to a Sp

Public methods

awaitRelease

abstract void awaitRelease()

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 boolean tryAwaitRelease()

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 .