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

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