diff options
| author | Chet Haase <chet@google.com> | 2011-03-22 11:35:22 -0700 |
|---|---|---|
| committer | Chet Haase <chet@google.com> | 2011-03-23 09:35:00 -0700 |
| commit | bc377841db05bd5197ffadb58ba52c54b2a85f16 (patch) | |
| tree | 40f978cf218091cd2d7cdddffcef64f2086277ec /core/java/android/app/FragmentTransaction.java | |
| parent | 15cb32ed9d189526d5a98add386b28cea6bc46b7 (diff) | |
Add custom fragment anims to be run when popping backstack
The previous fragment implementation allowed for animations
during fragment transitions, but did not account for the
different behavior of fragments when popping the back stack.
In general, you probably don't want to run the same animation
for putting a fragment on the stack as for popping it off, which
is what happens now. For example, you might fade a fragment out when
putting it on the stack. But when popping ot off, fading it out
is probably not the behavior you want.
The new API (setCustomAnimations() overload with two additional
parameters) allows developers to specify animations to be run
in the popping operation. Otherwise, the animations are null and
the operation will not be animated.
Change-Id: I2e132b3890838358e496149f18a25037a59990aa
Diffstat (limited to 'core/java/android/app/FragmentTransaction.java')
| -rw-r--r-- | core/java/android/app/FragmentTransaction.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/app/FragmentTransaction.java b/core/java/android/app/FragmentTransaction.java index 0cc774d3d2f9..68600b34ea80 100644 --- a/core/java/android/app/FragmentTransaction.java +++ b/core/java/android/app/FragmentTransaction.java @@ -116,10 +116,20 @@ public abstract class FragmentTransaction { /** * Set specific animation resources to run for the fragments that are - * entering and exiting in this transaction. + * entering and exiting in this transaction. These animations will not be + * played when popping the back stack. */ public abstract FragmentTransaction setCustomAnimations(int enter, int exit); - + + /** + * Set specific animation resources to run for the fragments that are + * entering and exiting in this transaction. The <code>popEnter</code> + * and <code>popExit</code> animations will be played for enter/exit + * operations specifically when popping the back stack. + */ + public abstract FragmentTransaction setCustomAnimations(int enter, int exit, + int popEnter, int popExit); + /** * Select a standard transition animation for this transaction. May be * one of {@link #TRANSIT_NONE}, {@link #TRANSIT_FRAGMENT_OPEN}, |
