Make additional shared elements a version-checked feature.

Bug 22505481

ag/684544 added a feature to allow shared elements that weren't
shared into an Activity to be shared back. However, if you are
targeting an older version of the SDK, you may get an unexpected
shared element back. This change in behavior has been locked
behind a target version check.

Change-Id: I7162e24f3b14fedd6b308e89e9d04ac67660f7d6
This commit is contained in:
George Mount
2015-07-15 16:30:20 -07:00
parent facfbc52d8
commit 2c256a04ae

View File

@@ -25,6 +25,7 @@ import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -238,8 +239,12 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
if (decorView != null && decorView.getBackground() == null) {
getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));
}
final boolean targetsM = decorView == null || decorView.getContext()
.getApplicationInfo().targetSdkVersion >= VERSION_CODES.MNC;
ArrayList<String> sharedElementNames = targetsM ? mSharedElementNames :
mAllSharedElementNames;
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, this,
mSharedElementNames, resultCode, data);
sharedElementNames, resultCode, data);
mActivity.convertToTranslucent(new Activity.TranslucentConversionListener() {
@Override
public void onTranslucentConversionComplete(boolean drawComplete) {