FragmentScenarioKt

public final class FragmentScenarioKt


Summary

Public methods

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragment(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @Nullable FragmentFactory factory
)

This method is deprecated. Superseded by launchFragment that takes an initialState

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragment(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Function0<@NonNull F> instantiate
)

This method is deprecated. Superseded by launchFragment that takes an initialState

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragment(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @Nullable FragmentFactory factory
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity using given FragmentFactory and waits for it to reach initialState.

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragment(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @NonNull Function0<@NonNull F> instantiate
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity using instantiate to create the Fragment and waits for it to reach initialState.

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragmentInContainer(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @Nullable FragmentFactory factory
)

This method is deprecated. Superseded by launchFragmentInContainer that takes an initialState

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragmentInContainer(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Function0<@NonNull F> instantiate
)

This method is deprecated. Superseded by launchFragmentInContainer that takes an initialState

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragmentInContainer(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @Nullable FragmentFactory factory
)

Launches a Fragment in the Activity's root view container android.R.id.content, with given arguments hosted by an empty FragmentActivity and waits for it to reach initialState.

static final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchFragmentInContainer(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @NonNull Function0<@NonNull F> instantiate
)

Launches a Fragment in the Activity's root view container android.R.id.content, with given arguments hosted by an empty FragmentActivity using instantiate to create the Fragment and waits for it to reach initialState.

static final @NonNull T
<F extends Fragment, T extends Object> FragmentScenarioKt.withFragment(
    @NonNull FragmentScenario<@NonNull F> receiver,
    @NonNull Function1<@NonNull F, @NonNull T> block
)

Run block using FragmentScenario.onFragment, returning the result of the block.

Public methods

launchFragment

@NonNull
public static final FragmentScenario<@NonNull F> <F extends Fragment> launchFragment(
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @Nullable FragmentFactory factory
)