Represents a system navigation event, such as a predictive back gesture or a back button press.

This class standardizes various platform signals (e.g., touch gestures, key events) into a single, consistent format. This allows handlers like NavigationEventDispatcher to process navigation actions uniformly without needing to know the specific source of the event.

Note that not all parameters apply to every type of navigation event. For example, touchX and touchY are only relevant for gesture-based navigation.

Summary

Constants

const Int

Indicates the navigation gesture originates from the left edge of the screen.

Cmn
const Int

Indicates the navigation event was not caused by an edge swipe.

Cmn
const Int

Indicates the navigation gesture originates from the right edge of the screen.

Cmn

Public constructors

NavigationEvent(
    touchX: @FloatRange(from = 0.0) Float,
    touchY: @FloatRange(from = 0.0) Float,
    progress: @FloatRange(from = 0.0, to = 1.0) Float,
    swipeEdge: Int,
    frameTimeMillis: Long
)
Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open String
Cmn

Public properties

Long

The timestamp in milliseconds when this navigation event occurred.

Cmn
Float

A normalized value from 0.0F to 1.0F indicating how far the navigation action has progressed.

Cmn
Int

Indicates which screen edge a swipe-based navigation gesture originates from.

Cmn
Float

The absolute X coordinate of the touch point for this event, in pixels, in the coordinate space of the screen.

Cmn
Float

The absolute Y coordinate of the touch point for this event, in pixels, in the coordinate space of the screen.

Cmn

Constants

EDGE_LEFT

const val EDGE_LEFT = 0: Int

Indicates the navigation gesture originates from the left edge of the screen.

EDGE_NONE

const val EDGE_NONE = 2: Int

Indicates the navigation event was not caused by an edge swipe. This applies to actions like a 3-button navigation press or a hardware back button event.

EDGE_RIGHT

const val EDGE_RIGHT = 1: Int

Indicates the navigation gesture originates from the right edge of the screen.

Public constructors

NavigationEvent(
    touchX: @FloatRange(from = 0.0) Float = 0.0f,
    touchY: @FloatRange(from = 0.0) Float = 0.0f,
    progress: @FloatRange(from = 0.0, to = 1.0) Float = 0.0f,
    swipeEdge: Int = EDGE_NONE,
    frameTimeMillis: Long = 0
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

frameTimeMillis

val frameTimeMillisLong

The timestamp in milliseconds when this navigation event occurred. This is useful for synchronizing animations or for debugging event sequences.

progress

val progressFloat

A normalized value from 0.0F to 1.0F indicating how far the navigation action has progressed.

For continuous gestures like a swipe, this value will update incrementally. For discrete actions like a button press, a single event with progress of 0.0F may be sent when the action starts, followed by a completion signal.

swipeEdge

val swipeEdgeInt

Indicates which screen edge a swipe-based navigation gesture originates from. For non-swipe events, this will be EDGE_NONE.

touchX

val touchXFloat

The absolute X coordinate of the touch point for this event, in pixels, in the coordinate space of the screen. For events not triggered by a touch gesture (e.g., a key press), this will be 0.0F.

touchY

val touchYFloat

The absolute Y coordinate of the touch point for this event, in pixels, in the coordinate space of the screen. For events not triggered by a touch gesture (e.g., a key press), this will be 0.0F.