summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/SharedElementCallback.java
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2015-04-08 14:48:02 -0700
committerGeorge Mount <mount@google.com>2015-04-08 14:48:02 -0700
commitbd93e69c8e0b06fc0b0bbba4bdd9e426b37f98e1 (patch)
treeeb4966d605602c4d3291ed763fa91d387641ef90 /core/java/android/app/SharedElementCallback.java
parentec3c97d27f2a424fa847561a3932a40c093a91a1 (diff)
downloadframeworks_base-bd93e69c8e0b06fc0b0bbba4bdd9e426b37f98e1.zip
frameworks_base-bd93e69c8e0b06fc0b0bbba4bdd9e426b37f98e1.tar.gz
frameworks_base-bd93e69c8e0b06fc0b0bbba4bdd9e426b37f98e1.tar.bz2
Allow delay of showing/hiding shared element when transferring.
Bug 18932344 Change-Id: Ic967551a4dd27967d2312a6c6c8a83b34c220031
Diffstat (limited to 'core/java/android/app/SharedElementCallback.java')
-rw-r--r--core/java/android/app/SharedElementCallback.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/core/java/android/app/SharedElementCallback.java b/core/java/android/app/SharedElementCallback.java
index 6ac2401..9c70f1d 100644
--- a/core/java/android/app/SharedElementCallback.java
+++ b/core/java/android/app/SharedElementCallback.java
@@ -221,4 +221,42 @@ public abstract class SharedElementCallback {
}
return view;
}
+
+ /**
+ * Called during an Activity Transition when the shared elements have arrived at the
+ * final location and are ready to be transferred. This method is called for both the
+ * source and destination Activities.
+ * <p>
+ * When the shared elements are ready to be transferred,
+ * {@link OnSharedElementsReadyListener#onSharedElementsReady()}
+ * must be called to trigger the transfer.
+ * <p>
+ * The default behavior is to trigger the transfer immediately.
+ *
+ * @param sharedElementNames The names of the shared elements that are being transferred..
+ * @param sharedElements The shared elements that are part of the View hierarchy.
+ * @param listener The listener to call when the shared elements are ready to be hidden
+ * in the source Activity or shown in the destination Activity.
+ */
+ public void onSharedElementsArrived(List<String> sharedElementNames,
+ List<View> sharedElements, OnSharedElementsReadyListener listener) {
+ listener.onSharedElementsReady();
+ }
+
+ /**
+ * Listener to be called after {@link
+ * SharedElementCallback#onSharedElementsArrived(OnSharedElementsReadyListener)}
+ * when the shared elements are ready to be hidden in the source Activity and shown in the
+ * destination Activity.
+ */
+ public interface OnSharedElementsReadyListener {
+
+ /**
+ * Call this method during or after the OnSharedElementsReadyListener has been received
+ * in {@link SharedElementCallback#onSharedElementsArrived(OnSharedElementsReadyListener)}
+ * to indicate that the shared elements are ready to be hidden in the source and shown
+ * in the destination Activity.
+ */
+ void onSharedElementsReady();
+ }
}