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

@ -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,

View File

@ -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],

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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));
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

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));
}
};
}

View File

@ -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()));
}
});
}

View File

@ -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

View File

@ -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

View File

@ -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));
}
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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));
}

View File

@ -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(),

View File

@ -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;

View File

@ -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;
}

View File

@ -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())));
}
};

View File

@ -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;
}

View File

@ -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

View File

@ -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()));
}
});
}

View File

@ -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;
}

View File

@ -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));
}
};

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -26,9 +26,8 @@ class ReactTextInputEndEditingEvent extends Event<ReactTextInputEndEditingEvent>
public ReactTextInputEndEditingEvent(
int viewId,
long timestampMs,
String text) {
super(viewId, timestampMs);
super(viewId);
mText = text;
}

View File

@ -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;

View File

@ -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

View File

@ -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
)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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));
}
}

View File

@ -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)));
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}