diff options
| author | George Mount <mount@google.com> | 2015-04-08 14:48:02 -0700 |
|---|---|---|
| committer | George Mount <mount@google.com> | 2015-04-08 14:48:02 -0700 |
| commit | bd93e69c8e0b06fc0b0bbba4bdd9e426b37f98e1 (patch) | |
| tree | eb4966d605602c4d3291ed763fa91d387641ef90 /core/java/android/app/SharedElementCallback.java | |
| parent | ec3c97d27f2a424fa847561a3932a40c093a91a1 (diff) | |
| download | frameworks_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.java | 38 |
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(); + } } |
