am 028332e9: am 5506d92e: Fix NPE when detached View is added as a shared element.

* commit '028332e93e885d260c6214ca14e02035242c8dfe':
  Fix NPE when detached View is added as a shared element.
This commit is contained in:
George Mount
2014-09-24 20:49:33 +00:00
committed by Android Git Automerger

View File

@@ -222,8 +222,15 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
if (mListener != null) {
mListener.onMapSharedElements(mAllSharedElementNames, sharedElements);
}
mSharedElementNames.addAll(sharedElements.keySet());
mSharedElements.addAll(sharedElements.values());
int numSharedElements = sharedElements.size();
for (int i = 0; i < numSharedElements; i++) {
View sharedElement = sharedElements.valueAt(i);
String name = sharedElements.keyAt(i);
if (sharedElement != null && sharedElement.isAttachedToWindow() && name != null) {
mSharedElements.add(sharedElement);
mSharedElementNames.add(name);
}
}
if (getViewsTransition() != null && mTransitioningViews != null) {
ViewGroup decorView = getDecor();
if (decorView != null) {