Export latest Android changes

This commit is contained in:
Martin Konicek 2015-09-22 11:15:50 +01:00
parent daba14264c
commit 71628638f6
3 changed files with 12 additions and 5 deletions

View File

@ -22,28 +22,28 @@ public class UiThreadUtil {
@Nullable private static Handler sMainHandler;
/**
* @return whether the current thread is the UI thread.
* @return {@code true} if the current thread is the UI thread.
*/
public static boolean isOnUiThread() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}
/**
* Throws a {@link AssertionException} if the current thread is not the UI thread.
* Throws an {@link AssertionException} if the current thread is not the UI thread.
*/
public static void assertOnUiThread() {
SoftAssertions.assertCondition(isOnUiThread(), "Expected to run on UI thread!");
}
/**
* Throws a {@link AssertionException} if the current thread is the UI thread.
* Throws an {@link AssertionException} if the current thread is the UI thread.
*/
public static void assertNotOnUiThread() {
SoftAssertions.assertCondition(!isOnUiThread(), "Expected not to run on UI thread!");
}
/**
* Runs the given Runnable on the UI thread.
* Runs the given {@code Runnable} on the UI thread.
*/
public static void runOnUiThread(Runnable runnable) {
synchronized (UiThreadUtil.class) {

View File

@ -57,7 +57,7 @@ public class ExceptionsManagerModule extends BaseJavaModule {
}
@ReactMethod
public void reportSoftException(String title, ReadableArray details) {
public void reportSoftException(String title, ReadableArray details, int exceptionId) {
FLog.e(ReactConstants.TAG, title + "\n" + stackTraceToString(details));
}

View File

@ -64,6 +64,12 @@ public class ScrollEvent extends Event<ScrollEvent> {
}
private WritableMap serializeEventData() {
WritableMap contentInset = Arguments.createMap();
contentInset.putDouble("top", 0);
contentInset.putDouble("bottom", 0);
contentInset.putDouble("left", 0);
contentInset.putDouble("right", 0);
WritableMap contentOffset = Arguments.createMap();
contentOffset.putDouble("x", PixelUtil.toDIPFromPixel(mScrollX));
contentOffset.putDouble("y", PixelUtil.toDIPFromPixel(mScrollY));
@ -77,6 +83,7 @@ public class ScrollEvent extends Event<ScrollEvent> {
layoutMeasurement.putDouble("height", PixelUtil.toDIPFromPixel(mScrollViewHeight));
WritableMap event = Arguments.createMap();
event.putMap("contentInset", contentInset);
event.putMap("contentOffset", contentOffset);
event.putMap("contentSize", contentSize);
event.putMap("layoutMeasurement", layoutMeasurement);