Loading core/java/android/app/ActivityTransitionState.java +12 −2 Original line number Diff line number Diff line Loading @@ -66,6 +66,12 @@ class ActivityTransitionState { */ private ExitTransitionCoordinator mCalledExitCoordinator; /** * The ExitTransitionCoordinator used to return to a previous Activity when called with * {@link android.app.Activity#finishAfterTransition()}. */ private ExitTransitionCoordinator mReturnExitCoordinator; /** * We must be able to cancel entering transitions to stop changing the Window to * opaque when we exit before making the Window opaque. Loading Loading @@ -218,6 +224,10 @@ class ActivityTransitionState { mEnterTransitionCoordinator.stop(); mEnterTransitionCoordinator = null; } if (mReturnExitCoordinator != null) { mReturnExitCoordinator.stop(); mReturnExitCoordinator = null; } } public void onResume() { Loading Loading @@ -260,12 +270,12 @@ class ActivityTransitionState { } } ExitTransitionCoordinator exitCoordinator = mReturnExitCoordinator = new ExitTransitionCoordinator(activity, mEnteringNames, null, null, true); if (enterViewsTransition != null && decor != null) { enterViewsTransition.resume(decor); } exitCoordinator.startExit(activity.mResultCode, activity.mResultData); mReturnExitCoordinator.startExit(activity.mResultCode, activity.mResultData); } return true; } Loading core/java/android/app/EnterTransitionCoordinator.java +35 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewGroupOverlay; import android.view.ViewTreeObserver; import android.view.Window; import java.util.ArrayList; Loading Loading @@ -265,10 +266,14 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { } protected void prepareEnter() { ViewGroup decorView = getDecor(); if (mActivity == null || decorView == null) { return; } mActivity.overridePendingTransition(0, 0); if (!mIsReturning) { mWasOpaque = mActivity.convertToTranslucent(null, null); Drawable background = getDecor().getBackground(); Drawable background = decorView.getBackground(); if (background != null) { getWindow().setBackgroundDrawable(null); background = background.mutate(); Loading @@ -282,18 +287,26 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { @Override protected Transition getViewsTransition() { Window window = getWindow(); if (window == null) { return null; } if (mIsReturning) { return getWindow().getReenterTransition(); return window.getReenterTransition(); } else { return getWindow().getEnterTransition(); return window.getEnterTransition(); } } protected Transition getSharedElementTransition() { Window window = getWindow(); if (window == null) { return null; } if (mIsReturning) { return getWindow().getSharedElementReenterTransition(); return window.getSharedElementReenterTransition(); } else { return getWindow().getSharedElementEnterTransition(); return window.getSharedElementEnterTransition(); } } Loading Loading @@ -518,15 +531,29 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { } public void stop() { makeOpaque(); mIsCanceled = true; mResultReceiver = null; // Restore the background to its previous state since the // Activity is stopping. if (mBackgroundAnimator != null) { mBackgroundAnimator.end(); mBackgroundAnimator = null; } else if (mWasOpaque) { ViewGroup decorView = getDecor(); if (decorView != null) { Drawable drawable = decorView.getBackground(); if (drawable != null) { drawable.setAlpha(1); } } } makeOpaque(); mIsCanceled = true; mResultReceiver = null; mActivity = null; moveSharedElementsFromOverlay(); if (mTransitioningViews != null) { showViews(mTransitioningViews, true); } showViews(mSharedElements, true); clearState(); } Loading core/java/android/app/ExitTransitionCoordinator.java +16 −5 Original line number Diff line number Diff line Loading @@ -255,6 +255,16 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator { } } public void stop() { if (mIsReturning && mActivity != null) { // Override the previous ActivityOptions. We don't want the // activity to have options since we're essentially canceling the // transition and finishing right now. mActivity.convertToTranslucent(null, null); finish(); } } private void startExitTransition() { Transition transition = getExitTransition(); ViewGroup decorView = getDecor(); Loading Loading @@ -425,13 +435,14 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator { private void finish() { stopCancel(); if (mActivity != null) { mActivity.mActivityTransitionState.clear(); // Clear the state so that we can't hold any references accidentally and leak memory. mHandler.removeMessages(MSG_CANCEL); mHandler = null; mActivity.finish(); mActivity.overridePendingTransition(0, 0); mActivity = null; } // Clear the state so that we can't hold any references accidentally and leak memory. mHandler = null; mSharedElementBundle = null; if (mBackgroundAnimator != null) { mBackgroundAnimator.cancel(); Loading Loading
core/java/android/app/ActivityTransitionState.java +12 −2 Original line number Diff line number Diff line Loading @@ -66,6 +66,12 @@ class ActivityTransitionState { */ private ExitTransitionCoordinator mCalledExitCoordinator; /** * The ExitTransitionCoordinator used to return to a previous Activity when called with * {@link android.app.Activity#finishAfterTransition()}. */ private ExitTransitionCoordinator mReturnExitCoordinator; /** * We must be able to cancel entering transitions to stop changing the Window to * opaque when we exit before making the Window opaque. Loading Loading @@ -218,6 +224,10 @@ class ActivityTransitionState { mEnterTransitionCoordinator.stop(); mEnterTransitionCoordinator = null; } if (mReturnExitCoordinator != null) { mReturnExitCoordinator.stop(); mReturnExitCoordinator = null; } } public void onResume() { Loading Loading @@ -260,12 +270,12 @@ class ActivityTransitionState { } } ExitTransitionCoordinator exitCoordinator = mReturnExitCoordinator = new ExitTransitionCoordinator(activity, mEnteringNames, null, null, true); if (enterViewsTransition != null && decor != null) { enterViewsTransition.resume(decor); } exitCoordinator.startExit(activity.mResultCode, activity.mResultData); mReturnExitCoordinator.startExit(activity.mResultCode, activity.mResultData); } return true; } Loading
core/java/android/app/EnterTransitionCoordinator.java +35 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewGroupOverlay; import android.view.ViewTreeObserver; import android.view.Window; import java.util.ArrayList; Loading Loading @@ -265,10 +266,14 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { } protected void prepareEnter() { ViewGroup decorView = getDecor(); if (mActivity == null || decorView == null) { return; } mActivity.overridePendingTransition(0, 0); if (!mIsReturning) { mWasOpaque = mActivity.convertToTranslucent(null, null); Drawable background = getDecor().getBackground(); Drawable background = decorView.getBackground(); if (background != null) { getWindow().setBackgroundDrawable(null); background = background.mutate(); Loading @@ -282,18 +287,26 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { @Override protected Transition getViewsTransition() { Window window = getWindow(); if (window == null) { return null; } if (mIsReturning) { return getWindow().getReenterTransition(); return window.getReenterTransition(); } else { return getWindow().getEnterTransition(); return window.getEnterTransition(); } } protected Transition getSharedElementTransition() { Window window = getWindow(); if (window == null) { return null; } if (mIsReturning) { return getWindow().getSharedElementReenterTransition(); return window.getSharedElementReenterTransition(); } else { return getWindow().getSharedElementEnterTransition(); return window.getSharedElementEnterTransition(); } } Loading Loading @@ -518,15 +531,29 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { } public void stop() { makeOpaque(); mIsCanceled = true; mResultReceiver = null; // Restore the background to its previous state since the // Activity is stopping. if (mBackgroundAnimator != null) { mBackgroundAnimator.end(); mBackgroundAnimator = null; } else if (mWasOpaque) { ViewGroup decorView = getDecor(); if (decorView != null) { Drawable drawable = decorView.getBackground(); if (drawable != null) { drawable.setAlpha(1); } } } makeOpaque(); mIsCanceled = true; mResultReceiver = null; mActivity = null; moveSharedElementsFromOverlay(); if (mTransitioningViews != null) { showViews(mTransitioningViews, true); } showViews(mSharedElements, true); clearState(); } Loading
core/java/android/app/ExitTransitionCoordinator.java +16 −5 Original line number Diff line number Diff line Loading @@ -255,6 +255,16 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator { } } public void stop() { if (mIsReturning && mActivity != null) { // Override the previous ActivityOptions. We don't want the // activity to have options since we're essentially canceling the // transition and finishing right now. mActivity.convertToTranslucent(null, null); finish(); } } private void startExitTransition() { Transition transition = getExitTransition(); ViewGroup decorView = getDecor(); Loading Loading @@ -425,13 +435,14 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator { private void finish() { stopCancel(); if (mActivity != null) { mActivity.mActivityTransitionState.clear(); // Clear the state so that we can't hold any references accidentally and leak memory. mHandler.removeMessages(MSG_CANCEL); mHandler = null; mActivity.finish(); mActivity.overridePendingTransition(0, 0); mActivity = null; } // Clear the state so that we can't hold any references accidentally and leak memory. mHandler = null; mSharedElementBundle = null; if (mBackgroundAnimator != null) { mBackgroundAnimator.cancel(); Loading