FragmentScenario.Companion

object FragmentScenario.Companion


Summary

Public functions

FragmentScenario<F>
<F : Fragment?> launch(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    factory: FragmentFactory?
)

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

FragmentScenario<F>
<F : Fragment?> launch(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    themeResId: @StyleRes Int?,
    factory: FragmentFactory?
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity themed by themeResId, using the given FragmentFactory and waits for it to reach the resumed state.

FragmentScenario<F>
<F : Fragment?> launch(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    themeResId: @StyleRes Int?,
    initialState: Lifecycle.State?,
    factory: FragmentFactory?
)

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

FragmentScenario<F>
<F : Fragment?> launchInContainer(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    factory: FragmentFactory?
)

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

FragmentScenario<F>
<F : Fragment?> launchInContainer(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    themeResId: @StyleRes Int?,
    factory: FragmentFactory?
)

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

FragmentScenario<F>
<F : Fragment?> launchInContainer(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    themeResId: @StyleRes Int?,
    initialState: Lifecycle.State?,
    factory: FragmentFactory?
)

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

Public functions

launch

fun <F : Fragment?> launch(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    factory: FragmentFactory?
): FragmentScenario<F>

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

This method cannot be called from the main thread.

Parameters
fragmentClass: Class<F?>?

a fragment class to instantiate

fragmentArgs: Bundle?

a bundle to passed into fragment

factory: FragmentFactory?

a fragment factory to use or null to use default factory

launch

fun <F : Fragment?> launch(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    themeResId: @StyleRes Int?,
    factory: FragmentFactory?
): FragmentScenario<F>

Launches a Fragment with given arguments hosted by an empty FragmentActivity themed by themeResId, using the given FragmentFactory and waits for it to reach the resumed state.

This method cannot be called from the main thread.

Parameters
fragmentClass: Class<F?>?

a fragment class to instantiate

fragmentArgs: Bundle?

a bundle to passed into fragment

themeResId: @StyleRes Int?

a style resource id to be set to the host activity's theme

factory: FragmentFactory?

a fragment factory to use or null to use default factory

launch

fun <F : Fragment?> launch(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle? = null,
    themeResId: @StyleRes Int? = R.style.FragmentScenarioEmptyFragmentActivityTheme,
    initialState: Lifecycle.State? = Lifecycle.State.RESUMED,
    factory: FragmentFactory? = null
): FragmentScenario<F>

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

This method cannot be called from the main thread.

Parameters
fragmentClass: Class<F?>?

a fragment class to instantiate

fragmentArgs: Bundle? = null

a bundle to passed into fragment

themeResId: @StyleRes Int? = R.style.FragmentScenarioEmptyFragmentActivityTheme

a style resource id to be set to the host activity's theme

initialState: Lifecycle.State? = Lifecycle.State.RESUMED

The initial Lifecycle.State. This must be one of CREATED, STARTED, and RESUMED.

factory: FragmentFactory? = null

a fragment factory to use or null to use default factory

launchInContainer

fun <F : Fragment?> launchInContainer(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    factory: FragmentFactory?
): FragmentScenario<F>

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

This method cannot be called from the main thread.

Parameters
fragmentClass: Class<F?>?

a fragment class to instantiate

fragmentArgs: Bundle?

a bundle to passed into fragment

factory: FragmentFactory?

a fragment factory to use or null to use default factory

launchInContainer

fun <F : Fragment?> launchInContainer(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle?,
    themeResId: @StyleRes Int?,
    factory: FragmentFactory?
): FragmentScenario<F>

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

This method cannot be called from the main thread.

Parameters
fragmentClass: Class<F?>?

a fragment class to instantiate

fragmentArgs: Bundle?

a bundle to passed into fragment

themeResId: @StyleRes Int?

a style resource id to be set to the host activity's theme

factory: FragmentFactory?

a fragment factory to use or null to use default factory

launchInContainer

fun <F : Fragment?> launchInContainer(
    fragmentClass: Class<F?>?,
    fragmentArgs: Bundle? = null,
    themeResId: @StyleRes Int? = R.style.FragmentScenarioEmptyFragmentActivityTheme,
    initialState: Lifecycle.State? = Lifecycle.State.RESUMED,
    factory: FragmentFactory? = null
): FragmentScenario<F>

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

This method cannot be called from the main thread.

Parameters
fragmentClass: Class<F?>?

a fragment class to instantiate

fragmentArgs: Bundle? = null

a bundle to passed into fragment

themeResId: @StyleRes Int? = R.style.FragmentScenarioEmptyFragmentActivityTheme

a style resource id to be set to the host activity's theme

initialState: Lifecycle.State? = Lifecycle.State.RESUMED

The initial Lifecycle.State. This must be one of CREATED, STARTED, and RESUMED.

factory: FragmentFactory? = null

a fragment factory to use or null to use default factory