diff options
author | Chet Haase <chet@google.com> | 2010-12-28 13:59:17 -0800 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2010-12-28 14:25:56 -0800 |
commit | 61eb40d276d7fe5c4bead019b7565b99ead07731 (patch) | |
tree | 3347129a3dabb7d0bb0641ba8f3b24166e1cb9af /core | |
parent | 1b39e221e2d2db98f8aea7dd7b7ded3eca6f3d55 (diff) | |
download | frameworks_base-61eb40d276d7fe5c4bead019b7565b99ead07731.zip frameworks_base-61eb40d276d7fe5c4bead019b7565b99ead07731.tar.gz frameworks_base-61eb40d276d7fe5c4bead019b7565b99ead07731.tar.bz2 |
Delay hiding fragments until transition finishes
Change-Id: I616de20e7e161fe1a53cd5e72912cec48f078df5
Diffstat (limited to 'core')
-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; |