@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) ); }
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); }
@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"); }
@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"); }
@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"); }
@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"); }
@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(); }
@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) ); }
@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(); }
@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()) ); }
@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(); }
@Nullable @Override public Map<String, Integer> getCommandsMap() { return MapBuilder.of( ReceiveEventTypes.ANIMATE, ReceiveEventTypes.ANIMATE_CODE ); }
@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) ); }
public @Nullable Map getExportedCustomDirectEventTypeConstants() { return MapBuilder.of( "onLoadError", MapBuilder.of("registrationName", "onLoadError"), "onLoadSuccess", MapBuilder.of("registrationName", "onLoadSuccess") ); }
@Nullable @Override public Map<String, Object> getExportedCustomBubblingEventTypeConstants() { return MapBuilder.<String, Object>builder() .put("topOffsetChanged", MapBuilder.of( "phasedRegistrationNames", MapBuilder.of( "bubbled", "onOffsetChanged", "captured", "onOffsetChangedCapture"))) .build(); }
@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(); }
@Override public Map<String,Integer> getCommandsMap() { return MapBuilder.of( "REVEAL", COMMAND_REVEAL, "HIDE", COMMAND_HIDE); }
@Nullable @Override public Map<String, Integer> getCommandsMap() { return MapBuilder.of( "clearSketch", COMMAND_CLEAR_SKETCH, "saveSketch", COMMAND_SAVE_SKETCH, "changeTool", COMMAND_CHANGE_TOOL); }
@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 ); }
@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(); }
@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(); }
@Override public @Nullable Map<String, Integer> getCommandsMap () { return MapBuilder.of( "goBack", GO_BACK, "goForward", GO_FORWARD, "reload", RELOAD, "postMessage", POST_MESSAGE ); }
@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") ); }
@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(); }
@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)); }
@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")); }
@Nullable @Override public Map<String, Object> getExportedViewConstants() { return MapBuilder.<String, Object>of( "SIZE", MapBuilder.of("DEFAULT", SwipeRefreshLayout.DEFAULT, "LARGE", SwipeRefreshLayout.LARGE)); }