Merge "Don't make translucent window opaque during activity transition."

This commit is contained in:
George Mount
2014-06-18 22:58:44 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 3 deletions

View File

@@ -5323,13 +5323,15 @@ public class Activity extends ContextThemeWrapper
* drawn and it is safe to make this Activity translucent again.
* @param options activity options delivered to the activity below this one. The options
* are retrieved using {@link #getActivityOptions}.
* @return <code>true</code> if Window was opaque and will become translucent or
* <code>false</code> if window was translucent and no change needed to be made.
*
* @see #convertFromTranslucent()
* @see TranslucentConversionListener
*
* @hide
*/
public void convertToTranslucent(TranslucentConversionListener callback,
public boolean convertToTranslucent(TranslucentConversionListener callback,
ActivityOptions options) {
boolean drawComplete;
try {
@@ -5346,6 +5348,7 @@ public class Activity extends ContextThemeWrapper
// Window is already translucent.
mTranslucentCallback.onTranslucentConversionComplete(drawComplete);
}
return mChangeCanvasToTranslucent;
}
/** @hide */

View File

@@ -55,6 +55,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
private boolean mIsExitTransitionComplete;
private boolean mIsReadyForTransition;
private Bundle mSharedElementsBundle;
private boolean mWasOpaque;
public EnterTransitionCoordinator(Activity activity, ResultReceiver resultReceiver,
ArrayList<String> sharedElementNames, boolean isReturning) {
@@ -191,7 +192,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
protected void prepareEnter() {
mActivity.overridePendingTransition(0, 0);
if (!mIsReturning) {
mActivity.convertToTranslucent(null, null);
mWasOpaque = mActivity.convertToTranslucent(null, null);
Drawable background = getDecor().getBackground();
if (background != null) {
getWindow().setBackgroundDrawable(null);
@@ -376,7 +377,9 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
private void makeOpaque() {
if (!mHasStopped && mActivity != null) {
mActivity.convertFromTranslucent();
if (mWasOpaque) {
mActivity.convertFromTranslucent();
}
mActivity = null;
}
}