Set Event timestamp internally

Summary: This is pure cleanup so that we can make sure that all events are living in the same time space (currently nano seconds).

Reviewed By: foghina

Differential Revision: D3593884

fbshipit-source-id: 71b084362008f1c93c21880630acf11f5c058355
This commit is contained in:
Dave Miller
2016-07-21 07:29:53 -07:00
committed by Facebook Github Bot 7
parent faabeadebf
commit da063e3d55
47 changed files with 80 additions and 141 deletions

View File

@@ -37,16 +37,15 @@ public class ImageLoadEvent extends Event<ImageLoadEvent> {
private final int mEventType;
private final @Nullable String mImageUri;
public ImageLoadEvent(int viewId, long timestampMs, @ImageEventType int eventType) {
this(viewId, timestampMs, eventType, null);
public ImageLoadEvent(int viewId, @ImageEventType int eventType) {
this(viewId, eventType, null);
}
public ImageLoadEvent(
int viewId,
long timestampMs,
@ImageEventType int eventType,
@Nullable String imageUri) {
super(viewId, timestampMs);
super(viewId);
mEventType = eventType;
mImageUri = imageUri;
}

View File

@@ -51,7 +51,6 @@ import com.facebook.imagepipeline.request.Postprocessor;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.common.SystemClock;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.events.EventDispatcher;
@@ -192,7 +191,7 @@ public class ReactImageView extends GenericDraweeView {
@Override
public void onSubmit(String id, Object callerContext) {
mEventDispatcher.dispatchEvent(
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD_START));
new ImageLoadEvent(getId(), ImageLoadEvent.ON_LOAD_START));
}
@Override
@@ -202,18 +201,18 @@ public class ReactImageView extends GenericDraweeView {
@Nullable Animatable animatable) {
if (imageInfo != null) {
mEventDispatcher.dispatchEvent(
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD));
new ImageLoadEvent(getId(), ImageLoadEvent.ON_LOAD));
mEventDispatcher.dispatchEvent(
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD_END));
new ImageLoadEvent(getId(), ImageLoadEvent.ON_LOAD_END));
}
}
@Override
public void onFailure(String id, Throwable throwable) {
mEventDispatcher.dispatchEvent(
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_ERROR));
new ImageLoadEvent(getId(), ImageLoadEvent.ON_ERROR));
mEventDispatcher.dispatchEvent(
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD_END));
new ImageLoadEvent(getId(), ImageLoadEvent.ON_LOAD_END));
}
};
}