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:
parent
faabeadebf
commit
da063e3d55
|
@ -16,7 +16,6 @@ import android.view.ViewGroup;
|
|||
import android.widget.EditText;
|
||||
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.testing.ReactAppInstrumentationTestCase;
|
||||
import com.facebook.react.testing.ReactInstanceSpecForTest;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
|
@ -116,7 +115,6 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
|
|||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextChangedEvent(
|
||||
reactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
newText.toString(),
|
||||
(int) PixelUtil.toDIPFromPixel(contentWidth),
|
||||
(int) PixelUtil.toDIPFromPixel(contentHeight),
|
||||
|
@ -125,7 +123,6 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
|
|||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputEvent(
|
||||
reactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
newText.toString(),
|
||||
"",
|
||||
start,
|
||||
|
@ -150,7 +147,6 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
|
|||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextChangedEvent(
|
||||
reactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
newText.toString(),
|
||||
(int) PixelUtil.toDIPFromPixel(contentWidth),
|
||||
(int) PixelUtil.toDIPFromPixel(contentHeight),
|
||||
|
@ -159,7 +155,6 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
|
|||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputEvent(
|
||||
reactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
moreText,
|
||||
"",
|
||||
start,
|
||||
|
@ -184,7 +179,6 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
|
|||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextChangedEvent(
|
||||
reactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
newText.toString(),
|
||||
(int) PixelUtil.toDIPFromPixel(contentWidth),
|
||||
(int) PixelUtil.toDIPFromPixel(contentHeight),
|
||||
|
@ -193,7 +187,6 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
|
|||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputEvent(
|
||||
reactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
moreText,
|
||||
"",
|
||||
start,
|
||||
|
|
|
@ -15,7 +15,6 @@ import android.view.ViewGroup;
|
|||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.uimanager.events.TouchEvent;
|
||||
import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper;
|
||||
|
@ -82,7 +81,6 @@ public class JSTouchDispatcher {
|
|||
eventDispatcher.dispatchEvent(
|
||||
TouchEvent.obtain(
|
||||
mTargetTag,
|
||||
SystemClock.nanoTime(),
|
||||
TouchEventType.START,
|
||||
ev,
|
||||
mTargetCoordinates[0],
|
||||
|
@ -105,7 +103,6 @@ public class JSTouchDispatcher {
|
|||
eventDispatcher.dispatchEvent(
|
||||
TouchEvent.obtain(
|
||||
mTargetTag,
|
||||
SystemClock.nanoTime(),
|
||||
TouchEventType.END,
|
||||
ev,
|
||||
mTargetCoordinates[0],
|
||||
|
@ -117,7 +114,6 @@ public class JSTouchDispatcher {
|
|||
eventDispatcher.dispatchEvent(
|
||||
TouchEvent.obtain(
|
||||
mTargetTag,
|
||||
SystemClock.nanoTime(),
|
||||
TouchEventType.MOVE,
|
||||
ev,
|
||||
mTargetCoordinates[0],
|
||||
|
@ -128,7 +124,6 @@ public class JSTouchDispatcher {
|
|||
eventDispatcher.dispatchEvent(
|
||||
TouchEvent.obtain(
|
||||
mTargetTag,
|
||||
SystemClock.nanoTime(),
|
||||
TouchEventType.START,
|
||||
ev,
|
||||
mTargetCoordinates[0],
|
||||
|
@ -139,7 +134,6 @@ public class JSTouchDispatcher {
|
|||
eventDispatcher.dispatchEvent(
|
||||
TouchEvent.obtain(
|
||||
mTargetTag,
|
||||
SystemClock.nanoTime(),
|
||||
TouchEventType.END,
|
||||
ev,
|
||||
mTargetCoordinates[0],
|
||||
|
@ -180,7 +174,6 @@ public class JSTouchDispatcher {
|
|||
Assertions.assertNotNull(eventDispatcher).dispatchEvent(
|
||||
TouchEvent.obtain(
|
||||
mTargetTag,
|
||||
SystemClock.nanoTime(),
|
||||
TouchEventType.CANCEL,
|
||||
androidEvent,
|
||||
mTargetCoordinates[0],
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.support.v4.util.Pools;
|
|||
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.events.Event;
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
|
||||
|
@ -45,7 +44,7 @@ public class OnLayoutEvent extends Event<OnLayoutEvent> {
|
|||
}
|
||||
|
||||
protected void init(int viewTag, int x, int y, int width, int height) {
|
||||
super.init(viewTag, SystemClock.nanoTime());
|
||||
super.init(viewTag);
|
||||
mX = x;
|
||||
mY = y;
|
||||
mWidth = width;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
package com.facebook.react.uimanager.events;
|
||||
|
||||
import com.facebook.react.common.SystemClock;
|
||||
|
||||
/**
|
||||
* A UI event that can be dispatched to JS.
|
||||
*
|
||||
|
@ -28,16 +30,16 @@ public abstract class Event<T extends Event> {
|
|||
protected Event() {
|
||||
}
|
||||
|
||||
protected Event(int viewTag, long timestampMs) {
|
||||
init(viewTag, timestampMs);
|
||||
protected Event(int viewTag) {
|
||||
init(viewTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method needs to be called before event is sent to event dispatcher.
|
||||
*/
|
||||
protected void init(int viewTag, long timestampMs) {
|
||||
protected void init(int viewTag) {
|
||||
mViewTag = viewTag;
|
||||
mTimestampMs = timestampMs;
|
||||
mTimestampMs = SystemClock.nanoTime();
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ public class TouchEvent extends Event<TouchEvent> {
|
|||
|
||||
public static TouchEvent obtain(
|
||||
int viewTag,
|
||||
long timestampMs,
|
||||
TouchEventType touchEventType,
|
||||
MotionEvent motionEventToCopy,
|
||||
float viewX,
|
||||
|
@ -45,7 +44,6 @@ public class TouchEvent extends Event<TouchEvent> {
|
|||
}
|
||||
event.init(
|
||||
viewTag,
|
||||
timestampMs,
|
||||
touchEventType,
|
||||
motionEventToCopy,
|
||||
viewX,
|
||||
|
@ -67,13 +65,12 @@ public class TouchEvent extends Event<TouchEvent> {
|
|||
|
||||
private void init(
|
||||
int viewTag,
|
||||
long timestampMs,
|
||||
TouchEventType touchEventType,
|
||||
MotionEvent motionEventToCopy,
|
||||
float viewX,
|
||||
float viewY,
|
||||
TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper) {
|
||||
super.init(viewTag, timestampMs);
|
||||
super.init(viewTag);
|
||||
|
||||
short coalescingKey = 0;
|
||||
int action = (motionEventToCopy.getAction() & MotionEvent.ACTION_MASK);
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
|||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
|
@ -188,25 +187,25 @@ public class ReactDrawerLayoutManager extends ViewGroupManager<ReactDrawerLayout
|
|||
@Override
|
||||
public void onDrawerSlide(View view, float v) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new DrawerSlideEvent(mDrawerLayout.getId(), SystemClock.nanoTime(), v));
|
||||
new DrawerSlideEvent(mDrawerLayout.getId(), v));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerOpened(View view) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new DrawerOpenedEvent(mDrawerLayout.getId(), SystemClock.nanoTime()));
|
||||
new DrawerOpenedEvent(mDrawerLayout.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerClosed(View view) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new DrawerClosedEvent(mDrawerLayout.getId(), SystemClock.nanoTime()));
|
||||
new DrawerClosedEvent(mDrawerLayout.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerStateChanged(int i) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new DrawerStateChangedEvent(mDrawerLayout.getId(), SystemClock.nanoTime(), i));
|
||||
new DrawerStateChangedEvent(mDrawerLayout.getId(), i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ public class DrawerClosedEvent extends Event<DrawerClosedEvent> {
|
|||
|
||||
public static final String EVENT_NAME = "topDrawerClosed";
|
||||
|
||||
public DrawerClosedEvent(int viewId, long timestampMs) {
|
||||
super(viewId, timestampMs);
|
||||
public DrawerClosedEvent(int viewId) {
|
||||
super(viewId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,8 +17,8 @@ public class DrawerOpenedEvent extends Event<DrawerOpenedEvent> {
|
|||
|
||||
public static final String EVENT_NAME = "topDrawerOpened";
|
||||
|
||||
public DrawerOpenedEvent(int viewId, long timestampMs) {
|
||||
super(viewId, timestampMs);
|
||||
public DrawerOpenedEvent(int viewId) {
|
||||
super(viewId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,8 +23,8 @@ public class DrawerSlideEvent extends Event<DrawerSlideEvent> {
|
|||
|
||||
private final float mOffset;
|
||||
|
||||
public DrawerSlideEvent(int viewId, long timestampMs, float offset) {
|
||||
super(viewId, timestampMs);
|
||||
public DrawerSlideEvent(int viewId, float offset) {
|
||||
super(viewId);
|
||||
mOffset = offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ public class DrawerStateChangedEvent extends Event<DrawerStateChangedEvent> {
|
|||
|
||||
private final int mDrawerState;
|
||||
|
||||
public DrawerStateChangedEvent(int viewId, long timestampMs, int drawerState) {
|
||||
super(viewId, timestampMs);
|
||||
public DrawerStateChangedEvent(int viewId, int drawerState) {
|
||||
super(viewId);
|
||||
mDrawerState = drawerState;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import android.content.DialogInterface;
|
|||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
|
@ -85,14 +84,14 @@ public class ReactModalHostManager extends ViewGroupManager<ReactModalHostView>
|
|||
new ReactModalHostView.OnRequestCloseListener() {
|
||||
@Override
|
||||
public void onRequestClose(DialogInterface dialog) {
|
||||
dispatcher.dispatchEvent(new RequestCloseEvent(view.getId(), SystemClock.nanoTime()));
|
||||
dispatcher.dispatchEvent(new RequestCloseEvent(view.getId()));
|
||||
}
|
||||
});
|
||||
view.setOnShowListener(
|
||||
new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
dispatcher.dispatchEvent(new ShowEvent(view.getId(), SystemClock.nanoTime()));
|
||||
dispatcher.dispatchEvent(new ShowEvent(view.getId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
public static final String EVENT_NAME = "topRequestClose";
|
||||
|
||||
protected RequestCloseEvent(int viewTag, long timestampMs) {
|
||||
super(viewTag, timestampMs);
|
||||
protected RequestCloseEvent(int viewTag) {
|
||||
super(viewTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,8 +19,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
public static final String EVENT_NAME = "topShow";
|
||||
|
||||
protected ShowEvent(int viewTag, long timestampMs) {
|
||||
super(viewTag, timestampMs);
|
||||
protected ShowEvent(int viewTag) {
|
||||
super(viewTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ import android.widget.TextView;
|
|||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
|
@ -157,7 +156,7 @@ public abstract class ReactPickerManager extends SimpleViewManager<ReactPicker>
|
|||
@Override
|
||||
public void onItemSelected(int position) {
|
||||
mEventDispatcher.dispatchEvent( new PickerItemSelectEvent(
|
||||
mReactPicker.getId(), SystemClock.nanoTime(), position));
|
||||
mReactPicker.getId(), position));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ public class PickerItemSelectEvent extends Event<PickerItemSelectEvent> {
|
|||
|
||||
private final int mPosition;
|
||||
|
||||
public PickerItemSelectEvent(int id, long uptimeMillis, int position) {
|
||||
super(id, uptimeMillis);
|
||||
public PickerItemSelectEvent(int id, int position) {
|
||||
super(id);
|
||||
mPosition = position;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ public class ContentSizeChangeEvent extends Event<ContentSizeChangeEvent> {
|
|||
private final int mWidth;
|
||||
private final int mHeight;
|
||||
|
||||
public ContentSizeChangeEvent(int viewTag, long timestampMs, int width, int height) {
|
||||
super(viewTag, timestampMs);
|
||||
public ContentSizeChangeEvent(int viewTag, int width, int height) {
|
||||
super(viewTag);
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import android.view.ViewGroup;
|
|||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.NativeGestureUtil;
|
||||
|
@ -344,7 +343,6 @@ public class RecyclerViewBackedScrollView extends RecyclerView {
|
|||
((ReactContext) getContext()).getNativeModule(UIManagerModule.class).getEventDispatcher()
|
||||
.dispatchEvent(ScrollEvent.obtain(
|
||||
getId(),
|
||||
SystemClock.nanoTime(),
|
||||
ScrollEventType.SCROLL,
|
||||
0, /* offsetX = 0, horizontal scrolling only */
|
||||
calculateAbsoluteOffset(),
|
||||
|
@ -359,7 +357,6 @@ public class RecyclerViewBackedScrollView extends RecyclerView {
|
|||
((ReactContext) getContext()).getNativeModule(UIManagerModule.class).getEventDispatcher()
|
||||
.dispatchEvent(new ContentSizeChangeEvent(
|
||||
getId(),
|
||||
SystemClock.nanoTime(),
|
||||
getWidth(),
|
||||
newTotalChildrenHeight));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
|
||||
/**
|
||||
|
@ -57,7 +56,6 @@ public class ReactScrollViewHelper {
|
|||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
ScrollEvent.obtain(
|
||||
scrollView.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
scrollEventType,
|
||||
scrollView.getScrollX(),
|
||||
scrollView.getScrollY(),
|
||||
|
|
|
@ -40,7 +40,6 @@ public class ScrollEvent extends Event<ScrollEvent> {
|
|||
|
||||
public static ScrollEvent obtain(
|
||||
int viewTag,
|
||||
long timestampMs,
|
||||
ScrollEventType scrollEventType,
|
||||
int scrollX,
|
||||
int scrollY,
|
||||
|
@ -54,7 +53,6 @@ public class ScrollEvent extends Event<ScrollEvent> {
|
|||
}
|
||||
event.init(
|
||||
viewTag,
|
||||
timestampMs,
|
||||
scrollEventType,
|
||||
scrollX,
|
||||
scrollY,
|
||||
|
@ -75,7 +73,6 @@ public class ScrollEvent extends Event<ScrollEvent> {
|
|||
|
||||
private void init(
|
||||
int viewTag,
|
||||
long timestampMs,
|
||||
ScrollEventType scrollEventType,
|
||||
int scrollX,
|
||||
int scrollY,
|
||||
|
@ -83,7 +80,7 @@ public class ScrollEvent extends Event<ScrollEvent> {
|
|||
int contentHeight,
|
||||
int scrollViewWidth,
|
||||
int scrollViewHeight) {
|
||||
super.init(viewTag, timestampMs);
|
||||
super.init(viewTag);
|
||||
mScrollEventType = scrollEventType;
|
||||
mScrollX = scrollX;
|
||||
mScrollY = scrollY;
|
||||
|
|
|
@ -24,8 +24,8 @@ public class ReactSliderEvent extends Event<ReactSliderEvent> {
|
|||
private final double mValue;
|
||||
private final boolean mFromUser;
|
||||
|
||||
public ReactSliderEvent(int viewId, long timestampMs, double value, boolean fromUser) {
|
||||
super(viewId, timestampMs);
|
||||
public ReactSliderEvent(int viewId, double value, boolean fromUser) {
|
||||
super(viewId);
|
||||
mValue = value;
|
||||
mFromUser = fromUser;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import com.facebook.csslayout.CSSNode;
|
|||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
|
@ -81,7 +80,6 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider> {
|
|||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
new ReactSliderEvent(
|
||||
seekbar.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
((ReactSlider)seekbar).toRealProgress(progress),
|
||||
fromUser));
|
||||
}
|
||||
|
@ -96,7 +94,6 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider> {
|
|||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
new ReactSlidingCompleteEvent(
|
||||
seekbar.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
((ReactSlider)seekbar).toRealProgress(seekbar.getProgress())));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -23,8 +23,8 @@ public class ReactSlidingCompleteEvent extends Event<ReactSlidingCompleteEvent>
|
|||
|
||||
private final double mValue;
|
||||
|
||||
public ReactSlidingCompleteEvent(int viewId, long timestampMs, double value) {
|
||||
super(viewId, timestampMs);
|
||||
public ReactSlidingCompleteEvent(int viewId, double value) {
|
||||
super(viewId);
|
||||
mValue = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
public class RefreshEvent extends Event<RefreshEvent> {
|
||||
|
||||
protected RefreshEvent(int viewTag, long timestampMs) {
|
||||
super(viewTag, timestampMs);
|
||||
protected RefreshEvent(int viewTag) {
|
||||
super(viewTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,6 @@ import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
|
|||
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewGroupManager;
|
||||
|
@ -89,7 +88,7 @@ public class SwipeRefreshLayoutManager extends ViewGroupManager<ReactSwipeRefres
|
|||
@Override
|
||||
public void onRefresh() {
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher()
|
||||
.dispatchEvent(new RefreshEvent(view.getId(), SystemClock.nanoTime()));
|
||||
.dispatchEvent(new RefreshEvent(view.getId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
private final boolean mIsChecked;
|
||||
|
||||
public ReactSwitchEvent(int viewId, long timestampMs, boolean isChecked) {
|
||||
super(viewId, timestampMs);
|
||||
public ReactSwitchEvent(int viewId, boolean isChecked) {
|
||||
super(viewId);
|
||||
mIsChecked = isChecked;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import com.facebook.csslayout.CSSMeasureMode;
|
|||
import com.facebook.csslayout.CSSNode;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
|
@ -78,7 +77,6 @@ public class ReactSwitchManager extends SimpleViewManager<ReactSwitch> {
|
|||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
new ReactSwitchEvent(
|
||||
buttonView.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
isChecked));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,10 +26,9 @@ public class ReactContentSizeChangedEvent extends Event<ReactTextChangedEvent> {
|
|||
|
||||
public ReactContentSizeChangedEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
int contentSizeWidth,
|
||||
int contentSizeHeight) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mContentWidth = contentSizeWidth;
|
||||
mContentHeight = contentSizeHeight;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,11 @@ public class ReactTextChangedEvent extends Event<ReactTextChangedEvent> {
|
|||
|
||||
public ReactTextChangedEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text,
|
||||
int contentSizeWidth,
|
||||
int contentSizeHeight,
|
||||
int eventCount) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
mContentWidth = contentSizeWidth;
|
||||
mContentHeight = contentSizeHeight;
|
||||
|
|
|
@ -21,10 +21,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
private static final String EVENT_NAME = "topBlur";
|
||||
|
||||
public ReactTextInputBlurEvent(
|
||||
int viewId,
|
||||
long timestampMs) {
|
||||
super(viewId, timestampMs);
|
||||
public ReactTextInputBlurEvent(int viewId) {
|
||||
super(viewId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,9 +26,8 @@ class ReactTextInputEndEditingEvent extends Event<ReactTextInputEndEditingEvent>
|
|||
|
||||
public ReactTextInputEndEditingEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,12 +29,11 @@ public class ReactTextInputEvent extends Event<ReactTextInputEvent> {
|
|||
|
||||
public ReactTextInputEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text,
|
||||
String previousText,
|
||||
int rangeStart,
|
||||
int rangeEnd) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
mPreviousText = previousText;
|
||||
mRangeStart = rangeStart;
|
||||
|
|
|
@ -21,10 +21,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
private static final String EVENT_NAME = "topFocus";
|
||||
|
||||
public ReactTextInputFocusEvent(
|
||||
int viewId,
|
||||
long timestampMs) {
|
||||
super(viewId, timestampMs);
|
||||
public ReactTextInputFocusEvent(int viewId) {
|
||||
super(viewId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,6 @@ import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
|||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.BaseViewManager;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
|
@ -578,7 +577,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
mEventDispatcher.dispatchEvent(
|
||||
new ReactTextChangedEvent(
|
||||
mEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
s.toString(),
|
||||
(int) PixelUtil.toDIPFromPixel(contentWidth),
|
||||
(int) PixelUtil.toDIPFromPixel(contentHeight),
|
||||
|
@ -587,7 +585,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
mEventDispatcher.dispatchEvent(
|
||||
new ReactTextInputEvent(
|
||||
mEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
newText,
|
||||
oldText,
|
||||
start,
|
||||
|
@ -612,18 +609,15 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
if (hasFocus) {
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputFocusEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime()));
|
||||
editText.getId()));
|
||||
} else {
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputBlurEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime()));
|
||||
editText.getId()));
|
||||
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputEndEditingEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
editText.getText().toString()));
|
||||
}
|
||||
}
|
||||
|
@ -641,7 +635,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputSubmitEditingEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
editText.getText().toString()));
|
||||
}
|
||||
if (actionId == EditorInfo.IME_ACTION_NEXT ||
|
||||
|
@ -688,7 +681,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
mEventDispatcher.dispatchEvent(
|
||||
new ReactContentSizeChangedEvent(
|
||||
mEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
(int) PixelUtil.toDIPFromPixel(contentWidth),
|
||||
(int) PixelUtil.toDIPFromPixel(contentHeight)));
|
||||
}
|
||||
|
@ -717,7 +709,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
mEventDispatcher.dispatchEvent(
|
||||
new ReactTextInputSelectionEvent(
|
||||
mReactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
start,
|
||||
end
|
||||
)
|
||||
|
|
|
@ -27,10 +27,9 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
public ReactTextInputSelectionEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
int selectionStart,
|
||||
int selectionEnd) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mSelectionStart = selectionStart;
|
||||
mSelectionEnd = selectionEnd;
|
||||
}
|
||||
|
|
|
@ -26,9 +26,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
public ReactTextInputSubmitEditingEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.facebook.react.R;
|
|||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
|
@ -131,7 +130,7 @@ public class ReactToolbarManager extends ViewGroupManager<ReactToolbar> {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ToolbarClickEvent(view.getId(), SystemClock.nanoTime(), -1));
|
||||
new ToolbarClickEvent(view.getId(), -1));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -142,7 +141,6 @@ public class ReactToolbarManager extends ViewGroupManager<ReactToolbar> {
|
|||
mEventDispatcher.dispatchEvent(
|
||||
new ToolbarClickEvent(
|
||||
view.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
menuItem.getOrder()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public class ToolbarClickEvent extends Event<ToolbarClickEvent> {
|
|||
private static final String EVENT_NAME = "topSelect";
|
||||
private final int position;
|
||||
|
||||
public ToolbarClickEvent(int viewId, long timestampMs, int position) {
|
||||
super(viewId, timestampMs);
|
||||
public ToolbarClickEvent(int viewId, int position) {
|
||||
super(viewId);
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
private final int mPosition;
|
||||
private final float mOffset;
|
||||
|
||||
protected PageScrollEvent(int viewTag, long timestampMs, int position, float offset) {
|
||||
super(viewTag, timestampMs);
|
||||
protected PageScrollEvent(int viewTag, int position, float offset) {
|
||||
super(viewTag);
|
||||
mPosition = position;
|
||||
mOffset = offset;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ class PageScrollStateChangedEvent extends Event<PageScrollStateChangedEvent> {
|
|||
|
||||
private final String mPageScrollState;
|
||||
|
||||
protected PageScrollStateChangedEvent(int viewTag, long timestampMs, String pageScrollState) {
|
||||
super(viewTag, timestampMs);
|
||||
protected PageScrollStateChangedEvent(int viewTag, String pageScrollState) {
|
||||
super(viewTag);
|
||||
mPageScrollState = pageScrollState;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|||
|
||||
private final int mPosition;
|
||||
|
||||
protected PageSelectedEvent(int viewTag, long timestampMs, int position) {
|
||||
super(viewTag, timestampMs);
|
||||
protected PageSelectedEvent(int viewTag, int position) {
|
||||
super(viewTag);
|
||||
mPosition = position;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.uimanager.events.NativeGestureUtil;
|
||||
|
@ -95,14 +94,14 @@ import com.facebook.react.uimanager.events.NativeGestureUtil;
|
|||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new PageScrollEvent(getId(), SystemClock.nanoTime(), position, positionOffset));
|
||||
new PageScrollEvent(getId(), position, positionOffset));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
if (!mIsCurrentItemFromJs) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new PageSelectedEvent(getId(), SystemClock.nanoTime(), position));
|
||||
new PageSelectedEvent(getId(), position));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +122,7 @@ import com.facebook.react.uimanager.events.NativeGestureUtil;
|
|||
throw new IllegalStateException("Unsupported pageScrollState");
|
||||
}
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new PageScrollStateChangedEvent(getId(), SystemClock.nanoTime(), pageScrollState));
|
||||
new PageScrollStateChangedEvent(getId(), pageScrollState));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import com.facebook.react.bridge.ReadableMap;
|
|||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
|
@ -110,7 +109,6 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
|||
webView,
|
||||
new TopLoadingStartEvent(
|
||||
webView.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
createWebViewEvent(webView, url)));
|
||||
}
|
||||
|
||||
|
@ -145,7 +143,7 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
|||
|
||||
dispatchEvent(
|
||||
webView,
|
||||
new TopLoadingErrorEvent(webView.getId(), SystemClock.nanoTime(), eventData));
|
||||
new TopLoadingErrorEvent(webView.getId(), eventData));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,7 +154,6 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
|||
webView,
|
||||
new TopLoadingStartEvent(
|
||||
webView.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
createWebViewEvent(webView, url)));
|
||||
}
|
||||
|
||||
|
@ -165,7 +162,6 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
|||
webView,
|
||||
new TopLoadingFinishEvent(
|
||||
webView.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
createWebViewEvent(webView, url)));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ public class TopLoadingErrorEvent extends Event<TopLoadingErrorEvent> {
|
|||
public static final String EVENT_NAME = "topLoadingError";
|
||||
private WritableMap mEventData;
|
||||
|
||||
public TopLoadingErrorEvent(int viewId, long timestampMs, WritableMap eventData) {
|
||||
super(viewId, timestampMs);
|
||||
public TopLoadingErrorEvent(int viewId, WritableMap eventData) {
|
||||
super(viewId);
|
||||
mEventData = eventData;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ public class TopLoadingFinishEvent extends Event<TopLoadingFinishEvent> {
|
|||
public static final String EVENT_NAME = "topLoadingFinish";
|
||||
private WritableMap mEventData;
|
||||
|
||||
public TopLoadingFinishEvent(int viewId, long timestampMs, WritableMap eventData) {
|
||||
super(viewId, timestampMs);
|
||||
public TopLoadingFinishEvent(int viewId, WritableMap eventData) {
|
||||
super(viewId);
|
||||
mEventData = eventData;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ public class TopLoadingStartEvent extends Event<TopLoadingStartEvent> {
|
|||
public static final String EVENT_NAME = "topLoadingStart";
|
||||
private WritableMap mEventData;
|
||||
|
||||
public TopLoadingStartEvent(int viewId, long timestampMs, WritableMap eventData) {
|
||||
super(viewId, timestampMs);
|
||||
public TopLoadingStartEvent(int viewId, WritableMap eventData) {
|
||||
super(viewId);
|
||||
mEventData = eventData;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue