Java 类com.facebook.react.bridge.SoftAssertions 实例源码

项目:RNLearn_Project1    文件:FlatViewGroup.java   
@Override
public int reactTagForTouch(float touchX, float touchY) {
  /*
   * Make sure we don't find any children if the pointer events are set to BOX_ONLY.
   * There is no need to special-case any other modes, because if PointerEvents are set to:
   * a) PointerEvents.AUTO - all children are included, nothing to exclude
   * b) PointerEvents.NONE - this method will NOT be executed, because the View will be filtered
   *    out by TouchTargetHelper.
   * c) PointerEvents.BOX_NONE - TouchTargetHelper will make sure that {@link #reactTagForTouch()}
   *     doesn't return getId().
   */
  SoftAssertions.assertCondition(
      mPointerEvents != PointerEvents.NONE,
      "TouchTargetHelper should not allow calling this method when pointer events are NONE");

  if (mPointerEvents != PointerEvents.BOX_ONLY) {
    NodeRegion nodeRegion = virtualNodeRegionWithinBounds(touchX, touchY);
    if (nodeRegion != null) {
      return nodeRegion.getReactTag(touchX, touchY);
    }
  }

  // no children found
  return getId();
}
项目:RNLearn_Project1    文件:UIViewOperationQueue.java   
public void addRootView(
    final int tag,
    final SizeMonitoringFrameLayout rootView,
    final ThemedReactContext themedRootContext) {
  if (UiThreadUtil.isOnUiThread()) {
    mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
  } else {
    final Semaphore semaphore = new Semaphore(0);
    mReactApplicationContext.runOnUiQueueThread(
        new Runnable() {
          @Override
          public void run() {
            mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
            semaphore.release();
          }
        });
    try {
      SoftAssertions.assertCondition(
          semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
          "Timed out adding root view");
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}
项目:RNLearn_Project1    文件:NativeViewHierarchyManager.java   
public void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder) {
  if (!blockNativeResponder) {
    mJSResponderHandler.setJSResponder(initialReactTag, null);
    return;
  }

  View view = mTagsToViews.get(reactTag);
  if (initialReactTag != reactTag && view instanceof ViewParent) {
    // In this case, initialReactTag corresponds to a virtual/layout-only View, and we already
    // have a parent of that View in reactTag, so we can use it.
    mJSResponderHandler.setJSResponder(initialReactTag, (ViewParent) view);
    return;
  }

  if (mRootTags.get(reactTag)) {
    SoftAssertions.assertUnreachable(
        "Cannot block native responder on " + reactTag + " that is a root view");
  }
  mJSResponderHandler
      .setJSResponder(initialReactTag, view.getParent());
}
项目:RNLearn_Project1    文件:ReactIntegrationTestCase.java   
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
项目:RNLearn_Project1    文件:FlatViewGroup.java   
@Override
public int reactTagForTouch(float touchX, float touchY) {
  /*
   * Make sure we don't find any children if the pointer events are set to BOX_ONLY.
   * There is no need to special-case any other modes, because if PointerEvents are set to:
   * a) PointerEvents.AUTO - all children are included, nothing to exclude
   * b) PointerEvents.NONE - this method will NOT be executed, because the View will be filtered
   *    out by TouchTargetHelper.
   * c) PointerEvents.BOX_NONE - TouchTargetHelper will make sure that {@link #reactTagForTouch()}
   *     doesn't return getId().
   */
  SoftAssertions.assertCondition(
      mPointerEvents != PointerEvents.NONE,
      "TouchTargetHelper should not allow calling this method when pointer events are NONE");

  if (mPointerEvents != PointerEvents.BOX_ONLY) {
    NodeRegion nodeRegion = virtualNodeRegionWithinBounds(touchX, touchY);
    if (nodeRegion != null) {
      return nodeRegion.getReactTag(touchX, touchY);
    }
  }

  // no children found
  return getId();
}
项目:RNLearn_Project1    文件:UIViewOperationQueue.java   
public void addRootView(
    final int tag,
    final SizeMonitoringFrameLayout rootView,
    final ThemedReactContext themedRootContext) {
  if (UiThreadUtil.isOnUiThread()) {
    mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
  } else {
    final Semaphore semaphore = new Semaphore(0);
    mReactApplicationContext.runOnUiQueueThread(
        new Runnable() {
          @Override
          public void run() {
            mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
            semaphore.release();
          }
        });
    try {
      SoftAssertions.assertCondition(
          semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
          "Timed out adding root view");
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}
项目:RNLearn_Project1    文件:NativeViewHierarchyManager.java   
public void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder) {
  if (!blockNativeResponder) {
    mJSResponderHandler.setJSResponder(initialReactTag, null);
    return;
  }

  View view = mTagsToViews.get(reactTag);
  if (initialReactTag != reactTag && view instanceof ViewParent) {
    // In this case, initialReactTag corresponds to a virtual/layout-only View, and we already
    // have a parent of that View in reactTag, so we can use it.
    mJSResponderHandler.setJSResponder(initialReactTag, (ViewParent) view);
    return;
  }

  if (mRootTags.get(reactTag)) {
    SoftAssertions.assertUnreachable(
        "Cannot block native responder on " + reactTag + " that is a root view");
  }
  mJSResponderHandler
      .setJSResponder(initialReactTag, view.getParent());
}
项目:RNLearn_Project1    文件:ReactIntegrationTestCase.java   
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
项目:ReactNativeSignatureExample    文件:UIViewOperationQueue.java   
public void addRootView(
    final int tag,
    final SizeMonitoringFrameLayout rootView,
    final ThemedReactContext themedRootContext) {
  if (UiThreadUtil.isOnUiThread()) {
    mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
  } else {
    final Semaphore semaphore = new Semaphore(0);
    mReactApplicationContext.runOnUiQueueThread(
        new Runnable() {
          @Override
          public void run() {
            mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
            semaphore.release();
          }
        });
    try {
      SoftAssertions.assertCondition(
          semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
          "Timed out adding root view");
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}
项目:ReactNativeSignatureExample    文件:NativeViewHierarchyManager.java   
public void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder) {
  if (!blockNativeResponder) {
    mJSResponderHandler.setJSResponder(initialReactTag, null);
    return;
  }

  View view = mTagsToViews.get(reactTag);
  if (initialReactTag != reactTag && view instanceof ViewParent) {
    // In this case, initialReactTag corresponds to a virtual/layout-only View, and we already
    // have a parent of that View in reactTag, so we can use it.
    mJSResponderHandler.setJSResponder(initialReactTag, (ViewParent) view);
    return;
  }

  if (mRootTags.get(reactTag)) {
    SoftAssertions.assertUnreachable(
        "Cannot block native responder on " + reactTag + " that is a root view");
  }
  mJSResponderHandler
      .setJSResponder(initialReactTag, view.getParent());
}
项目:ReactNativeSignatureExample    文件:ReactIntegrationTestCase.java   
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
项目:react-native-ibeacon-android    文件:UIViewOperationQueue.java   
public void addRootView(
    final int tag,
    final SizeMonitoringFrameLayout rootView,
    final ThemedReactContext themedRootContext) {
  if (UiThreadUtil.isOnUiThread()) {
    mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
  } else {
    final Semaphore semaphore = new Semaphore(0);
    mReactApplicationContext.runOnUiQueueThread(
        new Runnable() {
          @Override
          public void run() {
            mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
            semaphore.release();
          }
        });
    try {
      SoftAssertions.assertCondition(
          semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
          "Timed out adding root view");
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}
项目:react-native-ibeacon-android    文件:NativeViewHierarchyManager.java   
public void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder) {
  if (!blockNativeResponder) {
    mJSResponderHandler.setJSResponder(initialReactTag, null);
    return;
  }

  View view = mTagsToViews.get(reactTag);
  if (initialReactTag != reactTag && view instanceof ViewParent) {
    // In this case, initialReactTag corresponds to a virtual/layout-only View, and we already
    // have a parent of that View in reactTag, so we can use it.
    mJSResponderHandler.setJSResponder(initialReactTag, (ViewParent) view);
    return;
  }

  if (mRootTags.get(reactTag)) {
    SoftAssertions.assertUnreachable(
        "Cannot block native responder on " + reactTag + " that is a root view");
  }
  mJSResponderHandler
      .setJSResponder(initialReactTag, view.getParent());
}
项目:react-native-ibeacon-android    文件:ReactIntegrationTestCase.java   
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
项目:react-native-box-loaders    文件:UIViewOperationQueue.java   
public void addRootView(
    final int tag,
    final SizeMonitoringFrameLayout rootView,
    final ThemedReactContext themedRootContext) {
  if (UiThreadUtil.isOnUiThread()) {
    mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
  } else {
    final Semaphore semaphore = new Semaphore(0);
    mReactApplicationContext.runOnUiQueueThread(
        new Runnable() {
          @Override
          public void run() {
            mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
            semaphore.release();
          }
        });
    try {
      SoftAssertions.assertCondition(
          semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
          "Timed out adding root view");
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}
项目:react-native-box-loaders    文件:NativeViewHierarchyManager.java   
public void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder) {
  if (!blockNativeResponder) {
    mJSResponderHandler.setJSResponder(initialReactTag, null);
    return;
  }

  View view = mTagsToViews.get(reactTag);
  if (initialReactTag != reactTag && view instanceof ViewParent) {
    // In this case, initialReactTag corresponds to a virtual/layout-only View, and we already
    // have a parent of that View in reactTag, so we can use it.
    mJSResponderHandler.setJSResponder(initialReactTag, (ViewParent) view);
    return;
  }

  if (mRootTags.get(reactTag)) {
    SoftAssertions.assertUnreachable(
        "Cannot block native responder on " + reactTag + " that is a root view");
  }
  mJSResponderHandler
      .setJSResponder(initialReactTag, view.getParent());
}
项目:react-native-box-loaders    文件:ReactIntegrationTestCase.java   
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
项目:Ironman    文件:UIViewOperationQueue.java   
public void addRootView(
    final int tag,
    final SizeMonitoringFrameLayout rootView,
    final ThemedReactContext themedRootContext) {
  if (UiThreadUtil.isOnUiThread()) {
    mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
  } else {
    final Semaphore semaphore = new Semaphore(0);
    mReactApplicationContext.runOnUiQueueThread(
        new Runnable() {
          @Override
          public void run() {
            mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext);
            semaphore.release();
          }
        });
    try {
      SoftAssertions.assertCondition(
          semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
          "Timed out adding root view");
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}
项目:Ironman    文件:NativeViewHierarchyManager.java   
public void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder) {
  if (!blockNativeResponder) {
    mJSResponderHandler.setJSResponder(initialReactTag, null);
    return;
  }

  View view = mTagsToViews.get(reactTag);
  if (initialReactTag != reactTag && view instanceof ViewParent) {
    // In this case, initialReactTag corresponds to a virtual/layout-only View, and we already
    // have a parent of that View in reactTag, so we can use it.
    mJSResponderHandler.setJSResponder(initialReactTag, (ViewParent) view);
    return;
  }

  if (mRootTags.get(reactTag)) {
    SoftAssertions.assertUnreachable(
        "Cannot block native responder on " + reactTag + " that is a root view");
  }
  mJSResponderHandler
      .setJSResponder(initialReactTag, view.getParent());
}
项目:Ironman    文件:ReactIntegrationTestCase.java   
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
项目:RNLearn_Project1    文件:MessageQueueThreadImpl.java   
/**
 * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
 * {@link AssertionError}) if the assertion fails.
 */
@DoNotStrip
@Override
public void assertIsOnThread(String message) {
  SoftAssertions.assertCondition(
    isOnThread(),
    new StringBuilder().append(mAssertionErrorMessage).append(" ").append(message).toString());
}
项目:RNLearn_Project1    文件:NativeViewHierarchyManager.java   
public void removeRootView(int rootViewTag) {
  UiThreadUtil.assertOnUiThread();
  if (!mRootTags.get(rootViewTag)) {
      SoftAssertions.assertUnreachable(
          "View with tag " + rootViewTag + " is not registered as a root view");
  }
  View rootView = mTagsToViews.get(rootViewTag);
  dropView(rootView);
  mRootTags.delete(rootViewTag);
}
项目:RNLearn_Project1    文件:MessageQueueThreadImpl.java   
/**
 * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
 * {@link AssertionError}) if the assertion fails.
 */
@DoNotStrip
@Override
public void assertIsOnThread(String message) {
  SoftAssertions.assertCondition(
    isOnThread(),
    new StringBuilder().append(mAssertionErrorMessage).append(" ").append(message).toString());
}
项目:RNLearn_Project1    文件:NativeViewHierarchyManager.java   
public void removeRootView(int rootViewTag) {
  UiThreadUtil.assertOnUiThread();
  if (!mRootTags.get(rootViewTag)) {
      SoftAssertions.assertUnreachable(
          "View with tag " + rootViewTag + " is not registered as a root view");
  }
  View rootView = mTagsToViews.get(rootViewTag);
  dropView(rootView);
  mRootTags.delete(rootViewTag);
}
项目:ReactNativeSignatureExample    文件:NativeViewHierarchyManager.java   
public void removeRootView(int rootViewTag) {
  UiThreadUtil.assertOnUiThread();
  if (!mRootTags.get(rootViewTag)) {
      SoftAssertions.assertUnreachable(
          "View with tag " + rootViewTag + " is not registered as a root view");
  }
  View rootView = mTagsToViews.get(rootViewTag);
  dropView(rootView);
  mRootTags.delete(rootViewTag);
}
项目:react-native-ibeacon-android    文件:NativeViewHierarchyManager.java   
public void removeRootView(int rootViewTag) {
  UiThreadUtil.assertOnUiThread();
  if (!mRootTags.get(rootViewTag)) {
      SoftAssertions.assertUnreachable(
          "View with tag " + rootViewTag + " is not registered as a root view");
  }
  View rootView = mTagsToViews.get(rootViewTag);
  dropView(rootView);
  mRootTags.delete(rootViewTag);
}
项目:react-native-box-loaders    文件:NativeViewHierarchyManager.java   
public void removeRootView(int rootViewTag) {
  UiThreadUtil.assertOnUiThread();
  if (!mRootTags.get(rootViewTag)) {
      SoftAssertions.assertUnreachable(
          "View with tag " + rootViewTag + " is not registered as a root view");
  }
  View rootView = mTagsToViews.get(rootViewTag);
  dropView(rootView);
  mRootTags.delete(rootViewTag);
}
项目:Ironman    文件:NativeViewHierarchyManager.java   
public void removeRootView(int rootViewTag) {
  UiThreadUtil.assertOnUiThread();
  if (!mRootTags.get(rootViewTag)) {
      SoftAssertions.assertUnreachable(
          "View with tag " + rootViewTag + " is not registered as a root view");
  }
  View rootView = mTagsToViews.get(rootViewTag);
  dropView(rootView);
  mRootTags.delete(rootViewTag);
}
项目:RNLearn_Project1    文件:MessageQueueThreadImpl.java   
/**
 * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
 * {@link AssertionError}) if the assertion fails.
 */
@DoNotStrip
@Override
public void assertIsOnThread() {
  SoftAssertions.assertCondition(isOnThread(), mAssertionErrorMessage);
}
项目:RNLearn_Project1    文件:UIViewOperationQueue.java   
/**
 * Enqueues a UIOperation to be executed in UI thread. This method should only be used by a
 * subclass to support UIOperations not provided by UIViewOperationQueue.
 */
protected void enqueueUIOperation(UIOperation operation) {
  SoftAssertions.assertNotNull(operation);
  mOperations.add(operation);
}
项目:RNLearn_Project1    文件:TouchEvent.java   
private void init(
    int viewTag,
    TouchEventType touchEventType,
    MotionEvent motionEventToCopy,
    long gestureStartTime,
    float viewX,
    float viewY,
    TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper) {
  super.init(viewTag);

  SoftAssertions.assertCondition(gestureStartTime != UNSET,
      "Gesture start time must be initialized");
  short coalescingKey = 0;
  int action = (motionEventToCopy.getAction() & MotionEvent.ACTION_MASK);
  switch (action) {
    case MotionEvent.ACTION_DOWN:
      touchEventCoalescingKeyHelper.addCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_UP:
      touchEventCoalescingKeyHelper.removeCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_POINTER_DOWN:
    case MotionEvent.ACTION_POINTER_UP:
      touchEventCoalescingKeyHelper.incrementCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_MOVE:
      coalescingKey =
        touchEventCoalescingKeyHelper.getCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_CANCEL:
      touchEventCoalescingKeyHelper.removeCoalescingKey(gestureStartTime);
      break;
    default:
      throw new RuntimeException("Unhandled MotionEvent action: " + action);
  }
  mTouchEventType = touchEventType;
  mMotionEvent = MotionEvent.obtain(motionEventToCopy);
  mCoalescingKey = coalescingKey;
  mViewX = viewX;
  mViewY = viewY;
}
项目:RNLearn_Project1    文件:MessageQueueThreadImpl.java   
/**
 * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
 * {@link AssertionError}) if the assertion fails.
 */
@DoNotStrip
@Override
public void assertIsOnThread() {
  SoftAssertions.assertCondition(isOnThread(), mAssertionErrorMessage);
}
项目:RNLearn_Project1    文件:UIViewOperationQueue.java   
/**
 * Enqueues a UIOperation to be executed in UI thread. This method should only be used by a
 * subclass to support UIOperations not provided by UIViewOperationQueue.
 */
protected void enqueueUIOperation(UIOperation operation) {
  SoftAssertions.assertNotNull(operation);
  mOperations.add(operation);
}
项目:RNLearn_Project1    文件:TouchEvent.java   
private void init(
    int viewTag,
    TouchEventType touchEventType,
    MotionEvent motionEventToCopy,
    long gestureStartTime,
    float viewX,
    float viewY,
    TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper) {
  super.init(viewTag);

  SoftAssertions.assertCondition(gestureStartTime != UNSET,
      "Gesture start time must be initialized");
  short coalescingKey = 0;
  int action = (motionEventToCopy.getAction() & MotionEvent.ACTION_MASK);
  switch (action) {
    case MotionEvent.ACTION_DOWN:
      touchEventCoalescingKeyHelper.addCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_UP:
      touchEventCoalescingKeyHelper.removeCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_POINTER_DOWN:
    case MotionEvent.ACTION_POINTER_UP:
      touchEventCoalescingKeyHelper.incrementCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_MOVE:
      coalescingKey =
        touchEventCoalescingKeyHelper.getCoalescingKey(gestureStartTime);
      break;
    case MotionEvent.ACTION_CANCEL:
      touchEventCoalescingKeyHelper.removeCoalescingKey(gestureStartTime);
      break;
    default:
      throw new RuntimeException("Unhandled MotionEvent action: " + action);
  }
  mTouchEventType = touchEventType;
  mMotionEvent = MotionEvent.obtain(motionEventToCopy);
  mCoalescingKey = coalescingKey;
  mViewX = viewX;
  mViewY = viewY;
}
项目:ReactNativeSignatureExample    文件:ReactDrawableHelper.java   
public static Drawable createDrawableFromJSDescription(
    Context context,
    ReadableMap drawableDescriptionDict) {
  String type = drawableDescriptionDict.getString("type");
  if ("ThemeAttrAndroid".equals(type)) {
    String attr = drawableDescriptionDict.getString("attribute");
    SoftAssertions.assertNotNull(attr);
    int attrID = context.getResources().getIdentifier(attr, "attr", "android");
    if (attrID == 0) {
      throw new JSApplicationIllegalArgumentException("Attribute " + attr +
          " couldn't be found in the resource list");
    }
    if (context.getTheme().resolveAttribute(attrID, sResolveOutValue, true)) {
      final int version = Build.VERSION.SDK_INT;
      if (version >= 21) {
        return context.getResources()
            .getDrawable(sResolveOutValue.resourceId, context.getTheme());
      } else {
        return context.getResources().getDrawable(sResolveOutValue.resourceId);
      }
    } else {
      throw new JSApplicationIllegalArgumentException("Attribute " + attr +
          " couldn't be resolved into a drawable");
    }
  } else if ("RippleAndroid".equals(type)) {
    if (Build.VERSION.SDK_INT < 21) {
      throw new JSApplicationIllegalArgumentException("Ripple drawable is not available on " +
          "android API <21");
    }
    int color;
    if (drawableDescriptionDict.hasKey(ViewProps.COLOR) &&
        !drawableDescriptionDict.isNull(ViewProps.COLOR)) {
      color = drawableDescriptionDict.getInt(ViewProps.COLOR);
    } else {
      if (context.getTheme().resolveAttribute(
          android.R.attr.colorControlHighlight,
          sResolveOutValue,
          true)) {
        color = context.getResources().getColor(sResolveOutValue.resourceId);
      } else {
        throw new JSApplicationIllegalArgumentException("Attribute colorControlHighlight " +
            "couldn't be resolved into a drawable");
      }
    }
    Drawable mask = null;
    if (!drawableDescriptionDict.hasKey("borderless") ||
        drawableDescriptionDict.isNull("borderless") ||
        !drawableDescriptionDict.getBoolean("borderless")) {
      mask = new ColorDrawable(Color.WHITE);
    }
    ColorStateList colorStateList = new ColorStateList(
        new int[][] {new int[]{}},
        new int[] {color});
    return new RippleDrawable(colorStateList, null, mask);
  } else {
    throw new JSApplicationIllegalArgumentException(
        "Invalid type for android drawable: " + type);
  }
}
项目:ReactNativeSignatureExample    文件:MessageQueueThreadImpl.java   
/**
 * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
 * {@link AssertionError}) if the assertion fails.
 */
@DoNotStrip
@Override
public void assertIsOnThread() {
  SoftAssertions.assertCondition(isOnThread(), mAssertionErrorMessage);
}
项目:react-native-ibeacon-android    文件:ReactDrawableHelper.java   
public static Drawable createDrawableFromJSDescription(
    Context context,
    ReadableMap drawableDescriptionDict) {
  String type = drawableDescriptionDict.getString("type");
  if ("ThemeAttrAndroid".equals(type)) {
    String attr = drawableDescriptionDict.getString("attribute");
    SoftAssertions.assertNotNull(attr);
    int attrID = context.getResources().getIdentifier(attr, "attr", "android");
    if (attrID == 0) {
      throw new JSApplicationIllegalArgumentException("Attribute " + attr +
          " couldn't be found in the resource list");
    }
    if (context.getTheme().resolveAttribute(attrID, sResolveOutValue, true)) {
      final int version = Build.VERSION.SDK_INT;
      if (version >= 21) {
        return context.getResources()
            .getDrawable(sResolveOutValue.resourceId, context.getTheme());
      } else {
        return context.getResources().getDrawable(sResolveOutValue.resourceId);
      }
    } else {
      throw new JSApplicationIllegalArgumentException("Attribute " + attr +
          " couldn't be resolved into a drawable");
    }
  } else if ("RippleAndroid".equals(type)) {
    if (Build.VERSION.SDK_INT < 21) {
      throw new JSApplicationIllegalArgumentException("Ripple drawable is not available on " +
          "android API <21");
    }
    int color;
    if (drawableDescriptionDict.hasKey(ViewProps.COLOR) &&
        !drawableDescriptionDict.isNull(ViewProps.COLOR)) {
      color = drawableDescriptionDict.getInt(ViewProps.COLOR);
    } else {
      if (context.getTheme().resolveAttribute(
          android.R.attr.colorControlHighlight,
          sResolveOutValue,
          true)) {
        color = context.getResources().getColor(sResolveOutValue.resourceId);
      } else {
        throw new JSApplicationIllegalArgumentException("Attribute colorControlHighlight " +
            "couldn't be resolved into a drawable");
      }
    }
    Drawable mask = null;
    if (!drawableDescriptionDict.hasKey("borderless") ||
        drawableDescriptionDict.isNull("borderless") ||
        !drawableDescriptionDict.getBoolean("borderless")) {
      mask = new ColorDrawable(Color.WHITE);
    }
    ColorStateList colorStateList = new ColorStateList(
        new int[][] {new int[]{}},
        new int[] {color});
    return new RippleDrawable(colorStateList, null, mask);
  } else {
    throw new JSApplicationIllegalArgumentException(
        "Invalid type for android drawable: " + type);
  }
}
项目:react-native-ibeacon-android    文件:MessageQueueThreadImpl.java   
/**
 * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
 * {@link AssertionError}) if the assertion fails.
 */
@DoNotStrip
@Override
public void assertIsOnThread() {
  SoftAssertions.assertCondition(isOnThread(), mAssertionErrorMessage);
}
项目:react-native-box-loaders    文件:ReactDrawableHelper.java   
public static Drawable createDrawableFromJSDescription(
    Context context,
    ReadableMap drawableDescriptionDict) {
  String type = drawableDescriptionDict.getString("type");
  if ("ThemeAttrAndroid".equals(type)) {
    String attr = drawableDescriptionDict.getString("attribute");
    SoftAssertions.assertNotNull(attr);
    int attrID = context.getResources().getIdentifier(attr, "attr", "android");
    if (attrID == 0) {
      throw new JSApplicationIllegalArgumentException("Attribute " + attr +
          " couldn't be found in the resource list");
    }
    if (context.getTheme().resolveAttribute(attrID, sResolveOutValue, true)) {
      final int version = Build.VERSION.SDK_INT;
      if (version >= 21) {
        return context.getResources()
            .getDrawable(sResolveOutValue.resourceId, context.getTheme());
      } else {
        return context.getResources().getDrawable(sResolveOutValue.resourceId);
      }
    } else {
      throw new JSApplicationIllegalArgumentException("Attribute " + attr +
          " couldn't be resolved into a drawable");
    }
  } else if ("RippleAndroid".equals(type)) {
    if (Build.VERSION.SDK_INT < 21) {
      throw new JSApplicationIllegalArgumentException("Ripple drawable is not available on " +
          "android API <21");
    }
    int color;
    if (drawableDescriptionDict.hasKey(ViewProps.COLOR) &&
        !drawableDescriptionDict.isNull(ViewProps.COLOR)) {
      color = drawableDescriptionDict.getInt(ViewProps.COLOR);
    } else {
      if (context.getTheme().resolveAttribute(
          android.R.attr.colorControlHighlight,
          sResolveOutValue,
          true)) {
        color = context.getResources().getColor(sResolveOutValue.resourceId);
      } else {
        throw new JSApplicationIllegalArgumentException("Attribute colorControlHighlight " +
            "couldn't be resolved into a drawable");
      }
    }
    Drawable mask = null;
    if (!drawableDescriptionDict.hasKey("borderless") ||
        drawableDescriptionDict.isNull("borderless") ||
        !drawableDescriptionDict.getBoolean("borderless")) {
      mask = new ColorDrawable(Color.WHITE);
    }
    ColorStateList colorStateList = new ColorStateList(
        new int[][] {new int[]{}},
        new int[] {color});
    return new RippleDrawable(colorStateList, null, mask);
  } else {
    throw new JSApplicationIllegalArgumentException(
        "Invalid type for android drawable: " + type);
  }
}
项目:react-native-box-loaders    文件:MessageQueueThreadImpl.java   
/**
 * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
 * {@link AssertionError}) if the assertion fails.
 */
@DoNotStrip
@Override
public void assertIsOnThread() {
  SoftAssertions.assertCondition(isOnThread(), mAssertionErrorMessage);
}