void EnterTransitionCoordinator::SendSharedElementDestination() { Boolean allReady, bval; AutoPtr<IViewGroup> vg; GetDecor((IViewGroup**)&vg); IView* decorView = IView::Probe(vg); AutoPtr<ITransition> evt; GetEnterViewsTransition((ITransition**)&evt); if (AllowOverlappingTransitions() && evt != NULL) { allReady = FALSE; } else if (decorView == NULL) { allReady = TRUE; } else { decorView->IsLayoutRequested(&allReady); allReady = !allReady; if (allReady) { Int32 size; mSharedElements->GetSize(&size); IView* view; for (Int32 i = 0; i < size; i++) { AutoPtr<IInterface> obj; mSharedElements->Get(i, (IInterface**)&obj); view = IView::Probe(obj); view->IsLayoutRequested(&bval); if (bval) { allReady = FALSE; break; } } } } if (allReady) { AutoPtr<IBundle> state = CaptureSharedElementState(); SetSharedElementMatrices(); MoveSharedElementsToOverlay(); mResultReceiver->Send( IActivityTransitionCoordinator::MSG_SHARED_ELEMENT_DESTINATION, state); } else if (decorView != NULL) { AutoPtr<IViewTreeObserver> vto; decorView->GetViewTreeObserver((IViewTreeObserver**)&vto); AutoPtr<IOnPreDrawListener> listener = new DestinationDecorViewOnPreDrawListener(this, decorView); vto->AddOnPreDrawListener(listener); } if (AllowOverlappingTransitions()) { StartEnterTransitionOnly(); } }
ECode EnterTransitionCoordinator::TriggerViewsReady( /* [in] */ IArrayMap* sharedElements) //ArrayMap<String, View> { if (mAreViewsReady) { return NOERROR; } mAreViewsReady = TRUE; // Ensure the views have been laid out before capturing the views -- we need the epicenter. Boolean isEmpty; sharedElements->IsEmpty(&isEmpty); if (isEmpty) { ViewsReady(sharedElements); return NOERROR; } AutoPtr<IInterface> obj; sharedElements->Get(0, (IInterface**)&obj); IView* sharedElement = IView::Probe(obj); Boolean requested; sharedElement->IsLayoutRequested(&requested); if (!requested) { ViewsReady(sharedElements); } else { AutoPtr<IOnPreDrawListener> listener = new SharedElementOnPreDrawListener( this, sharedElements, sharedElement); AutoPtr<IViewTreeObserver> vto; sharedElement->GetViewTreeObserver((IViewTreeObserver**)&vto); vto->AddOnPreDrawListener(listener); } return NOERROR; }