method public abstract android.app.FragmentTransaction remove(android.app.Fragment);
method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment);
method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment, java.lang.String);
- method public abstract android.app.FragmentTransaction setAllowOptimization(boolean);
method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(int);
method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence);
method public abstract android.app.FragmentTransaction setBreadCrumbTitle(int);
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int);
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int);
method public abstract android.app.FragmentTransaction setPrimaryNavigationFragment(android.app.Fragment);
+ method public abstract android.app.FragmentTransaction setReorderingAllowed(boolean);
method public abstract android.app.FragmentTransaction setTransition(int);
method public abstract android.app.FragmentTransaction setTransitionStyle(int);
method public abstract android.app.FragmentTransaction show(android.app.Fragment);
method public abstract android.app.FragmentTransaction remove(android.app.Fragment);
method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment);
method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment, java.lang.String);
- method public abstract android.app.FragmentTransaction setAllowOptimization(boolean);
method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(int);
method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence);
method public abstract android.app.FragmentTransaction setBreadCrumbTitle(int);
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int);
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int);
method public abstract android.app.FragmentTransaction setPrimaryNavigationFragment(android.app.Fragment);
+ method public abstract android.app.FragmentTransaction setReorderingAllowed(boolean);
method public abstract android.app.FragmentTransaction setTransition(int);
method public abstract android.app.FragmentTransaction setTransitionStyle(int);
method public abstract android.app.FragmentTransaction show(android.app.Fragment);
method public abstract android.app.FragmentTransaction remove(android.app.Fragment);
method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment);
method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment, java.lang.String);
- method public abstract android.app.FragmentTransaction setAllowOptimization(boolean);
method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(int);
method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence);
method public abstract android.app.FragmentTransaction setBreadCrumbTitle(int);
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int);
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int);
method public abstract android.app.FragmentTransaction setPrimaryNavigationFragment(android.app.Fragment);
+ method public abstract android.app.FragmentTransaction setReorderingAllowed(boolean);
method public abstract android.app.FragmentTransaction setTransition(int);
method public abstract android.app.FragmentTransaction setTransitionStyle(int);
method public abstract android.app.FragmentTransaction show(android.app.Fragment);
package android.app;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
final CharSequence mBreadCrumbShortTitleText;
final ArrayList<String> mSharedElementSourceNames;
final ArrayList<String> mSharedElementTargetNames;
- final boolean mAllowOptimization;
+ final boolean mReorderingAllowed;
public BackStackState(FragmentManagerImpl fm, BackStackRecord bse) {
final int numOps = bse.mOps.size();
mBreadCrumbShortTitleText = bse.mBreadCrumbShortTitleText;
mSharedElementSourceNames = bse.mSharedElementSourceNames;
mSharedElementTargetNames = bse.mSharedElementTargetNames;
- mAllowOptimization = bse.mAllowOptimization;
+ mReorderingAllowed = bse.mReorderingAllowed;
}
public BackStackState(Parcel in) {
mBreadCrumbShortTitleText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
mSharedElementSourceNames = in.createStringArrayList();
mSharedElementTargetNames = in.createStringArrayList();
- mAllowOptimization = in.readInt() != 0;
+ mReorderingAllowed = in.readInt() != 0;
}
public BackStackRecord instantiate(FragmentManagerImpl fm) {
bse.mBreadCrumbShortTitleText = mBreadCrumbShortTitleText;
bse.mSharedElementSourceNames = mSharedElementSourceNames;
bse.mSharedElementTargetNames = mSharedElementTargetNames;
- bse.mAllowOptimization = mAllowOptimization;
+ bse.mReorderingAllowed = mReorderingAllowed;
bse.bumpBackStackNesting(1);
return bse;
}
TextUtils.writeToParcel(mBreadCrumbShortTitleText, dest, 0);
dest.writeStringList(mSharedElementSourceNames);
dest.writeStringList(mSharedElementTargetNames);
- dest.writeInt(mAllowOptimization ? 1 : 0);
+ dest.writeInt(mReorderingAllowed ? 1 : 0);
}
public static final Parcelable.Creator<BackStackState> CREATOR
String mName;
boolean mCommitted;
int mIndex = -1;
- boolean mAllowOptimization;
+ boolean mReorderingAllowed;
ArrayList<Runnable> mCommitRunnables;
public BackStackRecord(FragmentManagerImpl manager) {
mManager = manager;
- mAllowOptimization = mManager.getTargetSdk() > Build.VERSION_CODES.N_MR1;
+ mReorderingAllowed = mManager.getTargetSdk() > Build.VERSION_CODES.N_MR1;
}
public int getId() {
}
@Override
- public FragmentTransaction setAllowOptimization(boolean allowOptimization) {
- mAllowOptimization = allowOptimization;
+ public FragmentTransaction setReorderingAllowed(boolean reorderingAllowed) {
+ mReorderingAllowed = reorderingAllowed;
return this;
}
default:
throw new IllegalArgumentException("Unknown cmd: " + op.cmd);
}
- if (!mAllowOptimization && op.cmd != OP_ADD && f != null) {
+ if (!mReorderingAllowed && op.cmd != OP_ADD && f != null) {
mManager.moveFragmentToExpectedState(f);
}
}
- if (!mAllowOptimization) {
+ if (!mReorderingAllowed) {
// Added fragments are added at the end to comply with prior behavior.
mManager.moveToState(mManager.mCurState, true);
}
default:
throw new IllegalArgumentException("Unknown cmd: " + op.cmd);
}
- if (!mAllowOptimization && op.cmd != OP_REMOVE && f != null) {
+ if (!mReorderingAllowed && op.cmd != OP_REMOVE && f != null) {
mManager.moveFragmentToExpectedState(f);
}
}
- if (!mAllowOptimization && moveToState) {
+ if (!mReorderingAllowed && moveToState) {
mManager.moveToState(mManager.mCurState, true);
}
}
* enabled.
*
* @see Activity#postponeEnterTransition()
- * @see FragmentTransaction#setAllowOptimization(boolean)
+ * @see FragmentTransaction#setReorderingAllowed(boolean)
*/
public void postponeEnterTransition() {
ensureAnimationInfo().mEnterTransitionPostponed = true;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
String mNoTransactionsBecause;
boolean mHavePendingDeferredStart;
- // Temporary vars for optimizing execution of BackStackRecords:
+ // Temporary vars for removing redundant operations in BackStackRecords:
ArrayList<BackStackRecord> mTmpRecords;
ArrayList<Boolean> mTmpIsPop;
ArrayList<Fragment> mTmpAddedFragments;
if (executePop) {
mExecutingActions = true;
try {
- optimizeAndExecuteOps(mTmpRecords, mTmpIsPop);
+ removeRedundantOperationsAndExecute(mTmpRecords, mTmpIsPop);
} finally {
cleanupExec();
}
if (action.generateOps(mTmpRecords, mTmpIsPop)) {
mExecutingActions = true;
try {
- optimizeAndExecuteOps(mTmpRecords, mTmpIsPop);
+ removeRedundantOperationsAndExecute(mTmpRecords, mTmpIsPop);
} finally {
cleanupExec();
}
while (generateOpsForPendingActions(mTmpRecords, mTmpIsPop)) {
mExecutingActions = true;
try {
- optimizeAndExecuteOps(mTmpRecords, mTmpIsPop);
+ removeRedundantOperationsAndExecute(mTmpRecords, mTmpIsPop);
} finally {
cleanupExec();
}
}
/**
- * Optimizes BackStackRecord operations. This method merges operations of proximate records
- * that allow optimization. See {@link FragmentTransaction#setAllowOptimization(boolean)}.
+ * Remove redundant BackStackRecord operations and executes them. This method merges operations
+ * of proximate records that allow reordering. See
+ * {@link FragmentTransaction#setReorderingAllowed(boolean)}.
* <p>
* For example, a transaction that adds to the back stack and then another that pops that
- * back stack record will be optimized.
+ * back stack record will be optimized to remove the unnecessary operation.
* <p>
* Likewise, two transactions committed that are executed at the same time will be optimized
- * as well as two pop operations executed together.
+ * to remove the redundant operations as well as two pop operations executed together.
*
* @param records The records pending execution
* @param isRecordPop The direction that these records are being run.
*/
- private void optimizeAndExecuteOps(ArrayList<BackStackRecord> records,
+ private void removeRedundantOperationsAndExecute(ArrayList<BackStackRecord> records,
ArrayList<Boolean> isRecordPop) {
if (records == null || records.isEmpty()) {
return;
final int numRecords = records.size();
int startIndex = 0;
for (int recordNum = 0; recordNum < numRecords; recordNum++) {
- final boolean canOptimize = records.get(recordNum).mAllowOptimization;
- if (!canOptimize) {
+ final boolean canReorder = records.get(recordNum).mReorderingAllowed;
+ if (!canReorder) {
// execute all previous transactions
if (startIndex != recordNum) {
executeOpsTogether(records, isRecordPop, startIndex, recordNum);
}
- // execute all unoptimized pop operations together or one add operation
- int optimizeEnd = recordNum + 1;
+ // execute all pop operations that don't allow reordering together or
+ // one add operation
+ int reorderingEnd = recordNum + 1;
if (isRecordPop.get(recordNum)) {
- while (optimizeEnd < numRecords
- && isRecordPop.get(optimizeEnd)
- && !records.get(optimizeEnd).mAllowOptimization) {
- optimizeEnd++;
+ while (reorderingEnd < numRecords
+ && isRecordPop.get(reorderingEnd)
+ && !records.get(reorderingEnd).mReorderingAllowed) {
+ reorderingEnd++;
}
}
- executeOpsTogether(records, isRecordPop, recordNum, optimizeEnd);
- startIndex = optimizeEnd;
- recordNum = optimizeEnd - 1;
+ executeOpsTogether(records, isRecordPop, recordNum, reorderingEnd);
+ startIndex = reorderingEnd;
+ recordNum = reorderingEnd - 1;
}
}
if (startIndex != numRecords) {
}
/**
- * Optimizes a subset of a list of BackStackRecords, all of which either allow optimization or
- * do not allow optimization.
- * @param records A list of BackStackRecords that are to be optimized
+ * Executes a subset of a list of BackStackRecords, all of which either allow reordering or
+ * do not allow ordering.
+ * @param records A list of BackStackRecords that are to be executed together
* @param isRecordPop The direction that these records are being run.
- * @param startIndex The index of the first record in <code>records</code> to be optimized
- * @param endIndex One more than the final record index in <code>records</code> to optimize.
+ * @param startIndex The index of the first record in <code>records</code> to be executed
+ * @param endIndex One more than the final record index in <code>records</code> to executed.
*/
private void executeOpsTogether(ArrayList<BackStackRecord> records,
ArrayList<Boolean> isRecordPop, int startIndex, int endIndex) {
- final boolean allowOptimization = records.get(startIndex).mAllowOptimization;
+ final boolean allowReordering = records.get(startIndex).mReorderingAllowed;
boolean addToBackStack = false;
if (mTmpAddedFragments == null) {
mTmpAddedFragments = new ArrayList<>();
}
mTmpAddedFragments.clear();
- if (!allowOptimization) {
+ if (!allowReordering) {
FragmentTransition.startTransitions(this, records, isRecordPop, startIndex, endIndex,
false);
}
executeOps(records, isRecordPop, startIndex, endIndex);
int postponeIndex = endIndex;
- if (allowOptimization) {
+ if (allowReordering) {
ArraySet<Fragment> addedFragments = new ArraySet<>();
addAddedFragments(addedFragments);
postponeIndex = postponePostponableTransactions(records, isRecordPop,
makeRemovedFragmentsInvisible(addedFragments);
}
- if (postponeIndex != startIndex && allowOptimization) {
+ if (postponeIndex != startIndex && allowReordering) {
// need to run something now
FragmentTransition.startTransitions(this, records, isRecordPop, startIndex,
postponeIndex, true);
import android.annotation.Nullable;
import android.annotation.StringRes;
import android.annotation.StyleRes;
+import android.os.Bundle;
import android.view.View;
import java.lang.annotation.Retention;
/**
* Sets whether or not to allow optimizing operations within and across
- * transactions. Optimizing fragment transaction's operations can eliminate
+ * transactions. This will remove redundant operations, eliminating
* operations that cancel. For example, if two transactions are executed
* together, one that adds a fragment A and the next replaces it with fragment B,
* the operations will cancel and only fragment B will be added. That means that
* fragment A may not go through the creation/destruction lifecycle.
* <p>
- * The side effect of optimization is that fragments may have state changes
+ * The side effect of removing redundant operations is that fragments may have state changes
* out of the expected order. For example, one transaction adds fragment A,
- * a second adds fragment B, then a third removes fragment A. Without optimization,
- * fragment B could expect that while it is being created, fragment A will also
+ * a second adds fragment B, then a third removes fragment A. Without removing the redundant
+ * operations, fragment B could expect that while it is being created, fragment A will also
* exist because fragment A will be removed after fragment B was added.
- * With optimization, fragment B cannot expect fragment A to exist when
+ * With removing redundant operations, fragment B cannot expect fragment A to exist when
* it has been created because fragment A's add/remove will be optimized out.
* <p>
+ * It can also reorder the state changes of Fragments to allow for better Transitions.
+ * Added Fragments may have {@link Fragment#onCreate(Bundle)} called before replaced
+ * Fragments have {@link Fragment#onDestroy()} called.
+ * <p>
* The default is {@code false} for applications targeting version
* versions prior to O and {@code true} for applications targeting O and
* later.
*
- * @param allowOptimization {@code true} to enable optimizing operations
- * or {@code false} to disable optimizing
+ * @param reorderingAllowed {@code true} to enable optimizing out redundant operations
+ * or {@code false} to disable optimizing out redundant
* operations on this transaction.
*/
- public abstract FragmentTransaction setAllowOptimization(boolean allowOptimization);
+ public abstract FragmentTransaction setReorderingAllowed(boolean reorderingAllowed);
/**
* Add a Runnable to this transaction that will be run after this transaction has
- * been committed. If fragment transactions are {@link #setAllowOptimization(boolean) optimized}
+ * been committed. If fragment transactions are {@link #setReorderingAllowed(boolean) optimized}
* this may be after other subsequent fragment operations have also taken place, or operations
* in this transaction may have been optimized out due to the presence of a subsequent
* fragment transaction in the batch.
import java.util.Map;
/**
- * Contains the Fragment Transition functionality for both optimized and unoptimized
- * Fragment Transactions. With optimized fragment transactions, all Views have been
- * added to the View hierarchy prior to calling startTransitions. With
+ * Contains the Fragment Transition functionality for both ordered and reordered
+ * Fragment Transactions. With reordered fragment transactions, all Views have been
+ * added to the View hierarchy prior to calling startTransitions. With ordered
+ * fragment transactions, Views will be removed and added after calling startTransitions.
*/
class FragmentTransition {
/**
* {@link Fragment#getSharedElementReturnTransition()} and the entering
* {@link Fragment#getReenterTransition()} will be run.
* <p>
- * With optimized Fragment Transitions, all Views have been added to the
+ * With reordered Fragment Transitions, all Views have been added to the
* View hierarchy prior to calling this method. The incoming Fragment's Views
- * will be INVISIBLE. With unoptimized Fragment Transitions, this method
+ * will be INVISIBLE. With ordered Fragment Transitions, this method
* is called before any change has been made to the hierarchy. That means
* that the added Fragments have not created their Views yet and the hierarchy
* is unknown.
* part of this transition.
* @param endIndex One past the last index into records and isRecordPop to execute
* as part of this transition.
- * @param isOptimized true if this is an optimized transaction, meaning that the
+ * @param isReordered true if this is a reordered transaction, meaning that the
* Views of incoming fragments have been added. false if the
* transaction has yet to be run and Views haven't been created.
*/
static void startTransitions(FragmentManagerImpl fragmentManager,
ArrayList<BackStackRecord> records, ArrayList<Boolean> isRecordPop,
- int startIndex, int endIndex, boolean isOptimized) {
+ int startIndex, int endIndex, boolean isReordered) {
if (fragmentManager.mCurState < Fragment.CREATED) {
return;
}
final BackStackRecord record = records.get(i);
final boolean isPop = isRecordPop.get(i);
if (isPop) {
- calculatePopFragments(record, transitioningFragments, isOptimized);
+ calculatePopFragments(record, transitioningFragments, isReordered);
} else {
- calculateFragments(record, transitioningFragments, isOptimized);
+ calculateFragments(record, transitioningFragments, isReordered);
}
}
FragmentContainerTransition containerTransition = transitioningFragments.valueAt(i);
- if (isOptimized) {
- configureTransitionsOptimized(fragmentManager, containerId,
+ if (isReordered) {
+ configureTransitionsReordered(fragmentManager, containerId,
containerTransition, nonExistentView, nameOverrides);
} else {
- configureTransitionsUnoptimized(fragmentManager, containerId,
+ configureTransitionsOrdered(fragmentManager, containerId,
containerTransition, nonExistentView, nameOverrides);
}
}
/**
* Configures a transition for a single fragment container for which the transaction was
- * optimized. That means that all Fragment Views have been added and incoming fragment
+ * reordered. That means that all Fragment Views have been added and incoming fragment
* Views are marked invisible.
*
* @param fragmentManager The executing FragmentManagerImpl
* the final fragment's Views as given in
* {@link FragmentTransaction#addSharedElement(View, String)}.
*/
- private static void configureTransitionsOptimized(FragmentManagerImpl fragmentManager,
+ private static void configureTransitionsReordered(FragmentManagerImpl fragmentManager,
int containerId, FragmentContainerTransition fragments,
View nonExistentView, ArrayMap<String, String> nameOverrides) {
ViewGroup sceneRoot = null;
Transition enterTransition = getEnterTransition(inFragment, inIsPop);
Transition exitTransition = getExitTransition(outFragment, outIsPop);
- TransitionSet sharedElementTransition = configureSharedElementsOptimized(sceneRoot,
+ TransitionSet sharedElementTransition = configureSharedElementsReordered(sceneRoot,
nonExistentView, nameOverrides, fragments, sharedElementsOut, sharedElementsIn,
enterTransition, exitTransition);
/**
* Configures a transition for a single fragment container for which the transaction was
- * not optimized. That means that the transaction has not been executed yet, so incoming
+ * ordered. That means that the transaction has not been executed yet, so incoming
* Views are not yet known.
*
* @param fragmentManager The executing FragmentManagerImpl
* the final fragment's Views as given in
* {@link FragmentTransaction#addSharedElement(View, String)}.
*/
- private static void configureTransitionsUnoptimized(FragmentManagerImpl fragmentManager,
+ private static void configureTransitionsOrdered(FragmentManagerImpl fragmentManager,
int containerId, FragmentContainerTransition fragments,
View nonExistentView, ArrayMap<String, String> nameOverrides) {
ViewGroup sceneRoot = null;
ArrayList<View> sharedElementsOut = new ArrayList<>();
ArrayList<View> sharedElementsIn = new ArrayList<>();
- TransitionSet sharedElementTransition = configureSharedElementsUnoptimized(sceneRoot,
+ TransitionSet sharedElementTransition = configureSharedElementsOrdered(sceneRoot,
nonExistentView, nameOverrides, fragments, sharedElementsOut, sharedElementsIn,
enterTransition, exitTransition);
}
/**
- * This method is used for fragment transitions for unoptimized transactions to change the
+ * This method is used for fragment transitions for ordered transactions to change the
* enter and exit transition targets after the call to
* {@link TransitionManager#beginDelayedTransition(ViewGroup, Transition)}. The exit transition
* must ensure that it does not target any Views and the enter transition must start targeting
}
/**
- * Configures the shared elements of an optimized fragment transaction's transition.
+ * Configures the shared elements of an reordered fragment transaction's transition.
* This retrieves the shared elements of the outgoing and incoming fragments, maps the
* views, and sets up the epicenter on the transitions.
* <p>
* epicenter
* @return The shared element transition or null if no shared elements exist
*/
- private static TransitionSet configureSharedElementsOptimized(final ViewGroup sceneRoot,
+ private static TransitionSet configureSharedElementsReordered(final ViewGroup sceneRoot,
final View nonExistentView, ArrayMap<String, String> nameOverrides,
final FragmentContainerTransition fragments,
final ArrayList<View> sharedElementsOut,
}
/**
- * Configures the shared elements of an unoptimized fragment transaction's transition.
+ * Configures the shared elements of an ordered fragment transaction's transition.
* This retrieves the shared elements of the incoming fragments, and schedules capturing
* the incoming fragment's shared elements. It also maps the views, and sets up the epicenter
* on the transitions.
* epicenter
* @return The shared element transition or null if no shared elements exist
*/
- private static TransitionSet configureSharedElementsUnoptimized(final ViewGroup sceneRoot,
+ private static TransitionSet configureSharedElementsOrdered(final ViewGroup sceneRoot,
final View nonExistentView, ArrayMap<String, String> nameOverrides,
final FragmentContainerTransition fragments,
final ArrayList<View> sharedElementsOut,
*/
public static void calculateFragments(BackStackRecord transaction,
SparseArray<FragmentContainerTransition> transitioningFragments,
- boolean isOptimized) {
+ boolean isReordered) {
final int numOps = transaction.mOps.size();
for (int opNum = 0; opNum < numOps; opNum++) {
final BackStackRecord.Op op = transaction.mOps.get(opNum);
- addToFirstInLastOut(transaction, op, transitioningFragments, false, isOptimized);
+ addToFirstInLastOut(transaction, op, transitioningFragments, false, isReordered);
}
}
* this method.
*/
public static void calculatePopFragments(BackStackRecord transaction,
- SparseArray<FragmentContainerTransition> transitioningFragments, boolean isOptimized) {
+ SparseArray<FragmentContainerTransition> transitioningFragments, boolean isReordered) {
if (!transaction.mManager.mContainer.onHasView()) {
return; // nothing to see, so no transitions
}
final int numOps = transaction.mOps.size();
for (int opNum = numOps - 1; opNum >= 0; opNum--) {
final BackStackRecord.Op op = transaction.mOps.get(opNum);
- addToFirstInLastOut(transaction, op, transitioningFragments, true, isOptimized);
+ addToFirstInLastOut(transaction, op, transitioningFragments, true, isReordered);
}
}
* @param transitioningFragments A structure holding the first in and last out fragments
* for each fragment container.
* @param isPop Is the operation a pop?
- * @param isOptimizedTransaction True if the operations have been partially executed and the
+ * @param isReorderedTransaction True if the operations have been partially executed and the
* added fragments have Views in the hierarchy or false if the
* operations haven't been executed yet.
*/
@SuppressWarnings("ReferenceEquality")
private static void addToFirstInLastOut(BackStackRecord transaction, BackStackRecord.Op op,
SparseArray<FragmentContainerTransition> transitioningFragments, boolean isPop,
- boolean isOptimizedTransaction) {
+ boolean isReorderedTransaction) {
final Fragment fragment = op.fragment;
if (fragment == null) {
return; // no fragment, no transition
boolean wasAdded = false;
switch (command) {
case BackStackRecord.OP_SHOW:
- if (isOptimizedTransaction) {
+ if (isReorderedTransaction) {
setLastIn = fragment.mHiddenChanged && !fragment.mHidden &&
fragment.mAdded;
} else {
break;
case BackStackRecord.OP_ADD:
case BackStackRecord.OP_ATTACH:
- if (isOptimizedTransaction) {
+ if (isReorderedTransaction) {
setLastIn = fragment.mIsNewlyAdded;
} else {
setLastIn = !fragment.mAdded && !fragment.mHidden;
wasAdded = true;
break;
case BackStackRecord.OP_HIDE:
- if (isOptimizedTransaction) {
+ if (isReorderedTransaction) {
setFirstOut = fragment.mHiddenChanged && fragment.mAdded &&
fragment.mHidden;
} else {
break;
case BackStackRecord.OP_REMOVE:
case BackStackRecord.OP_DETACH:
- if (isOptimizedTransaction) {
+ if (isReorderedTransaction) {
setFirstOut = !fragment.mAdded && fragment.mView != null
&& fragment.mView.getVisibility() == View.VISIBLE
&& fragment.mView.getTransitionAlpha() > 0;
containerTransition.lastInIsPop = isPop;
containerTransition.lastInTransaction = transaction;
}
- if (!isOptimizedTransaction && wasAdded) {
+ if (!isReorderedTransaction && wasAdded) {
if (containerTransition != null && containerTransition.firstOut == fragment) {
containerTransition.firstOut = null;
}
FragmentManagerImpl manager = transaction.mManager;
if (fragment.mState < Fragment.CREATED && manager.mCurState >= Fragment.CREATED &&
manager.mHost.getContext().getApplicationInfo().targetSdkVersion >=
- Build.VERSION_CODES.N && !transaction.mAllowOptimization) {
+ Build.VERSION_CODES.N && !transaction.mReorderingAllowed) {
manager.makeActive(fragment);
manager.moveToState(fragment, Fragment.CREATED, 0, 0, false);
}
containerTransition.firstOutTransaction = transaction;
}
- if (!isOptimizedTransaction && wasRemoved &&
+ if (!isReorderedTransaction && wasRemoved &&
(containerTransition != null && containerTransition.lastIn == fragment)) {
containerTransition.lastIn = null;
}