Java 类com.facebook.react.common.MapBuilder 实例源码

项目:react-native-fast-image    文件:FastImageViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    return MapBuilder.of(
            REACT_ON_LOAD_START_EVENT,
            MapBuilder.of("registrationName", REACT_ON_LOAD_START_EVENT),
            REACT_ON_PROGRESS_EVENT,
            MapBuilder.of("registrationName", REACT_ON_PROGRESS_EVENT),
            REACT_ON_LOAD_EVENT,
            MapBuilder.of("registrationName", REACT_ON_LOAD_EVENT),
            REACT_ON_ERROR_EVENT,
            MapBuilder.of("registrationName", REACT_ON_ERROR_EVENT),
            REACT_ON_LOAD_END_EVENT,
            MapBuilder.of("registrationName", REACT_ON_LOAD_END_EVENT)
    );
}
项目:RNLearn_Project1    文件:ReactQueueConfigurationImpl.java   
public static ReactQueueConfigurationImpl create(
    ReactQueueConfigurationSpec spec,
    QueueThreadExceptionHandler exceptionHandler) {
  Map<MessageQueueThreadSpec, MessageQueueThreadImpl> specsToThreads = MapBuilder.newHashMap();

  MessageQueueThreadSpec uiThreadSpec = MessageQueueThreadSpec.mainThreadSpec();
  MessageQueueThreadImpl uiThread =
    MessageQueueThreadImpl.create( uiThreadSpec, exceptionHandler);
  specsToThreads.put(uiThreadSpec, uiThread);

  MessageQueueThreadImpl jsThread = specsToThreads.get(spec.getJSQueueThreadSpec());
  if (jsThread == null) {
    jsThread = MessageQueueThreadImpl.create(spec.getJSQueueThreadSpec(), exceptionHandler);
  }

  MessageQueueThreadImpl nativeModulesThread =
      specsToThreads.get(spec.getNativeModulesQueueThreadSpec());
  if (nativeModulesThread == null) {
    nativeModulesThread =
        MessageQueueThreadImpl.create(spec.getNativeModulesQueueThreadSpec(), exceptionHandler);
  }

  return new ReactQueueConfigurationImpl(uiThread, nativeModulesThread, jsThread);
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testCustomBubblingEvents() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getExportedCustomBubblingEventTypeConstants())
      .thenReturn(MapBuilder.of("onTwirl", TWIRL_BUBBLING_EVENT_MAP));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat((Map) constants.get(CUSTOM_BUBBLING_EVENT_TYPES))
      .contains(MapEntry.entry("onTwirl", TWIRL_BUBBLING_EVENT_MAP))
      .containsKey("topChange");
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testCustomDirectEvents() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getExportedCustomDirectEventTypeConstants())
      .thenReturn(MapBuilder.of("onTwirl", TWIRL_DIRECT_EVENT_MAP));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES))
      .contains(MapEntry.entry("onTwirl", TWIRL_DIRECT_EVENT_MAP))
      .containsKey("topLoadingStart");
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testCustomViewConstants() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getName()).thenReturn("RedPandaPhotoOfTheDayView");
  when(mockViewManager.getExportedViewConstants())
      .thenReturn(MapBuilder.of("PhotoSizeType", MapBuilder.of("Small", 1, "Large", 2)));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat(constants).containsKey("RedPandaPhotoOfTheDayView");
  assertThat((Map) constants.get("RedPandaPhotoOfTheDayView")).containsKey("Constants");
  assertThat((Map) valueAtPath(constants, "RedPandaPhotoOfTheDayView", "Constants"))
      .containsKey("PhotoSizeType");
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testNativeProps() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getName()).thenReturn("SomeView");
  when(mockViewManager.getNativeProps())
      .thenReturn(MapBuilder.of("fooProp", "number"));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat((String) valueAtPath(constants, "SomeView", "NativeProps", "fooProp"))
      .isEqualTo("number");
}
项目:RNLearn_Project1    文件:ReactQueueConfigurationImpl.java   
public static ReactQueueConfigurationImpl create(
    ReactQueueConfigurationSpec spec,
    QueueThreadExceptionHandler exceptionHandler) {
  Map<MessageQueueThreadSpec, MessageQueueThreadImpl> specsToThreads = MapBuilder.newHashMap();

  MessageQueueThreadSpec uiThreadSpec = MessageQueueThreadSpec.mainThreadSpec();
  MessageQueueThreadImpl uiThread =
    MessageQueueThreadImpl.create( uiThreadSpec, exceptionHandler);
  specsToThreads.put(uiThreadSpec, uiThread);

  MessageQueueThreadImpl jsThread = specsToThreads.get(spec.getJSQueueThreadSpec());
  if (jsThread == null) {
    jsThread = MessageQueueThreadImpl.create(spec.getJSQueueThreadSpec(), exceptionHandler);
  }

  MessageQueueThreadImpl nativeModulesThread =
      specsToThreads.get(spec.getNativeModulesQueueThreadSpec());
  if (nativeModulesThread == null) {
    nativeModulesThread =
        MessageQueueThreadImpl.create(spec.getNativeModulesQueueThreadSpec(), exceptionHandler);
  }

  return new ReactQueueConfigurationImpl(uiThread, nativeModulesThread, jsThread);
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testCustomBubblingEvents() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getExportedCustomBubblingEventTypeConstants())
      .thenReturn(MapBuilder.of("onTwirl", TWIRL_BUBBLING_EVENT_MAP));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat((Map) constants.get(CUSTOM_BUBBLING_EVENT_TYPES))
      .contains(MapEntry.entry("onTwirl", TWIRL_BUBBLING_EVENT_MAP))
      .containsKey("topChange");
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testCustomDirectEvents() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getExportedCustomDirectEventTypeConstants())
      .thenReturn(MapBuilder.of("onTwirl", TWIRL_DIRECT_EVENT_MAP));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES))
      .contains(MapEntry.entry("onTwirl", TWIRL_DIRECT_EVENT_MAP))
      .containsKey("topLoadingStart");
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testCustomViewConstants() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getName()).thenReturn("RedPandaPhotoOfTheDayView");
  when(mockViewManager.getExportedViewConstants())
      .thenReturn(MapBuilder.of("PhotoSizeType", MapBuilder.of("Small", 1, "Large", 2)));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat(constants).containsKey("RedPandaPhotoOfTheDayView");
  assertThat((Map) constants.get("RedPandaPhotoOfTheDayView")).containsKey("Constants");
  assertThat((Map) valueAtPath(constants, "RedPandaPhotoOfTheDayView", "Constants"))
      .containsKey("PhotoSizeType");
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Test
public void testNativeProps() {
  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getName()).thenReturn("SomeView");
  when(mockViewManager.getNativeProps())
      .thenReturn(MapBuilder.of("fooProp", "number"));
  UIManagerModule uiManagerModule = new UIManagerModule(
    mReactContext,
    viewManagers,
    mUIImplementationProvider,
    false);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat((String) valueAtPath(constants, "SomeView", "NativeProps", "fooProp"))
      .isEqualTo("number");
}
项目:react-native-videoplayer    文件:ReactExoplayerViewManager.java   
@Override
public @Nullable Map<String, Object> getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
    for (String event : VideoEventEmitter.Events) {
        builder.put(event, MapBuilder.of("registrationName", event));
    }
    return builder.build();
}
项目:react-native-videoplayer    文件:ReactExoplayerViewManager.java   
@Override
public @Nullable Map<String, Object> getExportedViewConstants() {
    return MapBuilder.<String, Object>of(
            "ScaleNone", Integer.toString(ResizeMode.RESIZE_MODE_FIT),
            "ScaleAspectFit", Integer.toString(ResizeMode.RESIZE_MODE_FIT),
            "ScaleToFill", Integer.toString(ResizeMode.RESIZE_MODE_FILL),
            "ScaleAspectFill", Integer.toString(ResizeMode.RESIZE_MODE_CENTER_CROP)
    );
}
项目:react-native-videoplayer    文件:ReactVideoViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:react-native-videoplayer    文件:ReactVideoViewManager.java   
@Override
@Nullable
public Map getExportedViewConstants() {
    return MapBuilder.of(
            "ScaleNone", Integer.toString(ScalableType.LEFT_TOP.ordinal()),
            "ScaleToFill", Integer.toString(ScalableType.FIT_XY.ordinal()),
            "ScaleAspectFit", Integer.toString(ScalableType.FIT_CENTER.ordinal()),
            "ScaleAspectFill", Integer.toString(ScalableType.CENTER_CROP.ordinal())
    );
}
项目:react-native-extendable-image    文件:ExtendableImageManager.java   
@Nullable
@Override
public Map getExportedCustomBubblingEventTypeConstants() {
  MapBuilder.Builder<String, Map> builder = MapBuilder.builder();
  for (SendEventTypes evt : SendEventTypes.values()) {
    builder.put(evt.toString(), MapBuilder.of("registrationName", evt.toString()));
  }
  Log.d(TAG, builder.toString());
  return builder.build();
}
项目:react-native-extendable-image    文件:ExtendableImageManager.java   
@Nullable
@Override
public Map<String, Integer> getCommandsMap() {
  return MapBuilder.of(
          ReceiveEventTypes.ANIMATE,
          ReceiveEventTypes.ANIMATE_CODE
  );
}
项目:react-native-extendable-image    文件:ExtendableImageManager.java   
@Nullable
@Override
public Map getExportedViewConstants() {
  return MapBuilder.of(
          "PanCenter", Integer.toString(ExtendableImage.PAN_LIMIT_CENTER),
          "PanInside", Integer.toString(ExtendableImage.PAN_LIMIT_INSIDE),
          "PanOutside", Integer.toString(ExtendableImage.PAN_LIMIT_OUTSIDE),
          "ScaleCenterCrop", Integer.toString(ExtendableImage.SCALE_TYPE_CENTER_CROP),
          "ScaleCenterInside", Integer.toString(ExtendableImage.SCALE_TYPE_CENTER_INSIDE),
          "ScaleCustom", Integer.toString(ExtendableImage.SCALE_TYPE_CUSTOM)
  );
}
项目:react-native-twitterkit    文件:ReactTweetViewManager.java   
public @Nullable
Map getExportedCustomDirectEventTypeConstants() {
  return MapBuilder.of(
          "onLoadError", MapBuilder.of("registrationName", "onLoadError"),
          "onLoadSuccess", MapBuilder.of("registrationName", "onLoadSuccess")
  );
}
项目:react-native-collapsing-toolbar    文件:AppBarLayoutManager.java   
@Nullable
@Override
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
    return MapBuilder.<String, Object>builder()
        .put("topOffsetChanged",
            MapBuilder.of(
                "phasedRegistrationNames",
                MapBuilder.of(
                    "bubbled", "onOffsetChanged", "captured", "onOffsetChangedCapture")))
        .build();
}
项目:react-native-android-piliplayer    文件:PLVideoTextureViewManager.java   
@Override
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:react-native-android-circular-reveal    文件:CircularRevealViewManager.java   
@Override
public Map<String,Integer> getCommandsMap() {
  return MapBuilder.of(
          "REVEAL",
          COMMAND_REVEAL,
          "HIDE",
          COMMAND_HIDE);
}
项目:react-native-sketch-view    文件:RNSketchViewManager.java   
@Nullable
@Override
public Map<String, Integer> getCommandsMap() {
  return MapBuilder.of(
          "clearSketch",
          COMMAND_CLEAR_SKETCH,
          "saveSketch",
          COMMAND_SAVE_SKETCH,
          "changeTool",
          COMMAND_CHANGE_TOOL);
}
项目:react-native-recyclerview-list    文件:RecyclerViewBackedScrollViewManager.java   
@Override
public Map<String, Integer> getCommandsMap() {
    return MapBuilder.of(
        "notifyItemRangeInserted", COMMAND_NOTIFY_ITEM_RANGE_INSERTED,
        "notifyItemRangeRemoved", COMMAND_NOTIFY_ITEM_RANGE_REMOVED,
        "notifyDataSetChanged", COMMAND_NOTIFY_DATASET_CHANGED,
        "scrollToIndex", COMMAND_SCROLL_TO_INDEX
    );
}
项目:react-native-recyclerview-list    文件:RecyclerViewBackedScrollViewManager.java   
@Override
public
@Nullable
Map getExportedCustomDirectEventTypeConstants() {
    return MapBuilder.builder()
            .put(ScrollEventType.SCROLL.getJSEventName(), MapBuilder.of("registrationName", "onScroll"))
            .put(ContentSizeChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", "onContentSizeChange"))
            .put(VisibleItemsChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", "onVisibleItemsChange"))
            .build();
}
项目:react-native-pili-player    文件:PiliLiveViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:react-native-pili-player    文件:PiliPlayerViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:pili-react-native    文件:PiliPlayerViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:pili-react-native    文件:PiliStreamingViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:pili-react-native    文件:PiliAudioStreamingViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:react-native-pull-up-down-refresh    文件:RCTSwipeRefreshLayoutManager.java   
@Override
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
    return MapBuilder.<String, Object>builder()
            .put("RCTSwipeRefreshLayout.TouchMove", MapBuilder.of("registrationName", "onSwipe"))
            .put("RCTSwipeRefreshLayout.TouchUp", MapBuilder.of("registrationName", "onSwipeRefresh"))
            .build();
}
项目:react-native-android-new-crosswalk    文件:CrosswalkWebViewGroupManager.java   
@Override
public
@Nullable
Map<String, Integer> getCommandsMap () {
    return MapBuilder.of(
        "goBack", GO_BACK,
        "goForward", GO_FORWARD,
        "reload", RELOAD,
        "postMessage", POST_MESSAGE
    );
}
项目:react-native-android-new-crosswalk    文件:CrosswalkWebViewGroupManager.java   
@Override
public Map getExportedCustomDirectEventTypeConstants () {
    return MapBuilder.of(
        NavigationStateChangeEvent.EVENT_NAME,
        MapBuilder.of("registrationName", "onCrosswalkWebViewNavigationStateChange"),
        ErrorEvent.EVENT_NAME,
        MapBuilder.of("registrationName", "onCrosswalkWebViewError"),
        ProgressEvent.EVENT_NAME,
        MapBuilder.of("registrationName", "onCrosswalkWebViewProgress"),
        TopMessageEvent.EVENT_NAME,
        MapBuilder.of("registrationName", "onMessage")
    );
}
项目:react-native-pili-live    文件:PiliPlayerViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:react-native-pili-live    文件:PiliStreamingViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:react-native-pili-live    文件:PiliAudioStreamingViewManager.java   
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
    MapBuilder.Builder builder = MapBuilder.builder();
    for (Events event : Events.values()) {
        builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
    }
    return builder.build();
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@Nullable
@Override
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
  return MapBuilder.<String, Object>builder()
      .put(
          "topSubmitEditing",
          MapBuilder.of(
              "phasedRegistrationNames",
              MapBuilder.of(
                  "bubbled", "onSubmitEditing", "captured", "onSubmitEditingCapture")))
      .put(
          "topEndEditing",
          MapBuilder.of(
              "phasedRegistrationNames",
              MapBuilder.of("bubbled", "onEndEditing", "captured", "onEndEditingCapture")))
      .put(
          "topTextInput",
          MapBuilder.of(
              "phasedRegistrationNames",
              MapBuilder.of("bubbled", "onTextInput", "captured", "onTextInputCapture")))
      .put(
          "topFocus",
          MapBuilder.of(
              "phasedRegistrationNames",
              MapBuilder.of("bubbled", "onFocus", "captured", "onFocusCapture")))
      .put(
          "topBlur",
          MapBuilder.of(
              "phasedRegistrationNames",
              MapBuilder.of("bubbled", "onBlur", "captured", "onBlurCapture")))
      .build();
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@Override
public @Nullable Map getExportedViewConstants() {
  return MapBuilder.of(
      "AutoCapitalizationType",
      MapBuilder.of(
          "none",
          0,
          "characters",
          InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS,
          "words",
          InputType.TYPE_TEXT_FLAG_CAP_WORDS,
          "sentences",
          InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
}
项目:RNLearn_Project1    文件:ReactDrawerLayoutManager.java   
@Override
public @Nullable Map getExportedCustomDirectEventTypeConstants() {
  return MapBuilder.of(
      DrawerSlideEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerSlide"),
      DrawerOpenedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerOpen"),
      DrawerClosedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerClose"),
      DrawerStateChangedEvent.EVENT_NAME, MapBuilder.of(
          "registrationName", "onDrawerStateChanged"));
}
项目:RNLearn_Project1    文件:SwipeRefreshLayoutManager.java   
@Nullable
@Override
public Map<String, Object> getExportedViewConstants() {
  return MapBuilder.<String, Object>of(
      "SIZE",
      MapBuilder.of("DEFAULT", SwipeRefreshLayout.DEFAULT, "LARGE", SwipeRefreshLayout.LARGE));
}