Skip to content

//workflow/com.squareup.workflow1.ui.container/BackButtonScreen

BackButtonScreen

[androidJvm] @WorkflowUiExperimentalApi()

class BackButtonScreen<W : Screen>(wrapped: W, shadow: Boolean, onBackPressed: () -> Unit?) : AndroidScreen<BackButtonScreen<W>>

Adds optional back button handling to a wrapped rendering, possibly overriding that the wrapped rendering’s own back button handler.

Parameters

androidJvm

shadow

If true, onBackPressed is set as the backPressedHandler after the wrapped rendering’s view is built / updated, effectively overriding it. If false (the default), onBackPressed is set afterward, to allow the wrapped rendering to take precedence if it sets a backPressedHandler of its own – the handler provided here serves as a default.

onBackPressed

The function to fire when the device back button is pressed, or null to set no handler – or clear a handler that was set previously. Defaults to null.

Constructors

BackButtonScreen [androidJvm] fun <W : Screen> BackButtonScreen(wrapped: W, shadow: Boolean = false, onBackPressed: () -> Unit? = null)If true, onBackPressed is set as the backPressedHandler after the wrapped rendering’s view is built / updated, effectively overriding it.

Properties

Name Summary
onBackPressed [androidJvm] val onBackPressed: () -> Unit? = nullThe function to fire when the device back button is pressed, or null to set no handler – or clear a handler that was set previously.
shadow [androidJvm] val shadow: Boolean = falseIf true, onBackPressed is set as the backPressedHandler after the wrapped rendering’s view is built / updated, effectively overriding it.
viewFactory [androidJvm] open override val viewFactory: ScreenViewFactory<BackButtonScreen<W>>Used to build instances of android.view.View as needed to display renderings of this type.
wrapped [androidJvm] val wrapped: W