@Override public void addView(ReactViewGroup parent, View child, int index) { String transitionName = (String) parent.getTag(R.id.react_shared_element_transition_name); String instanceId = (String) parent.getTag(R.id.react_shared_element_screen_instance_id); ReactInterface component = coordinator.componentFromId(instanceId); if (child instanceof ReactImageView) { ReactImageView iv = (ReactImageView) child; // TODO(lmr): do something to wait for image to load } ViewCompat.setTransitionName(child, transitionName); parent.addView(child, index); if (component != null) { component.notifySharedElementAddition(); } }
@Override public void onViewAdded(final View child) { if (child instanceof ReactImageView && this.child == null) { ReactViewHacks.disableReactImageViewRemoteImageFadeInAnimation((ReactImageView) child); } this.child = child; if (child instanceof TextView) { saveTextViewSpannedText((TextView) child); } super.onViewAdded(child); }
private ScalingUtils.ScaleType getScaleType(SharedElementTransition view) { if (view.getSharedView() instanceof ReactImageView) { return ((DraweeView<GenericDraweeHierarchy>) view.getSharedView()).getHierarchy().getActualImageScaleType(); } return null; }
private Rect calculateBounds(SharedElementTransition view) { if (view.getSharedView() instanceof ReactImageView) { return new Rect(0, 0, view.getSharedView().getWidth(), view.getSharedView().getHeight()); } return null; }
public static void disableReactImageViewRemoteImageFadeInAnimation(ReactImageView reactImageView) { reactImageView.setFadeDuration(0); ReflectionUtils.setField(reactImageView, "mIsDirty", true); reactImageView.maybeUpdateView(); }