summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/FragmentManager.java16
-rw-r--r--core/java/android/app/FragmentTransaction.java8
-rw-r--r--core/java/android/preference/PreferenceActivity.java19
3 files changed, 36 insertions, 7 deletions
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index da7ba6f..37e7253 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -1380,6 +1380,12 @@ final class FragmentManagerImpl implements FragmentManager {
case FragmentTransaction.TRANSIT_FRAGMENT_CLOSE:
rev = FragmentTransaction.TRANSIT_FRAGMENT_OPEN;
break;
+ case FragmentTransaction.TRANSIT_FRAGMENT_NEXT:
+ rev = FragmentTransaction.TRANSIT_FRAGMENT_PREV;
+ break;
+ case FragmentTransaction.TRANSIT_FRAGMENT_PREV:
+ rev = FragmentTransaction.TRANSIT_FRAGMENT_NEXT;
+ break;
}
return rev;
@@ -1398,6 +1404,16 @@ final class FragmentManagerImpl implements FragmentManager {
? com.android.internal.R.styleable.FragmentAnimation_fragmentCloseEnterAnimation
: com.android.internal.R.styleable.FragmentAnimation_fragmentCloseExitAnimation;
break;
+ case FragmentTransaction.TRANSIT_FRAGMENT_NEXT:
+ animAttr = enter
+ ? com.android.internal.R.styleable.FragmentAnimation_fragmentNextEnterAnimation
+ : com.android.internal.R.styleable.FragmentAnimation_fragmentNextExitAnimation;
+ break;
+ case FragmentTransaction.TRANSIT_FRAGMENT_PREV:
+ animAttr = enter
+ ? com.android.internal.R.styleable.FragmentAnimation_fragmentPrevEnterAnimation
+ : com.android.internal.R.styleable.FragmentAnimation_fragmentPrevExitAnimation;
+ break;
}
return animAttr;
}
diff --git a/core/java/android/app/FragmentTransaction.java b/core/java/android/app/FragmentTransaction.java
index 09d8d26..b00476b 100644
--- a/core/java/android/app/FragmentTransaction.java
+++ b/core/java/android/app/FragmentTransaction.java
@@ -106,10 +106,14 @@ public interface FragmentTransaction {
public final int TRANSIT_UNSET = -1;
/** No animation for transition. */
public final int TRANSIT_NONE = 0;
- /** Fragment is being added */
+ /** Fragment is being added onto the stack */
public final int TRANSIT_FRAGMENT_OPEN = 1 | TRANSIT_ENTER_MASK;
- /** Fragment is being removed */
+ /** Fragment is being removed from the stack */
public final int TRANSIT_FRAGMENT_CLOSE = 2 | TRANSIT_EXIT_MASK;
+ /** Fragment is being added in a 'next' operation*/
+ public final int TRANSIT_FRAGMENT_NEXT = 3 | TRANSIT_ENTER_MASK;
+ /** Fragment is being removed in a 'previous' operation */
+ public final int TRANSIT_FRAGMENT_PREV = 4 | TRANSIT_EXIT_MASK;
/**
* Set specific animation resources to run for the fragments that are
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index a6c7d9e..a59b2f8 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -893,11 +893,15 @@ public abstract class PreferenceActivity extends ListActivity implements
}
}
- public void switchToHeaderInner(String fragmentName, Bundle args) {
+ public void switchToHeaderInner(String fragmentName, Bundle args, boolean next) {
getFragmentManager().popBackStack(BACK_STACK_PREFS, POP_BACK_STACK_INCLUSIVE);
Fragment f = Fragment.instantiate(this, fragmentName, args);
- getFragmentManager().openTransaction().replace(
- com.android.internal.R.id.prefs, f).commit();
+ FragmentTransaction transaction = getFragmentManager().openTransaction();
+ transaction.setTransition(next ?
+ FragmentTransaction.TRANSIT_FRAGMENT_NEXT :
+ FragmentTransaction.TRANSIT_FRAGMENT_PREV);
+ transaction.replace(com.android.internal.R.id.prefs, f);
+ transaction.commit();
}
/**
@@ -909,7 +913,7 @@ public abstract class PreferenceActivity extends ListActivity implements
*/
public void switchToHeader(String fragmentName, Bundle args) {
setSelectedHeader(null);
- switchToHeaderInner(fragmentName, args);
+ switchToHeaderInner(fragmentName, args, true);
}
/**
@@ -919,7 +923,8 @@ public abstract class PreferenceActivity extends ListActivity implements
* @param header The new header to display.
*/
public void switchToHeader(Header header) {
- switchToHeaderInner(header.fragment, header.fragmentArguments);
+ switchToHeaderInner(header.fragment, header.fragmentArguments,
+ mHeaders.indexOf(header) > mHeaders.indexOf(mCurHeader));
setSelectedHeader(header);
}
@@ -979,7 +984,10 @@ public abstract class PreferenceActivity extends ListActivity implements
FragmentTransaction transaction = getFragmentManager().openTransaction();
startPreferenceFragment(fragment, transaction);
if (push) {
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
+ } else {
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_NEXT);
}
transaction.commit();
}
@@ -1001,6 +1009,7 @@ public abstract class PreferenceActivity extends ListActivity implements
FragmentTransaction transaction = getFragmentManager().openTransaction();
startPreferenceFragment(f, transaction);
transaction.setBreadCrumbTitle(pref.getTitle());
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
transaction.commit();
return true;