public class

FragmentController

extends java.lang.Object

 java.lang.Object

↳androidx.fragment.app.FragmentController

Gradle dependencies

compile group: 'androidx.fragment', name: 'fragment', version: '1.5.0-rc01'

  • groupId: androidx.fragment
  • artifactId: fragment
  • version: 1.5.0-rc01

Artifact androidx.fragment:fragment:1.5.0-rc01 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.fragment:fragment com.android.support:support-fragment

Androidx class mapping:

androidx.fragment.app.FragmentController android.support.v4.app.FragmentController

Overview

Provides integration points with a FragmentManager for a fragment host.

It is the responsibility of the host to take care of the Fragment's lifecycle. The methods provided by FragmentController are for that purpose.

Summary

Methods
public voidattachHost(Fragment parent)

Attaches the host to the FragmentManager for this controller.

public static FragmentControllercreateController(FragmentHostCallback<java.lang.Object> callbacks)

Returns a FragmentController.

public voiddispatchActivityCreated()

Moves all Fragments managed by the controller's FragmentManager into the activity created state.

public voiddispatchConfigurationChanged(Configuration newConfig)

Lets all Fragments managed by the controller's FragmentManager know a configuration change occurred.

public booleandispatchContextItemSelected(MenuItem item)

Sends a context item selection event to the Fragments managed by the controller's FragmentManager.

public voiddispatchCreate()

Moves all Fragments managed by the controller's FragmentManager into the create state.

public booleandispatchCreateOptionsMenu(Menu menu, MenuInflater inflater)

Lets all Fragments managed by the controller's FragmentManager know they should create an options menu.

public voiddispatchDestroy()

Moves Fragments managed by the controller's FragmentManager into the destroy state.

public voiddispatchDestroyView()

Moves all Fragments managed by the controller's FragmentManager into the destroy view state.

public voiddispatchLowMemory()

Lets all Fragments managed by the controller's FragmentManager know the device is in a low memory condition.

public voiddispatchMultiWindowModeChanged(boolean isInMultiWindowMode)

Lets all Fragments managed by the controller's FragmentManager know the multi-window mode of the activity changed.

public booleandispatchOptionsItemSelected(MenuItem item)

Sends an option item selection event to the Fragments managed by the controller's FragmentManager.

public voiddispatchOptionsMenuClosed(Menu menu)

Lets all Fragments managed by the controller's FragmentManager know their options menu has closed.

public voiddispatchPause()

Moves all Fragments managed by the controller's FragmentManager into the pause state.

public voiddispatchPictureInPictureModeChanged(boolean isInPictureInPictureMode)

Lets all Fragments managed by the controller's FragmentManager know the picture-in-picture mode of the activity changed.

public booleandispatchPrepareOptionsMenu(Menu menu)

Lets all Fragments managed by the controller's FragmentManager know they should prepare their options menu for display.

public voiddispatchReallyStop()

public voiddispatchResume()

Moves all Fragments managed by the controller's FragmentManager into the resume state.

public voiddispatchStart()

Moves all Fragments managed by the controller's FragmentManager into the start state.

public voiddispatchStop()

Moves all Fragments managed by the controller's FragmentManager into the stop state.

public voiddoLoaderDestroy()

Destroys the loaders and, if their state is not being retained, removes them.

public voiddoLoaderRetain()

Retains the state of each of the loaders.

public voiddoLoaderStart()

Starts the loaders.

public voiddoLoaderStop(boolean retain)

Stops the loaders, optionally retaining their state.

public voiddumpLoaders(java.lang.String prefix, java.io.FileDescriptor fd, java.io.PrintWriter writer, java.lang.String args[])

Dumps the current state of the loaders.

public booleanexecPendingActions()

Execute any pending actions for the Fragments managed by the controller's FragmentManager.

public FragmentfindFragmentByWho(java.lang.String who)

Returns a fragment with the given identifier.

public java.util.List<Fragment>getActiveFragments(java.util.List<Fragment> actives)

Returns the list of active fragments.

public intgetActiveFragmentsCount()

Returns the number of active fragments.

public FragmentManagergetSupportFragmentManager()

Returns a FragmentManager for this controller.

public LoaderManagergetSupportLoaderManager()

Returns a LoaderManager.

public voidnoteStateNotSaved()

Marks the fragment state as unsaved.

public ViewonCreateView(View parent, java.lang.String name, Context context, AttributeSet attrs)

Instantiates a Fragment's view.

public voidreportLoaderStart()

Lets the loaders know the host is ready to receive notifications.

public voidrestoreAllState(Parcelable state, FragmentManagerNonConfig nonConfig)

Restores the saved state for all Fragments.

public voidrestoreAllState(Parcelable state, java.util.List<Fragment> nonConfigList)

Restores the saved state for all Fragments.

public voidrestoreLoaderNonConfig(SimpleArrayMap<java.lang.String, LoaderManager> loaderManagers)

Restores the saved state for all LoaderManagers.

public voidrestoreSaveState(Parcelable state)

Restores the saved state for all Fragments.

public SimpleArrayMap<java.lang.String, LoaderManager>retainLoaderNonConfig()

Returns a list of LoaderManagers that have opted to retain their instance across configuration changes.

public FragmentManagerNonConfigretainNestedNonConfig()

Returns a nested tree of Fragments that have opted to retain their instance across configuration changes.

public java.util.List<Fragment>retainNonConfig()

Returns a list of Fragments that have opted to retain their instance across configuration changes.

public ParcelablesaveAllState()

Saves the state for all Fragments.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static FragmentController createController(FragmentHostCallback<java.lang.Object> callbacks)

Returns a FragmentController.

public FragmentManager getSupportFragmentManager()

Returns a FragmentManager for this controller.

public LoaderManager getSupportLoaderManager()

Deprecated: Loaders are managed separately from FragmentController and this now throws an java.lang.UnsupportedOperationException. Use LoaderManager.getInstance(T) to obtain a LoaderManager.

Returns a LoaderManager.

See also: LoaderManager.getInstance(T)

public Fragment findFragmentByWho(java.lang.String who)

Returns a fragment with the given identifier.

public int getActiveFragmentsCount()

Returns the number of active fragments.

public java.util.List<Fragment> getActiveFragments(java.util.List<Fragment> actives)

Returns the list of active fragments.

public void attachHost(Fragment parent)

Attaches the host to the FragmentManager for this controller. The host must be attached before the FragmentManager can be used to manage Fragments.

public View onCreateView(View parent, java.lang.String name, Context context, AttributeSet attrs)

Instantiates a Fragment's view.

Parameters:

parent: The parent that the created view will be placed in; note that this may be null.
name: Tag name to be inflated.
context: The context the view is being created in.
attrs: Inflation attributes as specified in XML file.

Returns:

view the newly created view

public void noteStateNotSaved()

Marks the fragment state as unsaved. This allows for "state loss" detection.

public Parcelable saveAllState()

Deprecated: Have your FragmentHostCallback implement SavedStateRegistryOwner to automatically save state via the FragmentManager.

Saves the state for all Fragments.

See also: FragmentController.restoreSaveState(Parcelable)

public void restoreAllState(Parcelable state, java.util.List<Fragment> nonConfigList)

Deprecated: Have your FragmentHostCallback implement ViewModelStoreOwner to automatically restore the Fragment's non configuration state and use FragmentController.restoreSaveState(Parcelable) to restore the Fragment's save state.

Restores the saved state for all Fragments. The given Fragment list are Fragment instances retained across configuration changes.

public void restoreAllState(Parcelable state, FragmentManagerNonConfig nonConfig)

Deprecated: Have your FragmentHostCallback implement ViewModelStoreOwner to automatically restore the Fragment's non configuration state and use FragmentController.restoreSaveState(Parcelable) to restore the Fragment's save state.

Restores the saved state for all Fragments. The given FragmentManagerNonConfig are Fragment instances retained across configuration changes, including nested fragments

public void restoreSaveState(Parcelable state)

Deprecated: Have your FragmentHostCallback implement SavedStateRegistryOwner to automatically restore the saved state via the FragmentManager.

Restores the saved state for all Fragments.

Parameters:

state: the saved state containing the Parcelable returned by FragmentController.saveAllState()

See also: FragmentController.saveAllState()

public java.util.List<Fragment> retainNonConfig()

Deprecated: Have your FragmentHostCallback implement ViewModelStoreOwner to automatically retain the Fragment's non configuration state.

Returns a list of Fragments that have opted to retain their instance across configuration changes.

public FragmentManagerNonConfig retainNestedNonConfig()

Deprecated: Have your FragmentHostCallback implement ViewModelStoreOwner to automatically retain the Fragment's non configuration state.

Returns a nested tree of Fragments that have opted to retain their instance across configuration changes.

public void dispatchCreate()

Moves all Fragments managed by the controller's FragmentManager into the create state.

Call when Fragments should be created.

See also: Fragment.onCreate(Bundle)

public void dispatchActivityCreated()

Moves all Fragments managed by the controller's FragmentManager into the activity created state.

Call when Fragments should be informed their host has been created.

See also: Fragment.onActivityCreated(Bundle)

public void dispatchStart()

Moves all Fragments managed by the controller's FragmentManager into the start state.

Call when Fragments should be started.

See also: Fragment.onStart()

public void dispatchResume()

Moves all Fragments managed by the controller's FragmentManager into the resume state.

Call when Fragments should be resumed.

See also: Fragment.onResume()

public void dispatchPause()

Moves all Fragments managed by the controller's FragmentManager into the pause state.

Call when Fragments should be paused.

See also: Fragment.onPause()

public void dispatchStop()

Moves all Fragments managed by the controller's FragmentManager into the stop state.

Call when Fragments should be stopped.

See also: Fragment.onStop()

public void dispatchReallyStop()

Deprecated: This functionality has been rolled into FragmentController.dispatchStop().

public void dispatchDestroyView()

Moves all Fragments managed by the controller's FragmentManager into the destroy view state.

Call when the Fragment's views should be destroyed.

See also: Fragment.onDestroyView()

public void dispatchDestroy()

Moves Fragments managed by the controller's FragmentManager into the destroy state.

If the FragmentHostCallback is an instance of ViewModelStoreOwner, then retained Fragments and any other non configuration state such as any ViewModel attached to Fragments will only be destroyed if ViewModelStore.clear() is called prior to this method.

Otherwise, the FragmentManager will look to see if the host's Context is an and if returns true. In only that case will non configuration state be retained.

Call when Fragments should be destroyed.

See also: Fragment.onDestroy()

public void dispatchMultiWindowModeChanged(boolean isInMultiWindowMode)

Deprecated: Have your FragmentHostCallback implement OnMultiWindowModeChangedProvider to automatically dispatch multi-window mode changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know the multi-window mode of the activity changed.

Call when the multi-window mode of the activity changed.

See also: Fragment.onMultiWindowModeChanged(boolean)

public void dispatchPictureInPictureModeChanged(boolean isInPictureInPictureMode)

Deprecated: Have your FragmentHostCallback implement OnPictureInPictureModeChangedProvider to automatically dispatch picture-in-picture mode changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know the picture-in-picture mode of the activity changed.

Call when the picture-in-picture mode of the activity changed.

See also: Fragment.onPictureInPictureModeChanged(boolean)

public void dispatchConfigurationChanged(Configuration newConfig)

Deprecated: Have your FragmentHostCallback implement OnConfigurationChangedProvider to automatically dispatch configuration changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know a configuration change occurred.

Call when there is a configuration change.

See also: Fragment.onConfigurationChanged(Configuration)

public void dispatchLowMemory()

Deprecated: Have your FragmentHostCallback implement OnTrimMemoryProvider to automatically dispatch low memory callbacks to fragments.

Lets all Fragments managed by the controller's FragmentManager know the device is in a low memory condition.

Call when the device is low on memory and Fragment's should trim their memory usage.

See also: Fragment.onLowMemory()

public boolean dispatchCreateOptionsMenu(Menu menu, MenuInflater inflater)

Deprecated: Have your FragmentHostCallback implement MenuHost to automatically dispatch menu changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know they should create an options menu.

Call when the Fragment should create an options menu.

Returns:

true if the options menu contains items to display

See also: Fragment.onCreateOptionsMenu(Menu, MenuInflater)

public boolean dispatchPrepareOptionsMenu(Menu menu)

Deprecated: Have your FragmentHostCallback implement MenuHost to automatically dispatch menu changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know they should prepare their options menu for display.

Call immediately before displaying the Fragment's options menu.

Returns:

true if the options menu contains items to display

See also: Fragment.onPrepareOptionsMenu(Menu)

public boolean dispatchOptionsItemSelected(MenuItem item)

Deprecated: Have your FragmentHostCallback implement MenuHost to automatically dispatch menu changes to fragments.

Sends an option item selection event to the Fragments managed by the controller's FragmentManager. Once the event has been consumed, no additional handling will be performed.

Call immediately after an options menu item has been selected

Returns:

true if the options menu selection event was consumed

See also: Fragment.onOptionsItemSelected(MenuItem)

public boolean dispatchContextItemSelected(MenuItem item)

Sends a context item selection event to the Fragments managed by the controller's FragmentManager. Once the event has been consumed, no additional handling will be performed.

Call immediately after an options menu item has been selected

Returns:

true if the context menu selection event was consumed

See also: Fragment.onContextItemSelected(MenuItem)

public void dispatchOptionsMenuClosed(Menu menu)

Deprecated: Have your FragmentHostCallback implement MenuHost to automatically dispatch menu changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know their options menu has closed.

Call immediately after closing the Fragment's options menu.

See also: Fragment.onOptionsMenuClosed(Menu)

public boolean execPendingActions()

Execute any pending actions for the Fragments managed by the controller's FragmentManager.

Call when queued actions can be performed [eg when the Fragment moves into a start or resume state].

Returns:

true if queued actions were performed

public void doLoaderStart()

Deprecated: Loaders are managed separately from FragmentController

Starts the loaders.

public void doLoaderStop(boolean retain)

Deprecated: Loaders are managed separately from FragmentController

Stops the loaders, optionally retaining their state. This is useful for keeping the loader state across configuration changes.

Parameters:

retain: When true, the loaders aren't stopped, but, their instances are retained in a started state

public void doLoaderRetain()

Deprecated: Loaders are managed separately from FragmentController

Retains the state of each of the loaders.

public void doLoaderDestroy()

Deprecated: Loaders are managed separately from FragmentController

Destroys the loaders and, if their state is not being retained, removes them.

public void reportLoaderStart()

Deprecated: Loaders are managed separately from FragmentController

Lets the loaders know the host is ready to receive notifications.

public SimpleArrayMap<java.lang.String, LoaderManager> retainLoaderNonConfig()

Deprecated: Loaders are managed separately from FragmentController

Returns a list of LoaderManagers that have opted to retain their instance across configuration changes.

public void restoreLoaderNonConfig(SimpleArrayMap<java.lang.String, LoaderManager> loaderManagers)

Deprecated: Loaders are managed separately from FragmentController

Restores the saved state for all LoaderManagers. The given LoaderManager list are LoaderManager instances retained across configuration changes.

See also: FragmentController.retainLoaderNonConfig()

public void dumpLoaders(java.lang.String prefix, java.io.FileDescriptor fd, java.io.PrintWriter writer, java.lang.String args[])

Deprecated: Loaders are managed separately from FragmentController

Dumps the current state of the loaders.

Source

/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.fragment.app;

import static androidx.core.util.Preconditions.checkNotNull;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.SimpleArrayMap;
import androidx.core.view.MenuHost;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.loader.app.LoaderManager;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * Provides integration points with a {@link FragmentManager} for a fragment host.
 * <p>
 * It is the responsibility of the host to take care of the Fragment's lifecycle.
 * The methods provided by {@link FragmentController} are for that purpose.
 */
public class FragmentController {
    private final FragmentHostCallback<?> mHost;

    /**
     * Returns a {@link FragmentController}.
     */
    @NonNull
    public static FragmentController createController(@NonNull FragmentHostCallback<?> callbacks) {
        return new FragmentController(checkNotNull(callbacks, "callbacks == null"));
    }

    private FragmentController(FragmentHostCallback<?> callbacks) {
        mHost = callbacks;
    }

    /**
     * Returns a {@link FragmentManager} for this controller.
     */
    @NonNull
    public FragmentManager getSupportFragmentManager() {
        return mHost.mFragmentManager;
    }

    /**
     * Returns a {@link LoaderManager}.
     *
     * @deprecated Loaders are managed separately from FragmentController and this now throws an
     * {@link UnsupportedOperationException}. Use {@link LoaderManager#getInstance} to obtain a
     * LoaderManager.
     * @see LoaderManager#getInstance
     */
    @Deprecated
    @SuppressLint("UnknownNullness")
    public LoaderManager getSupportLoaderManager() {
        throw new UnsupportedOperationException("Loaders are managed separately from "
                + "FragmentController, use LoaderManager.getInstance() to obtain a LoaderManager.");
    }

    /**
     * Returns a fragment with the given identifier.
     */
    @Nullable
    public Fragment findFragmentByWho(@NonNull String who) {
        return mHost.mFragmentManager.findFragmentByWho(who);
    }

    /**
     * Returns the number of active fragments.
     */
    public int getActiveFragmentsCount() {
        return mHost.mFragmentManager.getActiveFragmentCount();
    }

    /**
     * Returns the list of active fragments.
     */
    @NonNull
    public List<Fragment> getActiveFragments(@SuppressLint("UnknownNullness")
            List<Fragment> actives) {
        return mHost.mFragmentManager.getActiveFragments();
    }

    /**
     * Attaches the host to the FragmentManager for this controller. The host must be
     * attached before the FragmentManager can be used to manage Fragments.
     */
    public void attachHost(@Nullable Fragment parent) {
        mHost.mFragmentManager.attachController(
                mHost, mHost /*container*/, parent);
    }

    /**
     * Instantiates a Fragment's view.
     *
     * @param parent The parent that the created view will be placed
     * in; <em>note that this may be null</em>.
     * @param name Tag name to be inflated.
     * @param context The context the view is being created in.
     * @param attrs Inflation attributes as specified in XML file.
     *
     * @return view the newly created view
     */
    @Nullable
    public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context,
            @NonNull AttributeSet attrs) {
        return mHost.mFragmentManager.getLayoutInflaterFactory()
                .onCreateView(parent, name, context, attrs);
    }

    /**
     * Marks the fragment state as unsaved. This allows for "state loss" detection.
     */
    public void noteStateNotSaved() {
        mHost.mFragmentManager.noteStateNotSaved();
    }

    /**
     * Saves the state for all Fragments.
     *
     * @see #restoreSaveState(Parcelable)
     *
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link androidx.savedstate.SavedStateRegistryOwner} to automatically
     * save state via the {@link FragmentManager}.
     */
    @SuppressWarnings("deprecation")
    @Deprecated
    @Nullable
    public Parcelable saveAllState() {
        return mHost.mFragmentManager.saveAllState();
    }

    /**
     * Restores the saved state for all Fragments. The given Fragment list are Fragment
     * instances retained across configuration changes.
     *
     * @deprecated Have your {@link FragmentHostCallback} implement {@link ViewModelStoreOwner}
     * to automatically restore the Fragment's non configuration state and use
     * {@link #restoreSaveState(Parcelable)} to restore the Fragment's save state.
     */
    @SuppressWarnings("deprecation")
    @Deprecated
    public void restoreAllState(@Nullable Parcelable state,
            @Nullable List<Fragment> nonConfigList) {
        mHost.mFragmentManager.restoreAllState(state,
                new FragmentManagerNonConfig(nonConfigList, null, null));
    }

    /**
     * Restores the saved state for all Fragments. The given FragmentManagerNonConfig are Fragment
     * instances retained across configuration changes, including nested fragments
     *
     * @deprecated Have your {@link FragmentHostCallback} implement {@link ViewModelStoreOwner}
     * to automatically restore the Fragment's non configuration state and use
     * {@link #restoreSaveState(Parcelable)} to restore the Fragment's save state.
     */
    @SuppressWarnings("deprecation")
    @Deprecated
    public void restoreAllState(@Nullable Parcelable state,
            @Nullable FragmentManagerNonConfig nonConfig) {
        mHost.mFragmentManager.restoreAllState(state, nonConfig);
    }

    /**
     * Restores the saved state for all Fragments.
     *
     * @param state the saved state containing the Parcelable returned by {@link #saveAllState()}
     * @see #saveAllState()
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link androidx.savedstate.SavedStateRegistryOwner} to automatically
     * restore the saved state via the {@link FragmentManager}.
     */
    @SuppressWarnings("deprecation")
    @Deprecated
    public void restoreSaveState(@Nullable Parcelable state) {
        if (!(mHost instanceof ViewModelStoreOwner)) {
            throw new IllegalStateException("Your FragmentHostCallback must implement "
                    + "ViewModelStoreOwner to call restoreSaveState(). Call restoreAllState() "
                    + " if you're still using retainNestedNonConfig().");
        }
        mHost.mFragmentManager.restoreSaveState(state);
    }

    /**
     * Returns a list of Fragments that have opted to retain their instance across
     * configuration changes.
     *
     * @deprecated Have your {@link FragmentHostCallback} implement {@link ViewModelStoreOwner}
     * to automatically retain the Fragment's non configuration state.
     */
    @SuppressWarnings("deprecation")
    @Deprecated
    @Nullable
    public List<Fragment> retainNonConfig() {
        FragmentManagerNonConfig nonconf = mHost.mFragmentManager.retainNonConfig();
        return nonconf != null && nonconf.getFragments() != null
                ? new ArrayList<>(nonconf.getFragments())
                : null;
    }

    /**
     * Returns a nested tree of Fragments that have opted to retain their instance across
     * configuration changes.
     *
     * @deprecated Have your {@link FragmentHostCallback} implement {@link ViewModelStoreOwner}
     * to automatically retain the Fragment's non configuration state.
     */
    @SuppressWarnings("deprecation")
    @Deprecated
    @Nullable
    public FragmentManagerNonConfig retainNestedNonConfig() {
        return mHost.mFragmentManager.retainNonConfig();
    }

    /**
     * Moves all Fragments managed by the controller's FragmentManager
     * into the create state.
     * <p>Call when Fragments should be created.
     *
     * @see Fragment#onCreate(Bundle)
     */
    public void dispatchCreate() {
        mHost.mFragmentManager.dispatchCreate();
    }

    /**
     * Moves all Fragments managed by the controller's FragmentManager
     * into the activity created state.
     * <p>Call when Fragments should be informed their host has been created.
     *
     * @see Fragment#onActivityCreated(Bundle)
     */
    public void dispatchActivityCreated() {
        mHost.mFragmentManager.dispatchActivityCreated();
    }

    /**
     * Moves all Fragments managed by the controller's FragmentManager
     * into the start state.
     * <p>Call when Fragments should be started.
     *
     * @see Fragment#onStart()
     */
    public void dispatchStart() {
        mHost.mFragmentManager.dispatchStart();
    }

    /**
     * Moves all Fragments managed by the controller's FragmentManager
     * into the resume state.
     * <p>Call when Fragments should be resumed.
     *
     * @see Fragment#onResume()
     */
    public void dispatchResume() {
        mHost.mFragmentManager.dispatchResume();
    }

    /**
     * Moves all Fragments managed by the controller's FragmentManager
     * into the pause state.
     * <p>Call when Fragments should be paused.
     *
     * @see Fragment#onPause()
     */
    public void dispatchPause() {
        mHost.mFragmentManager.dispatchPause();
    }

    /**
     * Moves all Fragments managed by the controller's FragmentManager
     * into the stop state.
     * <p>Call when Fragments should be stopped.
     *
     * @see Fragment#onStop()
     */
    public void dispatchStop() {
        mHost.mFragmentManager.dispatchStop();
    }

    /**
     * @deprecated This functionality has been rolled into {@link #dispatchStop()}.
     */
    @Deprecated
    public void dispatchReallyStop() {
    }

    /**
     * Moves all Fragments managed by the controller's FragmentManager
     * into the destroy view state.
     * <p>Call when the Fragment's views should be destroyed.
     *
     * @see Fragment#onDestroyView()
     */
    public void dispatchDestroyView() {
        mHost.mFragmentManager.dispatchDestroyView();
    }

    /**
     * Moves Fragments managed by the controller's FragmentManager
     * into the destroy state.
     * <p>
     * If the {@link androidx.fragment.app.FragmentHostCallback} is an instance of {@link ViewModelStoreOwner},
     * then retained Fragments and any other non configuration state such as any
     * {@link androidx.lifecycle.ViewModel} attached to Fragments will only be destroyed if
     * {@link androidx.lifecycle.ViewModelStore#clear()} is called prior to this method.
     * <p>
     * Otherwise, the FragmentManager will look to see if the
     * {@link FragmentHostCallback host's} Context is an {@link Activity}
     * and if {@link Activity#isChangingConfigurations()} returns true. In only that case
     * will non configuration state be retained.
     * <p>Call when Fragments should be destroyed.
     *
     * @see Fragment#onDestroy()
     */
    public void dispatchDestroy() {
        mHost.mFragmentManager.dispatchDestroy();
    }

    /**
     * Lets all Fragments managed by the controller's FragmentManager know the multi-window mode of
     * the activity changed.
     * <p>Call when the multi-window mode of the activity changed.
     *
     * @see Fragment#onMultiWindowModeChanged
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link androidx.core.app.OnMultiWindowModeChangedProvider}
     * to automatically dispatch multi-window mode changes to fragments.
     */
    @Deprecated
    public void dispatchMultiWindowModeChanged(boolean isInMultiWindowMode) {
        mHost.mFragmentManager.dispatchMultiWindowModeChanged(isInMultiWindowMode);
    }

    /**
     * Lets all Fragments managed by the controller's FragmentManager know the picture-in-picture
     * mode of the activity changed.
     * <p>Call when the picture-in-picture mode of the activity changed.
     *
     * @see Fragment#onPictureInPictureModeChanged
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link androidx.core.app.OnPictureInPictureModeChangedProvider}
     * to automatically dispatch picture-in-picture mode changes to fragments.
     */
    @Deprecated
    public void dispatchPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
        mHost.mFragmentManager.dispatchPictureInPictureModeChanged(isInPictureInPictureMode);
    }

    /**
     * Lets all Fragments managed by the controller's FragmentManager
     * know a configuration change occurred.
     * <p>Call when there is a configuration change.
     *
     * @see Fragment#onConfigurationChanged(Configuration)
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link androidx.core.content.OnConfigurationChangedProvider}
     * to automatically dispatch configuration changes to fragments.
     */
    @Deprecated
    public void dispatchConfigurationChanged(@NonNull Configuration newConfig) {
        mHost.mFragmentManager.dispatchConfigurationChanged(newConfig);
    }

    /**
     * Lets all Fragments managed by the controller's FragmentManager
     * know the device is in a low memory condition.
     * <p>Call when the device is low on memory and Fragment's should trim
     * their memory usage.
     *
     * @see Fragment#onLowMemory()
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link androidx.core.content.OnTrimMemoryProvider}
     * to automatically dispatch low memory callbacks to fragments.
     */
    @Deprecated
    public void dispatchLowMemory() {
        mHost.mFragmentManager.dispatchLowMemory();
    }

    /**
     * Lets all Fragments managed by the controller's FragmentManager
     * know they should create an options menu.
     * <p>Call when the Fragment should create an options menu.
     *
     * @return {@code true} if the options menu contains items to display
     * @see Fragment#onCreateOptionsMenu(Menu, MenuInflater)
     *
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link MenuHost} to automatically dispatch menu changes to fragments.
     */
    @Deprecated
    public boolean dispatchCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
        return mHost.mFragmentManager.dispatchCreateOptionsMenu(menu, inflater);
    }

    /**
     * Lets all Fragments managed by the controller's FragmentManager
     * know they should prepare their options menu for display.
     * <p>Call immediately before displaying the Fragment's options menu.
     *
     * @return {@code true} if the options menu contains items to display
     * @see Fragment#onPrepareOptionsMenu(Menu)
     *
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link MenuHost} to automatically dispatch menu changes to fragments.
     */
    @Deprecated
    public boolean dispatchPrepareOptionsMenu(@NonNull Menu menu) {
        return mHost.mFragmentManager.dispatchPrepareOptionsMenu(menu);
    }

    /**
     * Sends an option item selection event to the Fragments managed by the
     * controller's FragmentManager. Once the event has been consumed,
     * no additional handling will be performed.
     * <p>Call immediately after an options menu item has been selected
     *
     * @return {@code true} if the options menu selection event was consumed
     * @see Fragment#onOptionsItemSelected(MenuItem)
     *
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link MenuHost} to automatically dispatch menu changes to fragments.
     */
    @Deprecated
    public boolean dispatchOptionsItemSelected(@NonNull MenuItem item) {
        return mHost.mFragmentManager.dispatchOptionsItemSelected(item);
    }

    /**
     * Sends a context item selection event to the Fragments managed by the
     * controller's FragmentManager. Once the event has been consumed,
     * no additional handling will be performed.
     * <p>Call immediately after an options menu item has been selected
     *
     * @return {@code true} if the context menu selection event was consumed
     * @see Fragment#onContextItemSelected(MenuItem)
     */
    public boolean dispatchContextItemSelected(@NonNull MenuItem item) {
        return mHost.mFragmentManager.dispatchContextItemSelected(item);
    }

    /**
     * Lets all Fragments managed by the controller's FragmentManager
     * know their options menu has closed.
     * <p>Call immediately after closing the Fragment's options menu.
     *
     * @see Fragment#onOptionsMenuClosed(Menu)
     *
     * @deprecated Have your {@link FragmentHostCallback} implement
     * {@link MenuHost} to automatically dispatch menu changes to fragments.
     */
    @Deprecated
    public void dispatchOptionsMenuClosed(@NonNull Menu menu) {
        mHost.mFragmentManager.dispatchOptionsMenuClosed(menu);
    }

    /**
     * Execute any pending actions for the Fragments managed by the
     * controller's FragmentManager.
     * <p>Call when queued actions can be performed [eg when the
     * Fragment moves into a start or resume state].
     * @return {@code true} if queued actions were performed
     */
    public boolean execPendingActions() {
        return mHost.mFragmentManager.execPendingActions(true);
    }

    /**
     * Starts the loaders.
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    public void doLoaderStart() {
    }

    /**
     * Stops the loaders, optionally retaining their state. This is useful for keeping the
     * loader state across configuration changes.
     *
     * @param retain When {@code true}, the loaders aren't stopped, but, their instances
     * are retained in a started state
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    public void doLoaderStop(boolean retain) {
    }

    /**
     * Retains the state of each of the loaders.
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    public void doLoaderRetain() {
    }

    /**
     * Destroys the loaders and, if their state is not being retained, removes them.
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    public void doLoaderDestroy() {
    }

    /**
     * Lets the loaders know the host is ready to receive notifications.
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    public void reportLoaderStart() {
    }

    /**
     * Returns a list of LoaderManagers that have opted to retain their instance across
     * configuration changes.
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    @Nullable
    public SimpleArrayMap<String, LoaderManager> retainLoaderNonConfig() {
        return null;
    }

    /**
     * Restores the saved state for all LoaderManagers. The given LoaderManager list are
     * LoaderManager instances retained across configuration changes.
     *
     * @see #retainLoaderNonConfig()
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    public void restoreLoaderNonConfig(@SuppressLint("UnknownNullness")
            SimpleArrayMap<String, LoaderManager> loaderManagers) {
    }

    /**
     * Dumps the current state of the loaders.
     *
     * @deprecated Loaders are managed separately from FragmentController
     */
    @Deprecated
    public void dumpLoaders(@NonNull String prefix, @Nullable FileDescriptor fd,
            @NonNull PrintWriter writer, @Nullable String[] args) {
    }
}