List of usage examples for com.facebook.react.views.image ImageLoadEvent ON_LOAD
int ON_LOAD
To view the source code for com.facebook.react.views.image ImageLoadEvent ON_LOAD.
Click Source Link
From source file:com.reactImageWand.RNImageWand.java
License:Open Source License
public void setShouldNotifyLoadEvents(boolean shouldNotify) { if (!shouldNotify) { mControllerListener = null;/*from w ww . j av a 2 s .com*/ } else { final EventDispatcher mEventDispatcher = ((ReactContext) getContext()) .getNativeModule(UIManagerModule.class).getEventDispatcher(); mControllerListener = new BaseControllerListener<ImageInfo>() { @Override public void onSubmit(String id, Object callerContext) { mEventDispatcher.dispatchEvent( new ImageLoadEvent(getId(), SystemClock.uptimeMillis(), ImageLoadEvent.ON_LOAD_START)); } @Override public void onFinalImageSet(String id, @Nullable final ImageInfo imageInfo, @Nullable Animatable animatable) { if (imageInfo != null) { onImageInfo(imageInfo.getWidth(), imageInfo.getHeight()); mEventDispatcher.dispatchEvent(new ImageLoadEvent(getId(), SystemClock.uptimeMillis(), ImageLoadEvent.ON_LOAD_END)); mEventDispatcher.dispatchEvent( new ImageLoadEvent(getId(), SystemClock.uptimeMillis(), ImageLoadEvent.ON_LOAD)); } } @Override public void onFailure(String id, Throwable throwable) { mEventDispatcher.dispatchEvent( new ImageLoadEvent(getId(), SystemClock.uptimeMillis(), ImageLoadEvent.ON_LOAD_END)); } }; } mIsDirty = true; }