SinglePaneSceneStrategy


public final class SinglePaneSceneStrategy<T extends Object> implements SceneStrategy


A SceneStrategy that always creates a 1-entry Scene simply displaying the last entry in the list.

Summary

Public constructors

Public methods

@NonNull Scene<@NonNull T>
@Composable
calculateScene(
    @NonNull List<@NonNull NavEntry<@NonNull T>> entries,
    @NonNull Function1<@NonNull IntegerUnit> onBack
)

Given a back stack of entries, calculate whether this SceneStrategy should take on the task of rendering one or more of those entries.

Inherited methods

From androidx.navigation3.ui.SceneStrategy
@NonNull SceneStrategy<@NonNull T>
then(@NonNull SceneStrategy<@NonNull T> sceneStrategy)

Chains this SceneStrategy with another sceneStrategy to return a combined SceneStrategy.

Public constructors

SinglePaneSceneStrategy

public <T extends Object> SinglePaneSceneStrategy()

Public methods

calculateScene

@Composable
public @NonNull Scene<@NonNull T> calculateScene(
    @NonNull List<@NonNull NavEntry<@NonNull T>> entries,
    @NonNull Function1<@NonNull IntegerUnit> onBack
)

Given a back stack of entries, calculate whether this SceneStrategy should take on the task of rendering one or more of those entries.

By returning a non-null Scene, your Scene takes on the responsibility of rendering the set of entries you declare in Scene.entries. If you return null, the next available SceneStrategy will be called.

Parameters
@NonNull List<@NonNull NavEntry<@NonNull T>> entries

The entries on the back stack that should be considered valid to render via a returned Scene.

@NonNull Function1<@NonNull IntegerUnit> onBack

a callback that should be connected to any internal handling of system back done by the returned Scene. The passed Int should be the number of entries were popped.