Fix bug 5557267 - [ViewPager] non-primary fragments unnecessary

stopped if "defer start" is enabled

Only revise the target state in moveToState if it would cross the
stopped/started boundary.

Change-Id: I8f6e400331157eac9343261117cf633611fc1e4d
This commit is contained in:
Adam Powell
2011-11-02 14:30:47 -07:00
parent 7a5a50c12f
commit 2db4e4bd1b

View File

@ -725,8 +725,9 @@ final class FragmentManagerImpl extends FragmentManager {
// While removing a fragment, we can't change it to a higher state.
newState = f.mState;
}
// Defer start if requested; don't allow it to move to STARTED or higher.
if (f.mDeferStart && newState > Fragment.STOPPED) {
// Defer start if requested; don't allow it to move to STARTED or higher
// if it's not already started.
if (f.mDeferStart && f.mState < Fragment.STARTED && newState > Fragment.STOPPED) {
newState = Fragment.STOPPED;
}
if (f.mState < newState) {