int commitInternal(boolean flag) { if (mCommitted) throw new IllegalStateException("commit already called"); if (FragmentManagerImpl.DEBUG) { Log.v("FragmentManager", (new StringBuilder()).append("Commit: ").append(this).toString()); dump(" ", null, new PrintWriter(new LogWriter("FragmentManager")), null); } mCommitted = true; if (mAddToBackStack) mIndex = mManager.allocBackStackIndex(this); else mIndex = -1; mManager.enqueueAction(this, flag); return mIndex; }
public void popFromBackStack(boolean flag) { label0: { if (FragmentManagerImpl.DEBUG) { Log.v( "FragmentManager", (new StringBuilder()).append("popFromBackStack: ").append(this).toString()); dump(" ", null, new PrintWriter(new LogWriter("FragmentManager")), null); } bumpBackStackNesting(-1); Op op = mTail; label1: do { if (op == null) break label0; switch (op.cmd) { default: break label1; case 7: // '\007' Fragment fragment7 = op.fragment; fragment7.mNextAnim = op.popEnterAnim; mManager.detachFragment( fragment7, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle); break; case 6: // '\006' Fragment fragment6 = op.fragment; fragment6.mNextAnim = op.popEnterAnim; mManager.attachFragment( fragment6, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle); break; case 5: // '\005' Fragment fragment5 = op.fragment; fragment5.mNextAnim = op.popExitAnim; mManager.hideFragment( fragment5, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle); break; case 4: // '\004' Fragment fragment4 = op.fragment; fragment4.mNextAnim = op.popEnterAnim; mManager.showFragment( fragment4, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle); break; case 3: // '\003' Fragment fragment3 = op.fragment; fragment3.mNextAnim = op.popEnterAnim; mManager.addFragment(fragment3, false); break; case 2: // '\002' Fragment fragment1 = op.fragment; if (fragment1 != null) { fragment1.mNextAnim = op.popExitAnim; mManager.removeFragment( fragment1, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle); } if (op.removed == null) break; for (int i = 0; i < op.removed.size(); i++) { Fragment fragment2 = (Fragment) op.removed.get(i); fragment2.mNextAnim = op.popEnterAnim; mManager.addFragment(fragment2, false); } break; case 1: // '\001' Fragment fragment = op.fragment; fragment.mNextAnim = op.popExitAnim; mManager.removeFragment( fragment, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle); break; } op = op.prev; } while (true); throw new IllegalArgumentException( (new StringBuilder()).append("Unknown cmd: ").append(op.cmd).toString()); } if (flag) mManager.moveToState( mManager.mCurState, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle, true); if (mIndex >= 0) { mManager.freeBackStackIndex(mIndex); mIndex = -1; } }
public void dump(String s, FileDescriptor filedescriptor, PrintWriter printwriter, String as[]) { dump(s, printwriter, true); }