move ViewManager addition out of FlatUIImplementation
Reviewed By: achen1 Differential Revision: D4467400 fbshipit-source-id: 3027c1d4a2ccc691d474c0c06e61b47475e6bff7
This commit is contained in:
parent
5c7009d147
commit
9615d3bdb5
|
@ -16,7 +16,7 @@ import com.facebook.react.uimanager.BaseViewManager;
|
|||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.views.art.ARTSurfaceView;
|
||||
|
||||
/* protected */ class FlatARTSurfaceViewManager extends
|
||||
public class FlatARTSurfaceViewManager extends
|
||||
BaseViewManager<ARTSurfaceView, FlatARTSurfaceViewShadowNode> {
|
||||
|
||||
private static final String REACT_CLASS = "ARTSurfaceView";
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.react.flat;
|
||||
|
||||
/**
|
||||
* Holds global flag for enabling nodes.
|
||||
*/
|
||||
public class FlatUI {
|
||||
|
||||
public static boolean sEnabled;
|
||||
}
|
|
@ -11,7 +11,6 @@ package com.facebook.react.flat;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -52,18 +51,6 @@ public class FlatUIImplementation extends UIImplementation {
|
|||
|
||||
TypefaceCache.setAssetManager(reactContext.getAssets());
|
||||
|
||||
viewManagers = new ArrayList<>(viewManagers);
|
||||
viewManagers.add(new RCTViewManager());
|
||||
viewManagers.add(new RCTTextManager());
|
||||
viewManagers.add(new RCTRawTextManager());
|
||||
viewManagers.add(new RCTVirtualTextManager());
|
||||
viewManagers.add(new RCTTextInlineImageManager());
|
||||
viewManagers.add(new RCTImageViewManager());
|
||||
viewManagers.add(new RCTTextInputManager());
|
||||
viewManagers.add(new RCTViewPagerManager());
|
||||
viewManagers.add(new FlatARTSurfaceViewManager());
|
||||
viewManagers.add(new RCTModalHostManager());
|
||||
|
||||
ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(viewManagers);
|
||||
FlatNativeViewHierarchyManager nativeViewHierarchyManager = new FlatNativeViewHierarchyManager(
|
||||
viewManagerRegistry);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
package com.facebook.react.flat;
|
||||
|
||||
/* package */ final class RCTImageViewManager extends FlatViewManager {
|
||||
public final class RCTImageViewManager extends FlatViewManager {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -12,7 +12,7 @@ package com.facebook.react.flat;
|
|||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.views.modal.ReactModalHostManager;
|
||||
|
||||
/* package */ class RCTModalHostManager extends ReactModalHostManager {
|
||||
public class RCTModalHostManager extends ReactModalHostManager {
|
||||
|
||||
@Override
|
||||
public LayoutShadowNode createShadowNodeInstance() {
|
||||
|
|
|
@ -12,7 +12,7 @@ package com.facebook.react.flat;
|
|||
/**
|
||||
* ViewManager that creates instances of RCTRawText.
|
||||
*/
|
||||
/* package */ final class RCTRawTextManager extends VirtualViewManager<RCTRawText> {
|
||||
public final class RCTRawTextManager extends VirtualViewManager<RCTRawText> {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -12,7 +12,7 @@ package com.facebook.react.flat;
|
|||
/**
|
||||
* ViewManager that creates instances of RCTTextInlineImage.
|
||||
*/
|
||||
/* package */ final class RCTTextInlineImageManager extends VirtualViewManager<RCTTextInlineImage> {
|
||||
public final class RCTTextInlineImageManager extends VirtualViewManager<RCTTextInlineImage> {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -11,7 +11,7 @@ package com.facebook.react.flat;
|
|||
|
||||
import com.facebook.react.views.textinput.ReactTextInputManager;
|
||||
|
||||
/* package */ class RCTTextInputManager extends ReactTextInputManager {
|
||||
public class RCTTextInputManager extends ReactTextInputManager {
|
||||
|
||||
@Override
|
||||
public RCTTextInput createShadowNodeInstance() {
|
||||
|
|
|
@ -12,7 +12,7 @@ package com.facebook.react.flat;
|
|||
/**
|
||||
* ViewManager that creates instances of RCTText.
|
||||
*/
|
||||
/* package */ final class RCTTextManager extends FlatViewManager {
|
||||
public final class RCTTextManager extends FlatViewManager {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.facebook.react.views.view.ReactDrawableHelper;
|
|||
/**
|
||||
* ViewManager that creates instances of RCTView.
|
||||
*/
|
||||
/* package */ final class RCTViewManager extends FlatViewManager {
|
||||
public final class RCTViewManager extends FlatViewManager {
|
||||
|
||||
private static final int[] TMP_INT_ARRAY = new int[2];
|
||||
|
||||
|
@ -39,7 +39,7 @@ import com.facebook.react.views.view.ReactDrawableHelper;
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RCTView";
|
||||
return ViewProps.VIEW_CLASS_NAME;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getCommandsMap() {
|
||||
|
|
|
@ -16,7 +16,7 @@ import android.view.View;
|
|||
import com.facebook.react.views.viewpager.ReactViewPager;
|
||||
import com.facebook.react.views.viewpager.ReactViewPagerManager;
|
||||
|
||||
/* package */ class RCTViewPagerManager extends ReactViewPagerManager {
|
||||
public class RCTViewPagerManager extends ReactViewPagerManager {
|
||||
|
||||
@Override
|
||||
public void addViews(ReactViewPager parent, List<View> views) {
|
||||
|
|
|
@ -12,7 +12,7 @@ package com.facebook.react.flat;
|
|||
/**
|
||||
* ViewManager that creates instances of RCTVirtualText.
|
||||
*/
|
||||
/* package */ final class RCTVirtualTextManager extends VirtualViewManager<RCTVirtualText> {
|
||||
public final class RCTVirtualTextManager extends VirtualViewManager<RCTVirtualText> {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -14,6 +14,7 @@ android_library(
|
|||
react_native_target('java/com/facebook/react/bridge:bridge'),
|
||||
react_native_target('java/com/facebook/react/common:common'),
|
||||
react_native_target('java/com/facebook/react/devsupport:devsupport'),
|
||||
react_native_target('java/com/facebook/react/flat:flat'),
|
||||
react_native_target('java/com/facebook/react/module/model:model'),
|
||||
react_native_target('java/com/facebook/react/modules/appstate:appstate'),
|
||||
react_native_target('java/com/facebook/react/modules/camera:camera'),
|
||||
|
@ -62,4 +63,3 @@ android_library(
|
|||
'PUBLIC',
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -11,16 +11,30 @@ package com.facebook.react.shell;
|
|||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.facebook.react.LazyReactPackage;
|
||||
import com.facebook.react.animated.NativeAnimatedModule;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.ModuleSpec;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.flat.FlatARTSurfaceViewManager;
|
||||
import com.facebook.react.flat.RCTImageViewManager;
|
||||
import com.facebook.react.flat.RCTModalHostManager;
|
||||
import com.facebook.react.flat.RCTRawTextManager;
|
||||
import com.facebook.react.flat.RCTTextInlineImageManager;
|
||||
import com.facebook.react.flat.RCTTextInputManager;
|
||||
import com.facebook.react.flat.RCTTextManager;
|
||||
import com.facebook.react.flat.RCTViewManager;
|
||||
import com.facebook.react.flat.RCTViewPagerManager;
|
||||
import com.facebook.react.flat.RCTVirtualTextManager;
|
||||
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
||||
import com.facebook.react.modules.appstate.AppStateModule;
|
||||
import com.facebook.react.modules.camera.CameraRollManager;
|
||||
|
@ -236,32 +250,50 @@ public class MainReactPackage extends LazyReactPackage {
|
|||
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||
return Arrays.<ViewManager>asList(
|
||||
ARTRenderableViewManager.createARTGroupViewManager(),
|
||||
ARTRenderableViewManager.createARTShapeViewManager(),
|
||||
ARTRenderableViewManager.createARTTextViewManager(),
|
||||
new ARTSurfaceViewManager(),
|
||||
new ReactDialogPickerManager(),
|
||||
new ReactDrawerLayoutManager(),
|
||||
new ReactDropdownPickerManager(),
|
||||
new ReactHorizontalScrollViewManager(),
|
||||
new ReactImageManager(),
|
||||
new ReactModalHostManager(),
|
||||
new ReactProgressBarViewManager(),
|
||||
new ReactRawTextManager(),
|
||||
new ReactScrollViewManager(),
|
||||
new ReactSliderManager(),
|
||||
new ReactSwitchManager(),
|
||||
new FrescoBasedReactTextInlineImageViewManager(),
|
||||
new ReactTextInputManager(),
|
||||
new ReactTextViewManager(),
|
||||
new ReactToolbarManager(),
|
||||
new ReactViewManager(),
|
||||
new ReactViewPagerManager(),
|
||||
new ReactVirtualTextViewManager(),
|
||||
new ReactWebViewManager(),
|
||||
new RecyclerViewBackedScrollViewManager(),
|
||||
new SwipeRefreshLayoutManager());
|
||||
List<ViewManager> viewManagers = new ArrayList<>();
|
||||
|
||||
viewManagers.add(ARTRenderableViewManager.createARTGroupViewManager());
|
||||
viewManagers.add(ARTRenderableViewManager.createARTShapeViewManager());
|
||||
viewManagers.add(ARTRenderableViewManager.createARTTextViewManager());
|
||||
viewManagers.add(new ARTSurfaceViewManager());
|
||||
viewManagers.add(new ReactDialogPickerManager());
|
||||
viewManagers.add(new ReactDrawerLayoutManager());
|
||||
viewManagers.add(new ReactDropdownPickerManager());
|
||||
viewManagers.add(new ReactHorizontalScrollViewManager());
|
||||
viewManagers.add(new ReactImageManager());
|
||||
viewManagers.add(new ReactModalHostManager());
|
||||
viewManagers.add(new ReactProgressBarViewManager());
|
||||
viewManagers.add(new ReactRawTextManager());
|
||||
viewManagers.add(new ReactScrollViewManager());
|
||||
viewManagers.add(new ReactSliderManager());
|
||||
viewManagers.add(new ReactSwitchManager());
|
||||
viewManagers.add(new FrescoBasedReactTextInlineImageViewManager());
|
||||
viewManagers.add(new ReactTextInputManager());
|
||||
viewManagers.add(new ReactTextViewManager());
|
||||
viewManagers.add(new ReactToolbarManager());
|
||||
viewManagers.add(new ReactViewManager());
|
||||
viewManagers.add(new ReactViewPagerManager());
|
||||
viewManagers.add(new ReactVirtualTextViewManager());
|
||||
viewManagers.add(new ReactWebViewManager());
|
||||
viewManagers.add(new RecyclerViewBackedScrollViewManager());
|
||||
viewManagers.add(new SwipeRefreshLayoutManager());
|
||||
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(reactContext);
|
||||
if (preferences.getBoolean("flat_uiimplementation", false)) {
|
||||
viewManagers.addAll(Arrays.asList(
|
||||
new RCTViewManager(),
|
||||
new RCTTextManager(),
|
||||
new RCTRawTextManager(),
|
||||
new RCTVirtualTextManager(),
|
||||
new RCTTextInlineImageManager(),
|
||||
new RCTImageViewManager(),
|
||||
new RCTTextInputManager(),
|
||||
new RCTViewPagerManager(),
|
||||
new FlatARTSurfaceViewManager(),
|
||||
new RCTModalHostManager()));
|
||||
}
|
||||
|
||||
return viewManagers;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue