FragmentNavigator.Extras.Builder

public final class FragmentNavigator.Extras.Builder


Builder for constructing new Extras instances. The resulting instances are immutable.

Summary

Public constructors

Public methods

final @NonNull FragmentNavigator.Extras.Builder
addSharedElement(@NonNull View sharedElement, @NonNull String name)

Maps the given View in the current Fragment to the given transition name in the Fragment being navigated to.

final @NonNull FragmentNavigator.Extras.Builder
addSharedElements(
    @NonNull Map<@NonNull View, @NonNull String> sharedElements
)

Adds multiple shared elements for mapping Views in the current Fragment to transitionNames in the Fragment being navigated to.

final @NonNull FragmentNavigator.Extras

Constructs the final Extras instance.

Public constructors

Builder

public final Builder()

Public methods

addSharedElement

@NonNull
public final FragmentNavigator.Extras.Builder addSharedElement(@NonNull View sharedElement, @NonNull String name)

Maps the given View in the current Fragment to the given transition name in the Fragment being navigated to.

Parameters
@NonNull View sharedElement

A View in the current Fragment to match with a View in the Fragment being navigated to.

@NonNull String name

The transitionName of the View in the Fragment being navigated to that should be matched to the shared element.

See also
FragmentTransaction.addSharedElement

addSharedElements

@NonNull
public final FragmentNavigator.Extras.Builder addSharedElements(
    @NonNull Map<@NonNull View, @NonNull String> sharedElements
)

Adds multiple shared elements for mapping Views in the current Fragment to transitionNames in the Fragment being navigated to.

Parameters
@NonNull Map<@NonNull View, @NonNull String> sharedElements

Shared element pairs to add

build

@NonNull
public final FragmentNavigator.Extras build()

Constructs the final Extras instance.

Returns
FragmentNavigator.Extras

An immutable Extras instance.