diff options
author | George Mount <mount@google.com> | 2014-09-22 13:58:21 -0700 |
---|---|---|
committer | George Mount <mount@google.com> | 2014-09-22 17:06:24 -0700 |
commit | f1abef6fc2194e72af521202ee4b17c10e03c935 (patch) | |
tree | 7fdf676256090453ee3dcf0a375ae843046d89d3 /core/java/android/app/EnterTransitionCoordinator.java | |
parent | ddc5e5f1c60f5fc491c9299a0afd280f8fdc252b (diff) | |
download | frameworks_base-f1abef6fc2194e72af521202ee4b17c10e03c935.zip frameworks_base-f1abef6fc2194e72af521202ee4b17c10e03c935.tar.gz frameworks_base-f1abef6fc2194e72af521202ee4b17c10e03c935.tar.bz2 |
Force transitioning views to be visible when transition interrupted.
Bug 17553034
When an Activity Transition was interrupted prior to starting the
enter transition, the views were not being made visible.
Override the return ActivityOptions if interrupted so that the
entering activity doesn't launch with a transition when coming
back from recents.
Change-Id: Id4e00c7bb138babfee4de71247a9df4431376e21
Diffstat (limited to 'core/java/android/app/EnterTransitionCoordinator.java')
-rw-r--r-- | core/java/android/app/EnterTransitionCoordinator.java | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/core/java/android/app/EnterTransitionCoordinator.java b/core/java/android/app/EnterTransitionCoordinator.java index 216d6ba..add67f2 100644 --- a/core/java/android/app/EnterTransitionCoordinator.java +++ b/core/java/android/app/EnterTransitionCoordinator.java @@ -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; @@ -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(); @@ -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(); } } @@ -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(); } |