diff options
Diffstat (limited to 'core/java/android/app/FragmentManager.java')
-rw-r--r-- | core/java/android/app/FragmentManager.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 08167c1..9d6f71e 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -972,9 +972,17 @@ final class FragmentManagerImpl extends FragmentManager { transitionStyle); if (anim != null) { anim.setTarget(fragment.mView); + // Delay the actual hide operation until the animation finishes, otherwise + // the fragment will just immediately disappear + final Fragment finalFragment = fragment; + anim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + finalFragment.mView.setVisibility(View.GONE); + } + }); anim.start(); } - fragment.mView.setVisibility(View.GONE); } if (fragment.mAdded && fragment.mHasMenu) { mNeedMenuInvalidate = true; |