BackEventCompat


public final class BackEventCompat


Compat around the BackEvent class

Summary

Constants

static final int

Indicates that the edge swipe starts from the left edge of the screen

static final int

Indicates that the edge swipe starts from the right edge of the screen

Public constructors

@RequiresApi(value = 34)
BackEventCompat(@NonNull BackEvent backEvent)
@VisibleForTesting
BackEventCompat(
    float touchX,
    float touchY,
    @FloatRange(from = 0.0, to = 1.0) float progress,
    int swipeEdge
)

Public methods

final float

Value between 0 and 1 on how far along the back gesture is.

final int

Indicates which edge the swipe starts from.

final float

Absolute X location of the touch point of this event in the coordinate space of the view that * received this back event.

final float

Absolute Y location of the touch point of this event in the coordinate space of the view that received this back event.

final @NonNull BackEvent
@RequiresApi(value = 34)
toBackEvent()

Convert this compat object to BackEvent object.

@NonNull String

Constants

EDGE_LEFT

public static final int EDGE_LEFT = 0

Indicates that the edge swipe starts from the left edge of the screen

EDGE_RIGHT

public static final int EDGE_RIGHT = 1

Indicates that the edge swipe starts from the right edge of the screen

Public constructors

BackEventCompat

Added in 1.8.0
@RequiresApi(value = 34)
public BackEventCompat(@NonNull BackEvent backEvent)

BackEventCompat

Added in 1.8.0
@VisibleForTesting
public BackEventCompat(
    float touchX,
    float touchY,
    @FloatRange(from = 0.0, to = 1.0) float progress,
    int swipeEdge
)

Public methods

getProgress

Added in 1.8.0
public final float getProgress()

Value between 0 and 1 on how far along the back gesture is.

getSwipeEdge

Added in 1.8.0
public final int getSwipeEdge()

Indicates which edge the swipe starts from.

getTouchX

Added in 1.8.0
public final float getTouchX()

Absolute X location of the touch point of this event in the coordinate space of the view that * received this back event.

getTouchY

Added in 1.8.0
public final float getTouchY()

Absolute Y location of the touch point of this event in the coordinate space of the view that received this back event.

toBackEvent

Added in 1.8.0
@RequiresApi(value = 34)
public final @NonNull BackEvent toBackEvent()

Convert this compat object to BackEvent object.

Returns
@NonNull BackEvent

BackEvent object

Throws
kotlin.UnsupportedOperationException

if this API is called on an API prior to 34.

toString

public @NonNull String toString()