BackEventCompat
class BackEventCompat
Compat around the BackEvent class
Summary
Constants |
|
|---|---|
const Int |
EDGE_LEFT = 0Indicates that the edge swipe starts from the left edge of the screen |
const Int |
EDGE_NONE = 2Indicates that the back event was not triggered by an edge swipe back gesture. |
const Int |
EDGE_RIGHT = 1Indicates that the edge swipe starts from the right edge of the screen |
Public constructors |
|---|
@RequiresApi(value = 34)Constructs a |
BackEventCompat(navigationEvent: NavigationEvent)Constructs a |
@VisibleForTesting |
Public functions |
|
|---|---|
BackEvent |
@RequiresApi(value = 34)Convert this |
NavigationEvent |
Convert this |
open String |
toString() |
Public properties |
|
|---|---|
Long |
Frame time of the back event. |
Float |
Value between 0 and 1 on how far along the back gesture is. |
Int |
Indicates which edge the swipe starts from. |
Float |
Absolute X location of the touch point of this event in the coordinate space of the view that |
Float |
Absolute Y location of the touch point of this event in the coordinate space of the view that received this back event. |
Constants
EDGE_LEFT
const val EDGE_LEFT = 0: Int
Indicates that the edge swipe starts from the left edge of the screen
EDGE_NONE
const val EDGE_NONE = 2: Int
Indicates that the back event was not triggered by an edge swipe back gesture. This applies to cases like using the back button in 3-button navigation or pressing a hardware back button.
EDGE_RIGHT
const val EDGE_RIGHT = 1: Int
Indicates that the edge swipe starts from the right edge of the screen
Public constructors
BackEventCompat
@RequiresApi(value = 34)
BackEventCompat(backEvent: BackEvent)
Constructs a BackEventCompat from a BackEvent object.
This constructor is used for API level 34 and above, mapping the BackEvent's properties to the corresponding values in BackEventCompat.
BackEventCompat
BackEventCompat(navigationEvent: NavigationEvent)
Constructs a BackEventCompat from a NavigationEvent object.
This constructor is used for compatibility with NavigationEvent and maps its properties to the corresponding values in BackEventCompat.
| Parameters | |
|---|---|
navigationEvent: NavigationEvent |
The |
BackEventCompat
@VisibleForTesting
BackEventCompat(
touchX: Float,
touchY: Float,
progress: @FloatRange(from = 0.0, to = 1.0) Float,
swipeEdge: Int,
frameTimeMillis: Long = 0
)
Public functions
toBackEvent
@RequiresApi(value = 34)
fun toBackEvent(): BackEvent
Convert this BackEventCompat object to a BackEvent object.
| Returns | |
|---|---|
BackEvent |
A new |
| Throws | |
|---|---|
kotlin.UnsupportedOperationException |
if this API is called on an API prior to 34. |
toNavigationEvent
fun toNavigationEvent(): NavigationEvent
Convert this BackEventCompat object to a NavigationEvent object.
| Returns | |
|---|---|
NavigationEvent |
A new |
Public properties
progress
val progress: Float
Value between 0 and 1 on how far along the back gesture is.