diff --git a/api/current.txt b/api/current.txt
index c5027ae18c652..c4252460354b9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1435,8 +1435,12 @@ package android {
field public static final int windowNoDisplay = 16843294; // 0x101021e
field public static final int windowNoTitle = 16842838; // 0x1010056
field public static final int windowOverscan = 16843727; // 0x10103cf
+ field public static final int windowReenterTransition = 16843954; // 0x10104b2
+ field public static final int windowReturnTransition = 16843953; // 0x10104b1
field public static final int windowSharedElementEnterTransition = 16843835; // 0x101043b
field public static final int windowSharedElementExitTransition = 16843836; // 0x101043c
+ field public static final int windowSharedElementReenterTransition = 16843956; // 0x10104b4
+ field public static final int windowSharedElementReturnTransition = 16843955; // 0x10104b3
field public static final int windowShowAnimation = 16842934; // 0x10100b6
field public static final int windowShowWallpaper = 16843410; // 0x1010292
field public static final int windowSoftInputMode = 16843307; // 0x101022b
@@ -35319,8 +35323,12 @@ package android.view {
method protected final int getLocalFeatures();
method public android.media.session.MediaController getMediaController();
method public abstract int getNavigationBarColor();
+ method public android.transition.Transition getReenterTransition();
+ method public android.transition.Transition getReturnTransition();
method public android.transition.Transition getSharedElementEnterTransition();
method public android.transition.Transition getSharedElementExitTransition();
+ method public android.transition.Transition getSharedElementReenterTransition();
+ method public android.transition.Transition getSharedElementReturnTransition();
method public abstract int getStatusBarColor();
method public long getTransitionBackgroundFadeDuration();
method public android.transition.TransitionManager getTransitionManager();
@@ -35376,8 +35384,12 @@ package android.view {
method public void setLogo(int);
method public void setMediaController(android.media.session.MediaController);
method public abstract void setNavigationBarColor(int);
+ method public void setReenterTransition(android.transition.Transition);
+ method public void setReturnTransition(android.transition.Transition);
method public void setSharedElementEnterTransition(android.transition.Transition);
method public void setSharedElementExitTransition(android.transition.Transition);
+ method public void setSharedElementReenterTransition(android.transition.Transition);
+ method public void setSharedElementReturnTransition(android.transition.Transition);
method public void setSoftInputMode(int);
method public abstract void setStatusBarColor(int);
method public abstract void setTitle(java.lang.CharSequence);
diff --git a/core/java/android/app/EnterTransitionCoordinator.java b/core/java/android/app/EnterTransitionCoordinator.java
index 1326064341002..b5d362d79ac21 100644
--- a/core/java/android/app/EnterTransitionCoordinator.java
+++ b/core/java/android/app/EnterTransitionCoordinator.java
@@ -256,7 +256,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
@Override
protected Transition getViewsTransition() {
if (mIsReturning) {
- return getWindow().getExitTransition();
+ return getWindow().getReenterTransition();
} else {
return getWindow().getEnterTransition();
}
@@ -264,7 +264,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
protected Transition getSharedElementTransition() {
if (mIsReturning) {
- return getWindow().getSharedElementExitTransition();
+ return getWindow().getSharedElementReenterTransition();
} else {
return getWindow().getSharedElementEnterTransition();
}
diff --git a/core/java/android/app/ExitTransitionCoordinator.java b/core/java/android/app/ExitTransitionCoordinator.java
index 2ce60187af26d..b3fdcc7031f38 100644
--- a/core/java/android/app/ExitTransitionCoordinator.java
+++ b/core/java/android/app/ExitTransitionCoordinator.java
@@ -395,7 +395,7 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
@Override
protected Transition getViewsTransition() {
if (mIsReturning) {
- return getWindow().getEnterTransition();
+ return getWindow().getReturnTransition();
} else {
return getWindow().getExitTransition();
}
@@ -403,7 +403,7 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
protected Transition getSharedElementTransition() {
if (mIsReturning) {
- return getWindow().getSharedElementEnterTransition();
+ return getWindow().getSharedElementReturnTransition();
} else {
return getWindow().getSharedElementExitTransition();
}
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index c169d353c5704..e7b3152f7635f 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -1424,6 +1424,21 @@ public abstract class Window {
*/
public void setEnterTransition(Transition transition) {}
+ /**
+ * Sets the Transition that will be used to move Views out of the scene when the Window is
+ * preparing to close, for example after a call to
+ * {@link android.app.Activity#finishAfterTransition()}. The exiting
+ * Views will be those that are regular Views or ViewGroups that have
+ * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
+ * {@link android.transition.Visibility} as entering is governed by changing visibility from
+ * {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null,
+ * entering Views will remain unaffected. If nothing is set, the default will be to
+ * use the same value as set in {@link #setEnterTransition(android.transition.Transition)}.
+ * @param transition The Transition to use to move Views out of the Scene when the Window
+ * is preparing to close.
+ */
+ public void setReturnTransition(Transition transition) {}
+
/**
* Sets the Transition that will be used to move Views out of the scene when starting a
* new Activity. The exiting Views will be those that are regular Views or ViewGroups that
@@ -1436,6 +1451,20 @@ public abstract class Window {
*/
public void setExitTransition(Transition transition) {}
+ /**
+ * Sets the Transition that will be used to move Views in to the scene when returning from
+ * a previously-started Activity. The entering Views will be those that are regular Views
+ * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions
+ * will extend {@link android.transition.Visibility} as exiting is governed by changing
+ * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null,
+ * the views will remain unaffected. If nothing is set, the default will be to use the same
+ * transition as {@link #setExitTransition(android.transition.Transition)}.
+ * Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
+ * @param transition The Transition to use to move Views into the scene when reentering from a
+ * previously-started Activity.
+ */
+ public void setReenterTransition(Transition transition) {}
+
/**
* Returns the transition used to move Views into the initial scene. The entering
* Views will be those that are regular Views or ViewGroups that have
@@ -1448,6 +1477,19 @@ public abstract class Window {
*/
public Transition getEnterTransition() { return null; }
+ /**
+ * Returns he Transition that will be used to move Views out of the scene when the Window is
+ * preparing to close, for example after a call to
+ * {@link android.app.Activity#finishAfterTransition()}. The exiting
+ * Views will be those that are regular Views or ViewGroups that have
+ * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
+ * {@link android.transition.Visibility} as entering is governed by changing visibility from
+ * {@link View#VISIBLE} to {@link View#INVISIBLE}.
+ * @return The Transition to use to move Views out of the Scene when the Window
+ * is preparing to close.
+ */
+ public Transition getReturnTransition() { return null; }
+
/**
* Returns the Transition that will be used to move Views out of the scene when starting a
* new Activity. The exiting Views will be those that are regular Views or ViewGroups that
@@ -1460,6 +1502,18 @@ public abstract class Window {
*/
public Transition getExitTransition() { return null; }
+ /**
+ * Returns the Transition that will be used to move Views in to the scene when returning from
+ * a previously-started Activity. The entering Views will be those that are regular Views
+ * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions
+ * will extend {@link android.transition.Visibility} as exiting is governed by changing
+ * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}.
+ * Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
+ * @return The Transition to use to move Views into the scene when reentering from a
+ * previously-started Activity.
+ */
+ public Transition getReenterTransition() { return null; }
+
/**
* Sets the Transition that will be used for shared elements transferred into the content
* Scene. Typical Transitions will affect size and location, such as
@@ -1471,6 +1525,19 @@ public abstract class Window {
*/
public void setSharedElementEnterTransition(Transition transition) {}
+ /**
+ * Sets the Transition that will be used for shared elements transferred back to a
+ * calling Activity. Typical Transitions will affect size and location, such as
+ * {@link android.transition.ChangeBounds}. A null
+ * value will cause transferred shared elements to blink to the final position.
+ * If no value is set, the default will be to use the same value as
+ * {@link #setSharedElementEnterTransition(android.transition.Transition)}.
+ * Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
+ * @param transition The Transition to use for shared elements transferred out of the content
+ * Scene.
+ */
+ public void setSharedElementReturnTransition(Transition transition) {}
+
/**
* Returns the Transition that will be used for shared elements transferred into the content
* Scene. Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
@@ -1478,6 +1545,13 @@ public abstract class Window {
*/
public Transition getSharedElementEnterTransition() { return null; }
+ /**
+ * Returns the Transition that will be used for shared elements transferred back to a
+ * calling Activity. Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
+ * @return Transition to use for sharend elements transferred into the content Scene.
+ */
+ public Transition getSharedElementReturnTransition() { return null; }
+
/**
* Sets the Transition that will be used for shared elements after starting a new Activity
* before the shared elements are transferred to the called Activity. If the shared elements
@@ -1489,6 +1563,17 @@ public abstract class Window {
*/
public void setSharedElementExitTransition(Transition transition) {}
+ /**
+ * Sets the Transition that will be used for shared elements reentering from a started
+ * Activity after it has returned the shared element to it start location. If no value
+ * is set, this will default to
+ * {@link #setSharedElementExitTransition(android.transition.Transition)}.
+ * Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
+ * @param transition The Transition to use for shared elements in the launching Window
+ * after the shared element has returned to the Window.
+ */
+ public void setSharedElementReenterTransition(Transition transition) {}
+
/**
* Returns the Transition to use for shared elements in the launching Window prior
* to transferring to the launched Activity's Window.
@@ -1499,6 +1584,16 @@ public abstract class Window {
*/
public Transition getSharedElementExitTransition() { return null; }
+ /**
+ * Returns the Transition that will be used for shared elements reentering from a started
+ * Activity after it has returned the shared element to it start location.
+ * Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
+ *
+ * @return the Transition that will be used for shared elements reentering from a started
+ * Activity after it has returned the shared element to it start location.
+ */
+ public Transition getSharedElementReenterTransition() { return null; }
+
/**
* Controls how the transition set in
* {@link #setEnterTransition(android.transition.Transition)} overlaps with the exit
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 5cb3068b31107..d07d0abf73fd0 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -463,18 +463,36 @@
{@link android.view.Window#setEnterTransition(android.transition.Transition)}. -->
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1751,30 +1775,54 @@
or a fraction of the screen size in that dimension. -->
-
-
+
+
+
-
+
+
+
-
+
+
+
+
+
+