BackPressHandler

class BackPressHandler(scope: CoroutineScope, confirmationWindowMillis: Long)

Handles "press back twice to confirm" flows.

This keeps the temporary confirmation state outside an Activity or Fragment, avoiding ad-hoc boolean flags and delayed reset jobs in UI code.

Constructors

Link copied to clipboard
constructor(scope: CoroutineScope, confirmationWindowMillis: Long)

Functions

Link copied to clipboard
operator fun invoke(onFirstPress: () -> Unit, onSecondPress: () -> Unit)

Runs onFirstPress for the first press and onSecondPress when called again within the configured confirmation window.