FragmentStateAdapter.FragmentTransactionCallback


public abstract class FragmentStateAdapter.FragmentTransactionCallback


Callback interface for listening to fragment lifecycle changes that happen inside the adapter.

Summary

Public constructors

Public methods

@NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener
onFragmentMaxLifecyclePreUpdated(
    @NonNull Fragment fragment,
    @NonNull Lifecycle.State maxLifecycleState
)

Called right before Fragment's maximum state is capped via setMaxLifecycle.

@NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener

Called right before the Fragment is added to adapter's FragmentManager.

@NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener

Called right before the Fragment is removed from adapter's FragmentManager.

@NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener

Called right before Fragment's state is being saved through a saveFragmentInstanceState call.

Public constructors

FragmentTransactionCallback

Added in 1.1.0
public FragmentTransactionCallback()

Public methods

onFragmentMaxLifecyclePreUpdated

Added in 1.1.0
public @NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener onFragmentMaxLifecyclePreUpdated(
    @NonNull Fragment fragment,
    @NonNull Lifecycle.State maxLifecycleState
)

Called right before Fragment's maximum state is capped via setMaxLifecycle.

Parameters
@NonNull Fragment fragment

Fragment to have its state capped

@NonNull Lifecycle.State maxLifecycleState

Ceiling state for the fragment

onFragmentPreAdded

Added in 1.1.0
public @NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener onFragmentPreAdded(@NonNull Fragment fragment)

Called right before the Fragment is added to adapter's FragmentManager.

Parameters
@NonNull Fragment fragment

Fragment changing state

onFragmentPreRemoved

Added in 1.1.0
public @NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener onFragmentPreRemoved(@NonNull Fragment fragment)

Called right before the Fragment is removed from adapter's FragmentManager.

Parameters
@NonNull Fragment fragment

Fragment changing state

onFragmentPreSavedInstanceState

Added in 1.1.0
@FragmentStateAdapter.ExperimentalFragmentStateAdapterApi
public @NonNull FragmentStateAdapter.FragmentTransactionCallback.OnPostEventListener onFragmentPreSavedInstanceState(@NonNull Fragment fragment)

Called right before Fragment's state is being saved through a saveFragmentInstanceState call.

Parameters
@NonNull Fragment fragment

Fragment which state is being saved