Loading api/current.txt +15 −2 Original line number Diff line number Diff line Loading @@ -543,6 +543,7 @@ package android { field public static final int fromAlpha = 16843210; // 0x10101ca field public static final int fromDegrees = 16843187; // 0x10101b3 field public static final int fromScene = 16843741; // 0x10103dd field public static final int fromSceneName = 16843774; // 0x10103fe field public static final int fromXDelta = 16843206; // 0x10101c6 field public static final int fromXScale = 16843202; // 0x10101c2 field public static final int fromYDelta = 16843208; // 0x10101c8 Loading Loading @@ -960,6 +961,7 @@ package android { field public static final int shadowRadius = 16843108; // 0x1010164 field public static final int shape = 16843162; // 0x101019a field public static final int shareInterpolator = 16843195; // 0x10101bb field public static final int sharedElementName = 16843776; // 0x1010400 field public static final int sharedUserId = 16842763; // 0x101000b field public static final int sharedUserLabel = 16843361; // 0x1010261 field public static final int shouldDisableView = 16843246; // 0x10101ee Loading Loading @@ -1142,6 +1144,7 @@ package android { field public static final int toAlpha = 16843211; // 0x10101cb field public static final int toDegrees = 16843188; // 0x10101b4 field public static final int toScene = 16843742; // 0x10103de field public static final int toSceneName = 16843775; // 0x10103ff field public static final int toXDelta = 16843207; // 0x10101c7 field public static final int toXScale = 16843203; // 0x10101c3 field public static final int toYDelta = 16843209; // 0x10101c9 Loading @@ -1157,6 +1160,7 @@ package android { field public static final int transformPivotX = 16843552; // 0x1010320 field public static final int transformPivotY = 16843553; // 0x1010321 field public static final int transition = 16843743; // 0x10103df field public static final int transitionGroup = 16843777; // 0x1010401 field public static final int transitionOrdering = 16843744; // 0x10103e0 field public static final int translationX = 16843554; // 0x1010322 field public static final int translationY = 16843555; // 0x1010323 Loading Loading @@ -1514,6 +1518,7 @@ package android { field public static final int selectAll = 16908319; // 0x102001f field public static final int selectTextMode = 16908333; // 0x102002d field public static final int selectedIcon = 16908302; // 0x102000e field public static final int shared_element_name = 16908334; // 0x102002e field public static final int startSelectingText = 16908328; // 0x1020028 field public static final int stopSelectingText = 16908329; // 0x1020029 field public static final int summary = 16908304; // 0x1020010 Loading Loading @@ -3035,6 +3040,7 @@ package android.app { method public int getTaskId(); method public final java.lang.CharSequence getTitle(); method public final int getTitleColor(); method public android.os.Bundle getTransitionArgs(); method public final int getVolumeControlStream(); method public android.view.Window getWindow(); method public android.view.WindowManager getWindowManager(); Loading Loading @@ -3130,6 +3136,7 @@ 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 setEarlyBackgroundTransition(boolean); method public final void setFeatureDrawable(int, android.graphics.drawable.Drawable); method public final void setFeatureDrawableAlpha(int, int); method public final void setFeatureDrawableResource(int, int); Loading Loading @@ -3170,6 +3177,7 @@ package android.app { method public boolean startNextMatchingActivity(android.content.Intent); method public boolean startNextMatchingActivity(android.content.Intent, android.os.Bundle); method public void startSearch(java.lang.String, boolean, android.os.Bundle, boolean); method protected void startSharedElementTransition(android.os.Bundle); method public deprecated void stopManagingCursor(android.database.Cursor); method public void takeKeyEvents(boolean); method public void triggerSearch(java.lang.String, android.os.Bundle); Loading Loading @@ -3340,6 +3348,7 @@ package android.app { public class ActivityOptions { method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int); method public static android.app.ActivityOptions makeScaleUpAnimation(android.view.View, int, int, int, int); method public static android.app.ActivityOptions makeSceneTransitionAnimation(android.os.Bundle); method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int); method public android.os.Bundle toBundle(); method public void update(android.app.ActivityOptions); Loading Loading @@ -18378,7 +18387,7 @@ package android.os { public abstract class CountDownTimer { ctor public CountDownTimer(long, long); method public final void cancel(); method public final synchronized void cancel(); method public abstract void onFinish(); method public abstract void onTick(long); method public final synchronized android.os.CountDownTimer start(); Loading Loading @@ -26682,6 +26691,7 @@ package android.transition { method public android.transition.Transition addListener(android.transition.Transition.TransitionListener); method public android.transition.Transition addTarget(int); method public android.transition.Transition addTarget(android.view.View); method public boolean canRemoveViews(); method public abstract void captureEndValues(android.transition.TransitionValues); method public abstract void captureStartValues(android.transition.TransitionValues); method public android.transition.Transition clone(); Loading Loading @@ -28746,6 +28756,7 @@ package android.view { method public int getScrollBarStyle(); method public final int getScrollX(); method public final int getScrollY(); method public java.lang.String getSharedElementName(); method public int getSolidColor(); method protected int getSuggestedMinimumHeight(); method protected int getSuggestedMinimumWidth(); Loading Loading @@ -28999,6 +29010,7 @@ package android.view { method public void setScrollY(int); method public void setScrollbarFadingEnabled(boolean); method public void setSelected(boolean); method public void setSharedElementName(java.lang.String); method public void setSoundEffectsEnabled(boolean); method public void setSystemUiVisibility(int); method public void setTag(java.lang.Object); Loading Loading @@ -29385,6 +29397,7 @@ package android.view { method protected boolean isChildrenDrawingOrderEnabled(); method protected boolean isChildrenDrawnWithCacheEnabled(); method public boolean isMotionEventSplittingEnabled(); method public boolean isTransitionGroup(); method public final void layout(int, int, int, int); method protected void measureChild(android.view.View, int, int); method protected void measureChildWithMargins(android.view.View, int, int, int, int); Loading Loading @@ -29430,6 +29443,7 @@ package android.view { method public void setOnHierarchyChangeListener(android.view.ViewGroup.OnHierarchyChangeListener); method public void setPersistentDrawingCache(int); method protected void setStaticTransformationsEnabled(boolean); method public void setTransitionGroup(boolean); method public boolean shouldDelayChildPressedState(); method public boolean showContextMenuForChild(android.view.View); method public android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); Loading Loading @@ -29724,7 +29738,6 @@ package android.view { method public abstract void setTitle(java.lang.CharSequence); method public abstract deprecated void setTitleColor(int); method public void setTransitionManager(android.transition.TransitionManager); method public void setTransitionOptions(android.os.Bundle); method public void setType(int); method public void setUiOptions(int); method public void setUiOptions(int, int); core/java/android/app/Activity.java +104 −36 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.app; import android.annotation.NonNull; import android.transition.Scene; import android.transition.Transition; import android.transition.TransitionManager; import android.util.ArrayMap; import android.util.SuperNotCalledException; Loading Loading @@ -771,6 +770,7 @@ public class Activity extends ContextThemeWrapper private Thread mUiThread; final Handler mHandler = new Handler(); private ActivityOptions mTransitionActivityOptions; /** Return the intent that started this activity. */ public Intent getIntent() { Loading Loading @@ -3446,29 +3446,7 @@ public class Activity extends ContextThemeWrapper * @see #startActivity */ public void startActivityForResult(Intent intent, int requestCode) { final TransitionManager tm = getWindow().getTransitionManager(); final Scene currScene = getWindow().getContentScene(); final String[] targetSceneNames = currScene != null && tm != null ? tm.getTargetSceneNames(currScene) : null; if (targetSceneNames == null || targetSceneNames.length == 0) { startActivityForResult(intent, requestCode, null); } else { // TODO Capture the scene transition args and send along final ActivityOptions opts = ActivityOptions.makeSceneTransitionAnimation( targetSceneNames, null, new ActivityOptions.OnSceneTransitionStartedListener() { @Override public void onSceneTransitionStarted(String destSceneName) { final Transition t = tm.getNamedTransition(currScene, destSceneName); // TODO Fill this in to notify the outgoing activity that it should // treat this as a sync point for the transition - the target // transition has started. Log.d(TAG, "Scene transition to scene " + destSceneName + " transition " + t); } }, mHandler); startActivityForResult(intent, requestCode, opts.toBundle()); } } /** Loading Loading @@ -3506,6 +3484,14 @@ public class Activity extends ContextThemeWrapper * @see #startActivity */ public void startActivityForResult(Intent intent, int requestCode, @Nullable Bundle options) { TransitionManager tm = getContentTransitionManager(); if (tm != null && options != null) { ActivityOptions activityOptions = new ActivityOptions(options); if (activityOptions.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) { getWindow().startExitTransition(activityOptions); options = activityOptions.toBundle(); } } if (mParent == null) { Instrumentation.ActivityResult ar = mInstrumentation.execStartActivity( Loading Loading @@ -5335,8 +5321,40 @@ public class Activity extends ContextThemeWrapper mWindow.setContainer(mParent.getWindow()); } mWindowManager = mWindow.getWindowManager(); mWindow.setTransitionOptions(options); mCurrentConfig = config; mTransitionActivityOptions = null; Window.SceneTransitionListener sceneTransitionListener = null; if (options != null) { ActivityOptions activityOptions = new ActivityOptions(options); if (activityOptions.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) { mTransitionActivityOptions = activityOptions; sceneTransitionListener = new Window.SceneTransitionListener() { @Override public void enterSharedElement(Bundle transitionArgs) { startSharedElementTransition(transitionArgs); mTransitionActivityOptions = null; } @Override public void nullPendingTransition() { overridePendingTransition(0, 0); } @Override public void convertFromTranslucent() { Activity.this.convertFromTranslucent(); } @Override public void convertToTranslucent() { Activity.this.convertToTranslucent(null); } }; } } mWindow.setTransitionOptions(mTransitionActivityOptions, sceneTransitionListener); } /** @hide */ Loading Loading @@ -5523,6 +5541,56 @@ public class Activity extends ContextThemeWrapper } } /** * Gets the entering Activity transition args. Will be null if * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle)} was * not used to pass a Bundle to startActivity. The Bundle passed to that method in the * calling Activity is returned here. * <p>After startSharedElementTransition is called, this method will return null.</p> * * @return The Bundle passed into Bundle parameter of * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle)} * in the calling Activity. */ public Bundle getTransitionArgs() { if (mTransitionActivityOptions == null) { return null; } return mTransitionActivityOptions.getSceneTransitionArgs(); } /** * Override to transfer a shared element from a calling Activity to this Activity. * Shared elements will be made VISIBLE before this call. The Activity is responsible * for transitioning the shared elements from their location to the eventual destination. * The shared element will be laid out a the destination when this method is called. * * @param transitionArgs The same as returned from {@link #getTransitionArgs()}, this should * contain information from the calling Activity to tell where the * shared element should be placed. */ protected void startSharedElementTransition(Bundle transitionArgs) { } /** * Controls how the background fade is triggered when there is an entering Activity transition. * If fadeEarly is true, the Window background will fade in as soon as the shared elements are * ready to switch. If fadeEarly is false, the background will fade only after the calling * Activity's exit transition completes. By default, the Window will fade in when the calling * Activity's exit transition completes. * * @param fadeEarly Set to true to fade out the exiting Activity as soon as the shared elements * are transferred. Set to false to fade out the exiting Activity as soon as * the shared element is transferred. * @see android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle) */ public void setEarlyBackgroundTransition(boolean fadeEarly) { if (mTransitionActivityOptions == null) { return; } mWindow.setEarlyBackgroundTransition(fadeEarly); } /** * @hide */ Loading core/java/android/app/ActivityOptions.java +199 −91 File changed.Preview size limit exceeded, changes collapsed. Show changes core/java/android/transition/Transition.java +12 −3 Original line number Diff line number Diff line Loading @@ -552,7 +552,8 @@ public abstract class Transition implements Cloneable { return false; } private static ArrayMap<Animator, AnimationInfo> getRunningAnimators() { /** @hide */ public static ArrayMap<Animator, AnimationInfo> getRunningAnimators() { ArrayMap<Animator, AnimationInfo> runningAnimators = sRunningAnimators.get(); if (runningAnimators == null) { runningAnimators = new ArrayMap<Animator, AnimationInfo>(); Loading Loading @@ -1077,6 +1078,9 @@ public abstract class Transition implements Cloneable { if (view == null) { return; } if (!isValidTarget(view, view.getId())) { return; } boolean isListViewItem = false; if (view.getParent() instanceof ListView) { isListViewItem = true; Loading Loading @@ -1467,6 +1471,10 @@ public abstract class Transition implements Cloneable { mCanRemoveViews = canRemoveViews; } public boolean canRemoveViews() { return mCanRemoveViews; } @Override public String toString() { return toString(""); Loading Loading @@ -1629,9 +1637,10 @@ public abstract class Transition implements Cloneable { * animation should be canceled or a new animation noop'd. The structure holds * information about the state that an animation is going to, to be compared to * end state of a new animation. * @hide */ private static class AnimationInfo { View view; public static class AnimationInfo { public View view; String name; TransitionValues values; Loading core/java/android/view/View.java +33 −0 Original line number Diff line number Diff line Loading @@ -665,6 +665,7 @@ import java.util.concurrent.atomic.AtomicInteger; * @attr ref android.R.styleable#View_scrollbarTrackVertical * @attr ref android.R.styleable#View_scrollbarAlwaysDrawHorizontalTrack * @attr ref android.R.styleable#View_scrollbarAlwaysDrawVerticalTrack * @attr ref android.R.styleable#View_sharedElementName * @attr ref android.R.styleable#View_soundEffectsEnabled * @attr ref android.R.styleable#View_tag * @attr ref android.R.styleable#View_textAlignment Loading Loading @@ -4038,6 +4039,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, case R.styleable.View_accessibilityLiveRegion: setAccessibilityLiveRegion(a.getInt(attr, ACCESSIBILITY_LIVE_REGION_DEFAULT)); break; case R.styleable.View_sharedElementName: setSharedElementName(a.getString(attr)); break; } } Loading Loading @@ -18871,6 +18875,35 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return mAnimator; } /** * Specifies that the shared name of the View to be shared with another Activity. * When transitioning between Activities, the name links a UI element in the starting * Activity to UI element in the called Activity. Names should be unique in the * View hierarchy. * * @param sharedElementName The cross-Activity View identifier. The called Activity will use * the name to match the location with a View in its layout. * @see android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle) */ public void setSharedElementName(String sharedElementName) { setTagInternal(com.android.internal.R.id.shared_element_name, sharedElementName); } /** * Returns the shared name of the View to be shared with another Activity. * When transitioning between Activities, the name links a UI element in the starting * Activity to UI element in the called Activity. Names should be unique in the * View hierarchy. * * <p>This returns null if the View is not a shared element or the name if it is.</p> * * @return The name used for this View for cross-Activity transitions or null if * this View has not been identified as shared. */ public String getSharedElementName() { return (String) getTag(com.android.internal.R.id.shared_element_name); } /** * Interface definition for a callback to be invoked when a hardware key event is * dispatched to this view. The callback will be invoked before the key event is Loading
api/current.txt +15 −2 Original line number Diff line number Diff line Loading @@ -543,6 +543,7 @@ package android { field public static final int fromAlpha = 16843210; // 0x10101ca field public static final int fromDegrees = 16843187; // 0x10101b3 field public static final int fromScene = 16843741; // 0x10103dd field public static final int fromSceneName = 16843774; // 0x10103fe field public static final int fromXDelta = 16843206; // 0x10101c6 field public static final int fromXScale = 16843202; // 0x10101c2 field public static final int fromYDelta = 16843208; // 0x10101c8 Loading Loading @@ -960,6 +961,7 @@ package android { field public static final int shadowRadius = 16843108; // 0x1010164 field public static final int shape = 16843162; // 0x101019a field public static final int shareInterpolator = 16843195; // 0x10101bb field public static final int sharedElementName = 16843776; // 0x1010400 field public static final int sharedUserId = 16842763; // 0x101000b field public static final int sharedUserLabel = 16843361; // 0x1010261 field public static final int shouldDisableView = 16843246; // 0x10101ee Loading Loading @@ -1142,6 +1144,7 @@ package android { field public static final int toAlpha = 16843211; // 0x10101cb field public static final int toDegrees = 16843188; // 0x10101b4 field public static final int toScene = 16843742; // 0x10103de field public static final int toSceneName = 16843775; // 0x10103ff field public static final int toXDelta = 16843207; // 0x10101c7 field public static final int toXScale = 16843203; // 0x10101c3 field public static final int toYDelta = 16843209; // 0x10101c9 Loading @@ -1157,6 +1160,7 @@ package android { field public static final int transformPivotX = 16843552; // 0x1010320 field public static final int transformPivotY = 16843553; // 0x1010321 field public static final int transition = 16843743; // 0x10103df field public static final int transitionGroup = 16843777; // 0x1010401 field public static final int transitionOrdering = 16843744; // 0x10103e0 field public static final int translationX = 16843554; // 0x1010322 field public static final int translationY = 16843555; // 0x1010323 Loading Loading @@ -1514,6 +1518,7 @@ package android { field public static final int selectAll = 16908319; // 0x102001f field public static final int selectTextMode = 16908333; // 0x102002d field public static final int selectedIcon = 16908302; // 0x102000e field public static final int shared_element_name = 16908334; // 0x102002e field public static final int startSelectingText = 16908328; // 0x1020028 field public static final int stopSelectingText = 16908329; // 0x1020029 field public static final int summary = 16908304; // 0x1020010 Loading Loading @@ -3035,6 +3040,7 @@ package android.app { method public int getTaskId(); method public final java.lang.CharSequence getTitle(); method public final int getTitleColor(); method public android.os.Bundle getTransitionArgs(); method public final int getVolumeControlStream(); method public android.view.Window getWindow(); method public android.view.WindowManager getWindowManager(); Loading Loading @@ -3130,6 +3136,7 @@ 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 setEarlyBackgroundTransition(boolean); method public final void setFeatureDrawable(int, android.graphics.drawable.Drawable); method public final void setFeatureDrawableAlpha(int, int); method public final void setFeatureDrawableResource(int, int); Loading Loading @@ -3170,6 +3177,7 @@ package android.app { method public boolean startNextMatchingActivity(android.content.Intent); method public boolean startNextMatchingActivity(android.content.Intent, android.os.Bundle); method public void startSearch(java.lang.String, boolean, android.os.Bundle, boolean); method protected void startSharedElementTransition(android.os.Bundle); method public deprecated void stopManagingCursor(android.database.Cursor); method public void takeKeyEvents(boolean); method public void triggerSearch(java.lang.String, android.os.Bundle); Loading Loading @@ -3340,6 +3348,7 @@ package android.app { public class ActivityOptions { method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int); method public static android.app.ActivityOptions makeScaleUpAnimation(android.view.View, int, int, int, int); method public static android.app.ActivityOptions makeSceneTransitionAnimation(android.os.Bundle); method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int); method public android.os.Bundle toBundle(); method public void update(android.app.ActivityOptions); Loading Loading @@ -18378,7 +18387,7 @@ package android.os { public abstract class CountDownTimer { ctor public CountDownTimer(long, long); method public final void cancel(); method public final synchronized void cancel(); method public abstract void onFinish(); method public abstract void onTick(long); method public final synchronized android.os.CountDownTimer start(); Loading Loading @@ -26682,6 +26691,7 @@ package android.transition { method public android.transition.Transition addListener(android.transition.Transition.TransitionListener); method public android.transition.Transition addTarget(int); method public android.transition.Transition addTarget(android.view.View); method public boolean canRemoveViews(); method public abstract void captureEndValues(android.transition.TransitionValues); method public abstract void captureStartValues(android.transition.TransitionValues); method public android.transition.Transition clone(); Loading Loading @@ -28746,6 +28756,7 @@ package android.view { method public int getScrollBarStyle(); method public final int getScrollX(); method public final int getScrollY(); method public java.lang.String getSharedElementName(); method public int getSolidColor(); method protected int getSuggestedMinimumHeight(); method protected int getSuggestedMinimumWidth(); Loading Loading @@ -28999,6 +29010,7 @@ package android.view { method public void setScrollY(int); method public void setScrollbarFadingEnabled(boolean); method public void setSelected(boolean); method public void setSharedElementName(java.lang.String); method public void setSoundEffectsEnabled(boolean); method public void setSystemUiVisibility(int); method public void setTag(java.lang.Object); Loading Loading @@ -29385,6 +29397,7 @@ package android.view { method protected boolean isChildrenDrawingOrderEnabled(); method protected boolean isChildrenDrawnWithCacheEnabled(); method public boolean isMotionEventSplittingEnabled(); method public boolean isTransitionGroup(); method public final void layout(int, int, int, int); method protected void measureChild(android.view.View, int, int); method protected void measureChildWithMargins(android.view.View, int, int, int, int); Loading Loading @@ -29430,6 +29443,7 @@ package android.view { method public void setOnHierarchyChangeListener(android.view.ViewGroup.OnHierarchyChangeListener); method public void setPersistentDrawingCache(int); method protected void setStaticTransformationsEnabled(boolean); method public void setTransitionGroup(boolean); method public boolean shouldDelayChildPressedState(); method public boolean showContextMenuForChild(android.view.View); method public android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback); Loading Loading @@ -29724,7 +29738,6 @@ package android.view { method public abstract void setTitle(java.lang.CharSequence); method public abstract deprecated void setTitleColor(int); method public void setTransitionManager(android.transition.TransitionManager); method public void setTransitionOptions(android.os.Bundle); method public void setType(int); method public void setUiOptions(int); method public void setUiOptions(int, int);
core/java/android/app/Activity.java +104 −36 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.app; import android.annotation.NonNull; import android.transition.Scene; import android.transition.Transition; import android.transition.TransitionManager; import android.util.ArrayMap; import android.util.SuperNotCalledException; Loading Loading @@ -771,6 +770,7 @@ public class Activity extends ContextThemeWrapper private Thread mUiThread; final Handler mHandler = new Handler(); private ActivityOptions mTransitionActivityOptions; /** Return the intent that started this activity. */ public Intent getIntent() { Loading Loading @@ -3446,29 +3446,7 @@ public class Activity extends ContextThemeWrapper * @see #startActivity */ public void startActivityForResult(Intent intent, int requestCode) { final TransitionManager tm = getWindow().getTransitionManager(); final Scene currScene = getWindow().getContentScene(); final String[] targetSceneNames = currScene != null && tm != null ? tm.getTargetSceneNames(currScene) : null; if (targetSceneNames == null || targetSceneNames.length == 0) { startActivityForResult(intent, requestCode, null); } else { // TODO Capture the scene transition args and send along final ActivityOptions opts = ActivityOptions.makeSceneTransitionAnimation( targetSceneNames, null, new ActivityOptions.OnSceneTransitionStartedListener() { @Override public void onSceneTransitionStarted(String destSceneName) { final Transition t = tm.getNamedTransition(currScene, destSceneName); // TODO Fill this in to notify the outgoing activity that it should // treat this as a sync point for the transition - the target // transition has started. Log.d(TAG, "Scene transition to scene " + destSceneName + " transition " + t); } }, mHandler); startActivityForResult(intent, requestCode, opts.toBundle()); } } /** Loading Loading @@ -3506,6 +3484,14 @@ public class Activity extends ContextThemeWrapper * @see #startActivity */ public void startActivityForResult(Intent intent, int requestCode, @Nullable Bundle options) { TransitionManager tm = getContentTransitionManager(); if (tm != null && options != null) { ActivityOptions activityOptions = new ActivityOptions(options); if (activityOptions.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) { getWindow().startExitTransition(activityOptions); options = activityOptions.toBundle(); } } if (mParent == null) { Instrumentation.ActivityResult ar = mInstrumentation.execStartActivity( Loading Loading @@ -5335,8 +5321,40 @@ public class Activity extends ContextThemeWrapper mWindow.setContainer(mParent.getWindow()); } mWindowManager = mWindow.getWindowManager(); mWindow.setTransitionOptions(options); mCurrentConfig = config; mTransitionActivityOptions = null; Window.SceneTransitionListener sceneTransitionListener = null; if (options != null) { ActivityOptions activityOptions = new ActivityOptions(options); if (activityOptions.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) { mTransitionActivityOptions = activityOptions; sceneTransitionListener = new Window.SceneTransitionListener() { @Override public void enterSharedElement(Bundle transitionArgs) { startSharedElementTransition(transitionArgs); mTransitionActivityOptions = null; } @Override public void nullPendingTransition() { overridePendingTransition(0, 0); } @Override public void convertFromTranslucent() { Activity.this.convertFromTranslucent(); } @Override public void convertToTranslucent() { Activity.this.convertToTranslucent(null); } }; } } mWindow.setTransitionOptions(mTransitionActivityOptions, sceneTransitionListener); } /** @hide */ Loading Loading @@ -5523,6 +5541,56 @@ public class Activity extends ContextThemeWrapper } } /** * Gets the entering Activity transition args. Will be null if * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle)} was * not used to pass a Bundle to startActivity. The Bundle passed to that method in the * calling Activity is returned here. * <p>After startSharedElementTransition is called, this method will return null.</p> * * @return The Bundle passed into Bundle parameter of * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle)} * in the calling Activity. */ public Bundle getTransitionArgs() { if (mTransitionActivityOptions == null) { return null; } return mTransitionActivityOptions.getSceneTransitionArgs(); } /** * Override to transfer a shared element from a calling Activity to this Activity. * Shared elements will be made VISIBLE before this call. The Activity is responsible * for transitioning the shared elements from their location to the eventual destination. * The shared element will be laid out a the destination when this method is called. * * @param transitionArgs The same as returned from {@link #getTransitionArgs()}, this should * contain information from the calling Activity to tell where the * shared element should be placed. */ protected void startSharedElementTransition(Bundle transitionArgs) { } /** * Controls how the background fade is triggered when there is an entering Activity transition. * If fadeEarly is true, the Window background will fade in as soon as the shared elements are * ready to switch. If fadeEarly is false, the background will fade only after the calling * Activity's exit transition completes. By default, the Window will fade in when the calling * Activity's exit transition completes. * * @param fadeEarly Set to true to fade out the exiting Activity as soon as the shared elements * are transferred. Set to false to fade out the exiting Activity as soon as * the shared element is transferred. * @see android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle) */ public void setEarlyBackgroundTransition(boolean fadeEarly) { if (mTransitionActivityOptions == null) { return; } mWindow.setEarlyBackgroundTransition(fadeEarly); } /** * @hide */ Loading
core/java/android/app/ActivityOptions.java +199 −91 File changed.Preview size limit exceeded, changes collapsed. Show changes
core/java/android/transition/Transition.java +12 −3 Original line number Diff line number Diff line Loading @@ -552,7 +552,8 @@ public abstract class Transition implements Cloneable { return false; } private static ArrayMap<Animator, AnimationInfo> getRunningAnimators() { /** @hide */ public static ArrayMap<Animator, AnimationInfo> getRunningAnimators() { ArrayMap<Animator, AnimationInfo> runningAnimators = sRunningAnimators.get(); if (runningAnimators == null) { runningAnimators = new ArrayMap<Animator, AnimationInfo>(); Loading Loading @@ -1077,6 +1078,9 @@ public abstract class Transition implements Cloneable { if (view == null) { return; } if (!isValidTarget(view, view.getId())) { return; } boolean isListViewItem = false; if (view.getParent() instanceof ListView) { isListViewItem = true; Loading Loading @@ -1467,6 +1471,10 @@ public abstract class Transition implements Cloneable { mCanRemoveViews = canRemoveViews; } public boolean canRemoveViews() { return mCanRemoveViews; } @Override public String toString() { return toString(""); Loading Loading @@ -1629,9 +1637,10 @@ public abstract class Transition implements Cloneable { * animation should be canceled or a new animation noop'd. The structure holds * information about the state that an animation is going to, to be compared to * end state of a new animation. * @hide */ private static class AnimationInfo { View view; public static class AnimationInfo { public View view; String name; TransitionValues values; Loading
core/java/android/view/View.java +33 −0 Original line number Diff line number Diff line Loading @@ -665,6 +665,7 @@ import java.util.concurrent.atomic.AtomicInteger; * @attr ref android.R.styleable#View_scrollbarTrackVertical * @attr ref android.R.styleable#View_scrollbarAlwaysDrawHorizontalTrack * @attr ref android.R.styleable#View_scrollbarAlwaysDrawVerticalTrack * @attr ref android.R.styleable#View_sharedElementName * @attr ref android.R.styleable#View_soundEffectsEnabled * @attr ref android.R.styleable#View_tag * @attr ref android.R.styleable#View_textAlignment Loading Loading @@ -4038,6 +4039,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, case R.styleable.View_accessibilityLiveRegion: setAccessibilityLiveRegion(a.getInt(attr, ACCESSIBILITY_LIVE_REGION_DEFAULT)); break; case R.styleable.View_sharedElementName: setSharedElementName(a.getString(attr)); break; } } Loading Loading @@ -18871,6 +18875,35 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return mAnimator; } /** * Specifies that the shared name of the View to be shared with another Activity. * When transitioning between Activities, the name links a UI element in the starting * Activity to UI element in the called Activity. Names should be unique in the * View hierarchy. * * @param sharedElementName The cross-Activity View identifier. The called Activity will use * the name to match the location with a View in its layout. * @see android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle) */ public void setSharedElementName(String sharedElementName) { setTagInternal(com.android.internal.R.id.shared_element_name, sharedElementName); } /** * Returns the shared name of the View to be shared with another Activity. * When transitioning between Activities, the name links a UI element in the starting * Activity to UI element in the called Activity. Names should be unique in the * View hierarchy. * * <p>This returns null if the View is not a shared element or the name if it is.</p> * * @return The name used for this View for cross-Activity transitions or null if * this View has not been identified as shared. */ public String getSharedElementName() { return (String) getTag(com.android.internal.R.id.shared_element_name); } /** * Interface definition for a callback to be invoked when a hardware key event is * dispatched to this view. The callback will be invoked before the key event is