diff options
author | George Mount <mount@google.com> | 2014-08-29 08:15:48 -0700 |
---|---|---|
committer | George Mount <mount@google.com> | 2014-09-04 15:05:22 -0700 |
commit | 6558056e8fccc32f9e1dc59e46d09f8d916b7538 (patch) | |
tree | 055e9aa96c595341e97497855d7241980583ad50 | |
parent | c50e7e847702897b7087bc59cac77c1b78b57f32 (diff) | |
download | frameworks_base-6558056e8fccc32f9e1dc59e46d09f8d916b7538.zip frameworks_base-6558056e8fccc32f9e1dc59e46d09f8d916b7538.tar.gz frameworks_base-6558056e8fccc32f9e1dc59e46d09f8d916b7538.tar.bz2 |
API Review: Change SharedElementListener to SharedElementCallback.
Bug 15863001
Bug 17289526
Changed SharedElementListener to SharedElementCallback
Renamed methods to use "on" prefix.
Adjusted javadoc to reflect usage in Fragments.
Change-Id: I7cc517c269a8e417cb5c3a0948bdd3b654d42472
-rw-r--r-- | api/current.txt | 24 | ||||
-rw-r--r-- | core/java/android/app/Activity.java | 28 | ||||
-rw-r--r-- | core/java/android/app/ActivityTransitionCoordinator.java | 14 | ||||
-rw-r--r-- | core/java/android/app/BackStackRecord.java | 24 | ||||
-rw-r--r-- | core/java/android/app/EnterTransitionCoordinator.java | 6 | ||||
-rw-r--r-- | core/java/android/app/ExitTransitionCoordinator.java | 4 | ||||
-rw-r--r-- | core/java/android/app/Fragment.java | 28 | ||||
-rw-r--r-- | core/java/android/app/SharedElementCallback.java (renamed from core/java/android/app/SharedElementListener.java) | 92 |
8 files changed, 110 insertions, 110 deletions
diff --git a/api/current.txt b/api/current.txt index 7e2b0ed..7f89240 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3544,8 +3544,8 @@ package android.app { method public void setContentView(android.view.View); method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams); method public final void setDefaultKeyMode(int); - method public void setEnterSharedElementListener(android.app.SharedElementListener); - method public void setExitSharedElementListener(android.app.SharedElementListener); + method public void setEnterSharedElementCallback(android.app.SharedElementCallback); + method public void setExitSharedElementCallback(android.app.SharedElementCallback); method public final void setFeatureDrawable(int, android.graphics.drawable.Drawable); method public final void setFeatureDrawableAlpha(int, int); method public final void setFeatureDrawableResource(int, int); @@ -4319,9 +4319,9 @@ package android.app { method public void setAllowEnterTransitionOverlap(boolean); method public void setAllowReturnTransitionOverlap(boolean); method public void setArguments(android.os.Bundle); - method public void setEnterSharedElementTransitionListener(android.app.SharedElementListener); + method public void setEnterSharedElementTransitionCallback(android.app.SharedElementCallback); method public void setEnterTransition(android.transition.Transition); - method public void setExitSharedElementTransitionListener(android.app.SharedElementListener); + method public void setExitSharedElementTransitionCallback(android.app.SharedElementCallback); method public void setExitTransition(android.transition.Transition); method public void setHasOptionsMenu(boolean); method public void setInitialSavedState(android.app.Fragment.SavedState); @@ -5192,14 +5192,14 @@ package android.app { field public static final int START_STICKY_COMPATIBILITY = 0; // 0x0 } - public abstract class SharedElementListener { - ctor public SharedElementListener(); - method public android.os.Parcelable captureSharedElementSnapshot(android.view.View, android.graphics.Matrix, android.graphics.RectF); - method public android.view.View createSnapshotView(android.content.Context, android.os.Parcelable); - method public void handleRejectedSharedElements(java.util.List<android.view.View>); - method public void remapSharedElements(java.util.List<java.lang.String>, java.util.Map<java.lang.String, android.view.View>); - method public void setSharedElementEnd(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); - method public void setSharedElementStart(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); + public abstract class SharedElementCallback { + ctor public SharedElementCallback(); + method public android.os.Parcelable onCaptureSharedElementSnapshot(android.view.View, android.graphics.Matrix, android.graphics.RectF); + method public android.view.View onCreateSnapshotView(android.content.Context, android.os.Parcelable); + method public void onMapSharedElements(java.util.List<java.lang.String>, java.util.Map<java.lang.String, android.view.View>); + method public void onRejectSharedElements(java.util.List<android.view.View>); + method public void onSharedElementEnd(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); + method public void onSharedElementStart(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); } public deprecated class TabActivity extends android.app.ActivityGroup { diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 29ef484..8a2865c 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -788,8 +788,8 @@ public class Activity extends ContextThemeWrapper final Handler mHandler = new Handler(); ActivityTransitionState mActivityTransitionState = new ActivityTransitionState(); - SharedElementListener mEnterTransitionListener = SharedElementListener.NULL_LISTENER; - SharedElementListener mExitTransitionListener = SharedElementListener.NULL_LISTENER; + SharedElementCallback mEnterTransitionListener = SharedElementCallback.NULL_CALLBACK; + SharedElementCallback mExitTransitionListener = SharedElementCallback.NULL_CALLBACK; /** Return the intent that started this activity. */ public Intent getIntent() { @@ -5779,33 +5779,33 @@ public class Activity extends ContextThemeWrapper /** * When {@link android.app.ActivityOptions#makeSceneTransitionAnimation(Activity, - * android.view.View, String)} was used to start an Activity, <var>listener</var> + * android.view.View, String)} was used to start an Activity, <var>callback</var> * will be called to handle shared elements on the <i>launched</i> Activity. This requires * {@link Window#FEATURE_CONTENT_TRANSITIONS}. * - * @param listener Used to manipulate shared element transitions on the launched Activity. + * @param callback Used to manipulate shared element transitions on the launched Activity. */ - public void setEnterSharedElementListener(SharedElementListener listener) { - if (listener == null) { - listener = SharedElementListener.NULL_LISTENER; + public void setEnterSharedElementCallback(SharedElementCallback callback) { + if (callback == null) { + callback = SharedElementCallback.NULL_CALLBACK; } - mEnterTransitionListener = listener; + mEnterTransitionListener = callback; } /** * When {@link android.app.ActivityOptions#makeSceneTransitionAnimation(Activity, - * android.view.View, String)} was used to start an Activity, <var>listener</var> + * android.view.View, String)} was used to start an Activity, <var>callback</var> * will be called to handle shared elements on the <i>launching</i> Activity. Most * calls will only come when returning from the started Activity. * This requires {@link Window#FEATURE_CONTENT_TRANSITIONS}. * - * @param listener Used to manipulate shared element transitions on the launching Activity. + * @param callback Used to manipulate shared element transitions on the launching Activity. */ - public void setExitSharedElementListener(SharedElementListener listener) { - if (listener == null) { - listener = SharedElementListener.NULL_LISTENER; + public void setExitSharedElementCallback(SharedElementCallback callback) { + if (callback == null) { + callback = SharedElementCallback.NULL_CALLBACK; } - mExitTransitionListener = listener; + mExitTransitionListener = callback; } /** diff --git a/core/java/android/app/ActivityTransitionCoordinator.java b/core/java/android/app/ActivityTransitionCoordinator.java index a09a2e7..0cac6a5 100644 --- a/core/java/android/app/ActivityTransitionCoordinator.java +++ b/core/java/android/app/ActivityTransitionCoordinator.java @@ -197,7 +197,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { final protected ArrayList<View> mSharedElements = new ArrayList<View>(); final protected ArrayList<String> mSharedElementNames = new ArrayList<String>(); final protected ArrayList<View> mTransitioningViews = new ArrayList<View>(); - protected SharedElementListener mListener; + protected SharedElementCallback mListener; protected ResultReceiver mResultReceiver; final private FixedEpicenterCallback mEpicenterCallback = new FixedEpicenterCallback(); final protected boolean mIsReturning; @@ -208,7 +208,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { public ActivityTransitionCoordinator(Window window, ArrayList<String> allSharedElementNames, - SharedElementListener listener, boolean isReturning) { + SharedElementCallback listener, boolean isReturning) { super(new Handler()); mWindow = window; mListener = listener; @@ -218,7 +218,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { protected void viewsReady(ArrayMap<String, View> sharedElements) { sharedElements.retainAll(mAllSharedElementNames); - mListener.remapSharedElements(mAllSharedElementNames, sharedElements); + mListener.onMapSharedElements(mAllSharedElementNames, sharedElements); mSharedElementNames.addAll(sharedElements.keySet()); mSharedElements.addAll(sharedElements.values()); if (getViewsTransition() != null) { @@ -458,12 +458,12 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { tempMatrix, tempRect, null); } } - mListener.setSharedElementStart(mSharedElementNames, mSharedElements, snapshots); + mListener.onSharedElementStart(mSharedElementNames, mSharedElements, snapshots); return originalImageState; } protected void notifySharedElementEnd(ArrayList<View> snapshots) { - mListener.setSharedElementEnd(mSharedElementNames, mSharedElements, snapshots); + mListener.onSharedElementEnd(mSharedElementNames, mSharedElements, snapshots); } protected void scheduleSetSharedElementEnd(final ArrayList<View> snapshots) { @@ -526,7 +526,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { Parcelable parcelable = sharedElementBundle.getParcelable(KEY_SNAPSHOT); View snapshot = null; if (parcelable != null) { - snapshot = mListener.createSnapshotView(context, parcelable); + snapshot = mListener.onCreateSnapshotView(context, parcelable); } if (snapshot != null) { setSharedElementState(snapshot, name, state, null, null, decorLoc); @@ -618,7 +618,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { sharedElementBundle.putFloat(KEY_TRANSLATION_Z, view.getTranslationZ()); sharedElementBundle.putFloat(KEY_ELEVATION, view.getElevation()); - Parcelable bitmap = mListener.captureSharedElementSnapshot(view, tempMatrix, tempBounds); + Parcelable bitmap = mListener.onCaptureSharedElementSnapshot(view, tempMatrix, tempBounds); if (bitmap != null) { sharedElementBundle.putParcelable(KEY_SNAPSHOT, bitmap); } diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java index 59f010c..8227915 100644 --- a/core/java/android/app/BackStackRecord.java +++ b/core/java/android/app/BackStackRecord.java @@ -1128,11 +1128,11 @@ final class BackStackRecord extends FragmentTransaction implements } if (isBack) { - outFragment.mEnterTransitionListener.remapSharedElements( + outFragment.mEnterTransitionCallback.onMapSharedElements( mSharedElementTargetNames, namedViews); setBackNameOverrides(state, namedViews, false); } else { - outFragment.mExitTransitionListener.remapSharedElements( + outFragment.mExitTransitionCallback.onMapSharedElements( mSharedElementTargetNames, namedViews); setNameOverrides(state, namedViews, false); } @@ -1248,14 +1248,14 @@ final class BackStackRecord extends FragmentTransaction implements } // Notify the start of the transition. - SharedElementListener listener = isBack ? - outFragment.mEnterTransitionListener : - inFragment.mEnterTransitionListener; + SharedElementCallback callback = isBack ? + outFragment.mEnterTransitionCallback : + inFragment.mEnterTransitionCallback; tempNames.clear(); tempNames.addAll(namedViews.keySet()); tempViewList.clear(); tempViewList.addAll(namedViews.values()); - listener.setSharedElementStart(tempNames, tempViewList, null); + callback.onSharedElementStart(tempNames, tempViewList, null); // Set the epicenter of the exit transition if (mSharedElementTargetNames != null && exitTransition != null) { @@ -1337,11 +1337,11 @@ final class BackStackRecord extends FragmentTransaction implements tempViews2, isBack); // remap shared elements and set the name mapping used in the shared element transition. if (isBack) { - inFragment.mExitTransitionListener.remapSharedElements( + inFragment.mExitTransitionCallback.onMapSharedElements( mSharedElementTargetNames, namedViews); setBackNameOverrides(state, namedViews, true); } else { - inFragment.mEnterTransitionListener.remapSharedElements( + inFragment.mEnterTransitionCallback.onMapSharedElements( mSharedElementTargetNames, namedViews); setNameOverrides(state, namedViews, true); } @@ -1355,14 +1355,14 @@ final class BackStackRecord extends FragmentTransaction implements } int containerId = inFragments.keyAt(i); - SharedElementListener sharedElementListener = isBack ? - outFragments.get(containerId).mEnterTransitionListener : - inFragment.mEnterTransitionListener; + SharedElementCallback sharedElementCallback = isBack ? + outFragments.get(containerId).mEnterTransitionCallback : + inFragment.mEnterTransitionCallback; tempNames.clear(); tempNames.addAll(namedViews.keySet()); tempViews.clear(); tempViews.addAll(namedViews.values()); - sharedElementListener.setSharedElementEnd(tempNames, tempViews, null); + sharedElementCallback.onSharedElementEnd(tempNames, tempViews, null); } // Don't include any newly-hidden fragments in the transition. diff --git a/core/java/android/app/EnterTransitionCoordinator.java b/core/java/android/app/EnterTransitionCoordinator.java index 4126647..2bc4166 100644 --- a/core/java/android/app/EnterTransitionCoordinator.java +++ b/core/java/android/app/EnterTransitionCoordinator.java @@ -21,8 +21,6 @@ import android.animation.ObjectAnimator; import android.graphics.Matrix; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.os.Handler; -import android.os.Message; import android.os.ResultReceiver; import android.text.TextUtils; import android.transition.Transition; @@ -209,7 +207,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { } } - private static SharedElementListener getListener(Activity activity, boolean isReturning) { + private static SharedElementCallback getListener(Activity activity, boolean isReturning) { return isReturning ? activity.mExitTransitionListener : activity.mEnterTransitionListener; } @@ -294,7 +292,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { ArrayList<String> rejectedNames = new ArrayList<String>(mAllSharedElementNames); rejectedNames.removeAll(mSharedElementNames); ArrayList<View> rejectedSnapshots = createSnapshots(sharedElementState, rejectedNames); - mListener.handleRejectedSharedElements(rejectedSnapshots); + mListener.onRejectSharedElements(rejectedSnapshots); startRejectedAnimations(rejectedSnapshots); // Now start shared element transition diff --git a/core/java/android/app/ExitTransitionCoordinator.java b/core/java/android/app/ExitTransitionCoordinator.java index 231c93f..9d5557f 100644 --- a/core/java/android/app/ExitTransitionCoordinator.java +++ b/core/java/android/app/ExitTransitionCoordinator.java @@ -79,7 +79,7 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator { mActivity = activity; } - private static SharedElementListener getListener(Activity activity, boolean isReturning) { + private static SharedElementCallback getListener(Activity activity, boolean isReturning) { return isReturning ? activity.mEnterTransitionListener : activity.mExitTransitionListener; } @@ -176,7 +176,7 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator { }); setGhostVisibility(View.INVISIBLE); scheduleGhostVisibilityChange(View.INVISIBLE); - mListener.setSharedElementEnd(mSharedElementNames, mSharedElements, sharedElementSnapshots); + mListener.onSharedElementEnd(mSharedElementNames, mSharedElements, sharedElementSnapshots); TransitionManager.beginDelayedTransition(getDecor(), transition); scheduleGhostVisibilityChange(View.VISIBLE); setGhostVisibility(View.VISIBLE); diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java index dbee81e..672ef7b 100644 --- a/core/java/android/app/Fragment.java +++ b/core/java/android/app/Fragment.java @@ -495,8 +495,8 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene private Boolean mAllowReturnTransitionOverlap; private Boolean mAllowEnterTransitionOverlap; - SharedElementListener mEnterTransitionListener = SharedElementListener.NULL_LISTENER; - SharedElementListener mExitTransitionListener = SharedElementListener.NULL_LISTENER; + SharedElementCallback mEnterTransitionCallback = SharedElementCallback.NULL_CALLBACK; + SharedElementCallback mExitTransitionCallback = SharedElementCallback.NULL_CALLBACK; /** * State information that has been retrieved from a fragment instance @@ -1621,31 +1621,31 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene } /** - * When custom transitions are used with Fragments, the enter transition listener + * When custom transitions are used with Fragments, the enter transition callback * is called when this Fragment is attached or detached when not popping the back stack. * - * @param listener Used to manipulate the shared element transitions on this Fragment + * @param callback Used to manipulate the shared element transitions on this Fragment * when added not as a pop from the back stack. */ - public void setEnterSharedElementTransitionListener(SharedElementListener listener) { - if (listener == null) { - listener = SharedElementListener.NULL_LISTENER; + public void setEnterSharedElementTransitionCallback(SharedElementCallback callback) { + if (callback == null) { + callback = SharedElementCallback.NULL_CALLBACK; } - mEnterTransitionListener = listener; + mEnterTransitionCallback = callback; } /** - * When custom transitions are used with Fragments, the exit transition listener + * When custom transitions are used with Fragments, the exit transition callback * is called when this Fragment is attached or detached when popping the back stack. * - * @param listener Used to manipulate the shared element transitions on this Fragment + * @param callback Used to manipulate the shared element transitions on this Fragment * when added as a pop from the back stack. */ - public void setExitSharedElementTransitionListener(SharedElementListener listener) { - if (listener == null) { - listener = SharedElementListener.NULL_LISTENER; + public void setExitSharedElementTransitionCallback(SharedElementCallback callback) { + if (callback == null) { + callback = SharedElementCallback.NULL_CALLBACK; } - mExitTransitionListener = listener; + mExitTransitionCallback = callback; } /** diff --git a/core/java/android/app/SharedElementListener.java b/core/java/android/app/SharedElementCallback.java index f36d05f..82d8e5b 100644 --- a/core/java/android/app/SharedElementListener.java +++ b/core/java/android/app/SharedElementCallback.java @@ -22,7 +22,6 @@ import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.ColorDrawable; import android.os.Parcelable; import android.view.View; @@ -31,28 +30,23 @@ import java.util.Map; /** * Listener provided in - * {@link Activity#setEnterSharedElementListener(SharedElementListener)} and - * {@link Activity#setExitSharedElementListener(SharedElementListener)} - * to monitor the Activity transitions. The events can be used to customize Activity - * Transition behavior. + * {@link Activity#setEnterSharedElementCallback(SharedElementCallback)} and + * {@link Activity#setExitSharedElementCallback(SharedElementCallback)} as well as + * {@link Fragment#setEnterSharedElementTransitionCallback(SharedElementCallback)} and + * {@link Fragment#setExitSharedElementTransitionCallback(SharedElementCallback)} + * to monitor the Shared element transitions. The events can be used to customize Activity + * and Fragment Transition behavior. */ -public abstract class SharedElementListener { +public abstract class SharedElementCallback { private Matrix mTempMatrix; - static final SharedElementListener NULL_LISTENER = new SharedElementListener() { + static final SharedElementCallback NULL_CALLBACK = new SharedElementCallback() { }; /** - * Called to allow the listener to customize the start state of the shared element when - * transferring in shared element state. - * <p> - * The shared element will start at the size and position of the shared element - * in the launching Activity or Fragment. It will also transfer ImageView scaleType - * and imageMatrix if the shared elements in the calling and called Activities are - * ImageViews. Some applications may want to make additional changes, such as - * changing the clip bounds, scaling, or rotation if the shared element end state - * does not map well to the start state. - * </p> + * Called immediately after the start state is set for the shared element. + * The shared element will start at the size and position of the shared element + * in the launching Activity or Fragment. * * @param sharedElementNames The names of the shared elements that were accepted into * the View hierarchy. @@ -60,20 +54,21 @@ public abstract class SharedElementListener { * @param sharedElementSnapshots The Views containing snap shots of the shared element * from the launching Window. These elements will not * be part of the scene, but will be positioned relative - * to the Window decor View. + * to the Window decor View. This list is null for Fragment + * Transitions. */ - public void setSharedElementStart(List<String> sharedElementNames, + public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {} /** - * Called to allow the listener to customize the end state of the shared element when - * transferring in shared element state. + * Called after the end state is set for the shared element, but before the end state + * is captured by the shared element transition. * <p> * Any customization done in - * {@link #setSharedElementStart(java.util.List, java.util.List, java.util.List)} + * {@link #onSharedElementStart(java.util.List, java.util.List, java.util.List)} * may need to be modified to the final state of the shared element if it is not * automatically corrected by layout. For example, rotation or scale will not - * be affected by layout and if changed in {@link #setSharedElementStart(java.util.List, + * be affected by layout and if changed in {@link #onSharedElementStart(java.util.List, * java.util.List, java.util.List)}, it will also have to be set here again to correct * the end state. * </p> @@ -84,24 +79,27 @@ public abstract class SharedElementListener { * @param sharedElementSnapshots The Views containing snap shots of the shared element * from the launching Window. These elements will not * be part of the scene, but will be positioned relative - * to the Window decor View. + * to the Window decor View. This list will be null for + * Fragment Transitions. */ - public void setSharedElementEnd(List<String> sharedElementNames, + public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {} /** - * Called after {@link #remapSharedElements(java.util.List, java.util.Map)} when + * Called after {@link #onMapSharedElements(java.util.List, java.util.Map)} when * transferring shared elements in. Any shared elements that have no mapping will be in * <var>rejectedSharedElements</var>. The elements remaining in * <var>rejectedSharedElements</var> will be transitioned out of the Scene. If a * View is removed from <var>rejectedSharedElements</var>, it must be handled by the - * <code>SharedElementListener</code>. + * <code>SharedElementCallback</code>. * <p> * Views in rejectedSharedElements will have their position and size set to the * position of the calling shared element, relative to the Window decor View and contain * snapshots of the View from the calling Activity or Fragment. This * view may be safely added to the decor View's overlay to remain in position. * </p> + * <p>This method is not called for Fragment Transitions. All rejected shared elements + * will be handled by the exit transition.</p> * * @param rejectedSharedElements Views containing visual information of shared elements * that are not part of the entering scene. These Views @@ -109,25 +107,27 @@ public abstract class SharedElementListener { * View removed from this list will not be transitioned * automatically. */ - public void handleRejectedSharedElements(List<View> rejectedSharedElements) {} + public void onRejectSharedElements(List<View> rejectedSharedElements) {} /** - * Lets the ActivityTransitionListener adjust the mapping of shared element names to + * Lets the SharedElementCallback adjust the mapping of shared element names to * Views. * * @param names The names of all shared elements transferred from the calling Activity - * to the started Activity. + * or Fragment in the order they were provided. * @param sharedElements The mapping of shared element names to Views. The best guess * will be filled into sharedElements based on the transitionNames. */ - public void remapSharedElements(List<String> names, Map<String, View> sharedElements) {} + public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {} /** * Creates a snapshot of a shared element to be used by the remote Activity and reconstituted - * with {@link #createSnapshotView(android.content.Context, android.os.Parcelable)}. A + * with {@link #onCreateSnapshotView(android.content.Context, android.os.Parcelable)}. A * null return value will mean that the remote Activity will have a null snapshot View in - * {@link #setSharedElementStart(java.util.List, java.util.List, java.util.List)} and - * {@link #setSharedElementEnd(java.util.List, java.util.List, java.util.List)}. + * {@link #onSharedElementStart(java.util.List, java.util.List, java.util.List)} and + * {@link #onSharedElementEnd(java.util.List, java.util.List, java.util.List)}. + * + * <p>This is not called for Fragment Transitions.</p> * * @param sharedElement The shared element View to create a snapshot for. * @param viewToGlobalMatrix A matrix containing a transform from the view to the screen @@ -135,11 +135,11 @@ public abstract class SharedElementListener { * @param screenBounds The bounds of shared element in screen coordinate space. This is * the bounds of the view with the viewToGlobalMatrix applied. * @return A snapshot to send to the remote Activity to be reconstituted with - * {@link #createSnapshotView(android.content.Context, android.os.Parcelable)} and passed - * into {@link #setSharedElementStart(java.util.List, java.util.List, java.util.List)} and - * {@link #setSharedElementEnd(java.util.List, java.util.List, java.util.List)}. + * {@link #onCreateSnapshotView(android.content.Context, android.os.Parcelable)} and passed + * into {@link #onSharedElementStart(java.util.List, java.util.List, java.util.List)} and + * {@link #onSharedElementEnd(java.util.List, java.util.List, java.util.List)}. */ - public Parcelable captureSharedElementSnapshot(View sharedElement, Matrix viewToGlobalMatrix, + public Parcelable onCaptureSharedElementSnapshot(View sharedElement, Matrix viewToGlobalMatrix, RectF screenBounds) { int bitmapWidth = Math.round(screenBounds.width()); int bitmapHeight = Math.round(screenBounds.height()); @@ -160,20 +160,22 @@ public abstract class SharedElementListener { /** * Reconstitutes a snapshot View from a Parcelable returned in - * {@link #captureSharedElementSnapshot(android.view.View, android.graphics.Matrix, - * android.graphics.RectF)} to be used in {@link #setSharedElementStart(java.util.List, - * java.util.List, java.util.List)} and {@link #setSharedElementEnd(java.util.List, + * {@link #onCaptureSharedElementSnapshot(android.view.View, android.graphics.Matrix, + * android.graphics.RectF)} to be used in {@link #onSharedElementStart(java.util.List, + * java.util.List, java.util.List)} and {@link #onSharedElementEnd(java.util.List, * java.util.List, java.util.List)}. The returned View will be sized and positioned after * this call so that it is ready to be added to the decor View's overlay. * + * <p>This is not called for Fragment Transitions.</p> + * * @param context The Context used to create the snapshot View. - * @param snapshot The Parcelable returned by {@link #captureSharedElementSnapshot( + * @param snapshot The Parcelable returned by {@link #onCaptureSharedElementSnapshot( * android.view.View, android.graphics.Matrix, android.graphics.RectF)}. - * @return A View to be sent in {@link #setSharedElementStart(java.util.List, java.util.List, - * java.util.List)} and {@link #setSharedElementEnd(java.util.List, java.util.List, + * @return A View to be sent in {@link #onSharedElementStart(java.util.List, java.util.List, + * java.util.List)} and {@link #onSharedElementEnd(java.util.List, java.util.List, * java.util.List)}. A null value will produce a null snapshot value for those two methods. */ - public View createSnapshotView(Context context, Parcelable snapshot) { + public View onCreateSnapshotView(Context context, Parcelable snapshot) { View view = null; if (snapshot instanceof Bitmap) { Bitmap bitmap = (Bitmap) snapshot; |