Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b79ad65 authored by Todd Kennedy's avatar Todd Kennedy Committed by Android (Google) Code Review
Browse files

Merge "save "retain loader" state"

parents f8f2e334 c5ac16f5
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -465,6 +465,9 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
    // If set this fragment is being retained across the current config change.
    boolean mRetaining;

    // If set this fragment's loaders are being retained across the current config change.
    boolean mRetainLoader;

    // If set this fragment has menu items to contribute.
    boolean mHasMenu;

@@ -2412,7 +2415,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
                mLoaderManager = mHost.getLoaderManager(mWho, mLoadersStarted, false);
            }
            if (mLoaderManager != null) {
                if (mRetaining) {
                if (mRetainLoader) {
                    mLoaderManager.doRetain();
                } else {
                    mLoaderManager.doStop();
+1 −0
Original line number Diff line number Diff line
@@ -341,6 +341,7 @@ public class FragmentController {
     */
    public void doLoaderStop(boolean retain) {
        mHost.doLoaderStop(retain);
        mHost.mFragmentManager.setRetainLoader(retain);
    }

    /**
+11 −0
Original line number Diff line number Diff line
@@ -869,6 +869,17 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
        }
    }

    void setRetainLoader(boolean retain) {
        if (mActive != null) {
            for (int i=0; i<mActive.size(); i++) {
                Fragment f = mActive.get(i);
                if (f != null) {
                    f.mRetainLoader = retain;
                }
            }
        }
    }

    void moveToState(Fragment f, int newState, int transit, int transitionStyle,
            boolean keepActive) {
        if (DEBUG && false) Log.v(TAG, "moveToState: " + f