Java 类com.facebook.react.uimanager.UIImplementationProvider 实例源码

项目:RNLearn_Project1    文件:CatalystNativeJavaToJSReturnValuesTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      new ArrayList<ViewManager>(),
      new UIImplementationProvider(),
      false);

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(TestJavaToJSReturnValuesModule.class)
      .addNativeModule(mUIManager)
      .addNativeModule(new TestModule())
      .build();
}
项目:RNLearn_Project1    文件:CatalystNativeJavaToJSReturnValuesTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      new ArrayList<ViewManager>(),
      new UIImplementationProvider(),
      false);

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(TestJavaToJSReturnValuesModule.class)
      .addNativeModule(mUIManager)
      .addNativeModule(new TestModule())
      .build();
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
CoreModulesPackage(
  ReactInstanceManager reactInstanceManager,
  DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
  UIImplementationProvider uiImplementationProvider,
  boolean lazyViewManagersEnabled) {
  mReactInstanceManager = reactInstanceManager;
  mHardwareBackBtnHandler = hardwareBackBtnHandler;
  mUIImplementationProvider = uiImplementationProvider;
  mLazyViewManagersEnabled = lazyViewManagersEnabled;
}
项目:RNLearn_Project1    文件:CatalystNativeJSToJavaParametersTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mRecordingTestModule = new RecordingTestModule();
  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mRecordingTestModule)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .addJSModule(TestJSToJavaParametersModule.class)
      .build();
}
项目:RNLearn_Project1    文件:ProgressBarTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactProgressBarViewManager());
  mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mUIManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ProgressBarTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  mRootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  int rootTag = mUIManager.addMeasuredRootView(mRootView);
  mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag);
  waitForBridgeAndUIIdle();
}
项目:RNLearn_Project1    文件:ViewRenderingTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ReactViewManager());
  final UIManagerModule uiManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          uiManager.onHostResume();
        }
      });
  waitForIdleSync();

  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ViewRenderingTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  mRootTag = uiManager.addMeasuredRootView(mRootView);
}
项目:RNLearn_Project1    文件:CatalystNativeJavaToJSArgumentsTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(TestJavaToJSArgumentsModule.class)
      .addNativeModule(mUIManager)
      .build();
}
项目:RNLearn_Project1    文件:JSLocaleTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mStringRecordingModule = new StringRecordingModule();
  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mStringRecordingModule)
      .addNativeModule(mUIManager)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(TestJSLocaleModule.class)
      .build();
}
项目:RNLearn_Project1    文件:CatalystUIManagerTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactTextViewManager(),
      new ReactRawTextManager());
  uiManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(new Runnable() {
    @Override
    public void run() {
      uiManager.onHostResume();
    }
  });
  waitForIdleSync();

  jsModule = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(UIManagerTestModule.class)
      .build()
      .getJSModule(UIManagerTestModule.class);
}
项目:RNLearn_Project1    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  String bundleName,
  UIImplementationProvider uiImplementationProvider) {
  loadApp(appKey, spec, null, bundleName, false /* = useDevSupport */, uiImplementationProvider);
}
项目:RNLearn_Project1    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  @Nullable Bundle initialProps,
  String bundleName,
  boolean useDevSupport,
  UIImplementationProvider uiImplementationProvider) {

  final CountDownLatch currentLayoutEvent = mLayoutEvent = new CountDownLatch(1);
  mBridgeIdleSignaler = new ReactBridgeIdleSignaler();

  ReactInstanceManagerBuilder builder =
    ReactTestHelper.getReactTestFactory().getReactInstanceManagerBuilder()
      .setApplication(getApplication())
      .setBundleAssetName(bundleName)
      // By not setting a JS module name, we force the bundle to be always loaded from
      // assets, not the devserver, even if dev mode is enabled (such as when testing redboxes).
      // This makes sense because we never run the devserver in tests.
      //.setJSMainModuleName()
      .addPackage(spec.getAlternativeReactPackageForTest() != null ?
          spec.getAlternativeReactPackageForTest() : new MainReactPackage())
      .addPackage(new InstanceSpecForTestPackage(spec))
      .setUseDeveloperSupport(useDevSupport)
      .setBridgeIdleDebugListener(mBridgeIdleSignaler)
      .setInitialLifecycleState(mLifecycleState)
      .setUIImplementationProvider(uiImplementationProvider);

  mReactInstanceManager = builder.build();
  mReactInstanceManager.onHostResume(this, this);

  Assertions.assertNotNull(mReactRootView).getViewTreeObserver().addOnGlobalLayoutListener(
      new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
          currentLayoutEvent.countDown();
        }
      });
  Assertions.assertNotNull(mReactRootView)
      .startReactApplication(mReactInstanceManager, appKey, initialProps);
}
项目:RNLearn_Project1    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:RNLearn_Project1    文件:ReactTextTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
CoreModulesPackage(
  ReactInstanceManager reactInstanceManager,
  DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
  UIImplementationProvider uiImplementationProvider,
  boolean lazyViewManagersEnabled) {
  mReactInstanceManager = reactInstanceManager;
  mHardwareBackBtnHandler = hardwareBackBtnHandler;
  mUIImplementationProvider = uiImplementationProvider;
  mLazyViewManagersEnabled = lazyViewManagersEnabled;
}
项目:RNLearn_Project1    文件:CatalystNativeJSToJavaParametersTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mRecordingTestModule = new RecordingTestModule();
  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mRecordingTestModule)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .addJSModule(TestJSToJavaParametersModule.class)
      .build();
}
项目:RNLearn_Project1    文件:ProgressBarTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactProgressBarViewManager());
  mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mUIManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ProgressBarTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  mRootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  int rootTag = mUIManager.addMeasuredRootView(mRootView);
  mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag);
  waitForBridgeAndUIIdle();
}
项目:RNLearn_Project1    文件:ViewRenderingTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ReactViewManager());
  final UIManagerModule uiManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          uiManager.onHostResume();
        }
      });
  waitForIdleSync();

  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ViewRenderingTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  mRootTag = uiManager.addMeasuredRootView(mRootView);
}
项目:RNLearn_Project1    文件:CatalystNativeJavaToJSArgumentsTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(TestJavaToJSArgumentsModule.class)
      .addNativeModule(mUIManager)
      .build();
}
项目:RNLearn_Project1    文件:JSLocaleTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mStringRecordingModule = new StringRecordingModule();
  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mStringRecordingModule)
      .addNativeModule(mUIManager)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(TestJSLocaleModule.class)
      .build();
}
项目:RNLearn_Project1    文件:CatalystUIManagerTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactTextViewManager(),
      new ReactRawTextManager());
  uiManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(new Runnable() {
    @Override
    public void run() {
      uiManager.onHostResume();
    }
  });
  waitForIdleSync();

  jsModule = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(UIManagerTestModule.class)
      .build()
      .getJSModule(UIManagerTestModule.class);
}
项目:RNLearn_Project1    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  String bundleName,
  UIImplementationProvider uiImplementationProvider) {
  loadApp(appKey, spec, null, bundleName, false /* = useDevSupport */, uiImplementationProvider);
}
项目:RNLearn_Project1    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  @Nullable Bundle initialProps,
  String bundleName,
  boolean useDevSupport,
  UIImplementationProvider uiImplementationProvider) {

  final CountDownLatch currentLayoutEvent = mLayoutEvent = new CountDownLatch(1);
  mBridgeIdleSignaler = new ReactBridgeIdleSignaler();

  ReactInstanceManagerBuilder builder =
    ReactTestHelper.getReactTestFactory().getReactInstanceManagerBuilder()
      .setApplication(getApplication())
      .setBundleAssetName(bundleName)
      // By not setting a JS module name, we force the bundle to be always loaded from
      // assets, not the devserver, even if dev mode is enabled (such as when testing redboxes).
      // This makes sense because we never run the devserver in tests.
      //.setJSMainModuleName()
      .addPackage(spec.getAlternativeReactPackageForTest() != null ?
          spec.getAlternativeReactPackageForTest() : new MainReactPackage())
      .addPackage(new InstanceSpecForTestPackage(spec))
      .setUseDeveloperSupport(useDevSupport)
      .setBridgeIdleDebugListener(mBridgeIdleSignaler)
      .setInitialLifecycleState(mLifecycleState)
      .setUIImplementationProvider(uiImplementationProvider);

  mReactInstanceManager = builder.build();
  mReactInstanceManager.onHostResume(this, this);

  Assertions.assertNotNull(mReactRootView).getViewTreeObserver().addOnGlobalLayoutListener(
      new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
          currentLayoutEvent.countDown();
        }
      });
  Assertions.assertNotNull(mReactRootView)
      .startReactApplication(mReactInstanceManager, appKey, initialProps);
}
项目:RNLearn_Project1    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:RNLearn_Project1    文件:ReactTextTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:ReactNativeSignatureExample    文件:ReactInstanceManagerImpl.java   
ReactInstanceManagerImpl(
    Context applicationContext,
    @Nullable String jsBundleFile,
    @Nullable String jsMainModuleName,
    List<ReactPackage> packages,
    boolean useDeveloperSupport,
    @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
    LifecycleState initialLifecycleState,
    UIImplementationProvider uiImplementationProvider,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
    @Nullable JSCConfig jscConfig) {
  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  setDisplayMetrics(applicationContext);

  mApplicationContext = applicationContext;
  mJSBundleFile = jsBundleFile;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
}
项目:ReactNativeSignatureExample    文件:CoreModulesPackage.java   
CoreModulesPackage(
    ReactInstanceManager reactInstanceManager,
    DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
    UIImplementationProvider uiImplementationProvider) {
  mReactInstanceManager = reactInstanceManager;
  mHardwareBackBtnHandler = hardwareBackBtnHandler;
  mUIImplementationProvider = uiImplementationProvider;
}
项目:ReactNativeSignatureExample    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  String bundleName,
  UIImplementationProvider uiImplementationProvider) {
  loadApp(appKey, spec, null, bundleName, false /* = useDevSupport */, uiImplementationProvider);
}
项目:ReactNativeSignatureExample    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  @Nullable Bundle initialProps,
  String bundleName,
  boolean useDevSupport,
  UIImplementationProvider uiImplementationProvider) {

  final CountDownLatch currentLayoutEvent = mLayoutEvent = new CountDownLatch(1);
  mBridgeIdleSignaler = new ReactBridgeIdleSignaler();

  ReactInstanceManager.Builder builder =
    ReactTestHelper.getReactTestFactory().getReactInstanceManagerBuilder()
      .setApplication(getApplication())
      .setBundleAssetName(bundleName)
      // By not setting a JS module name, we force the bundle to be always loaded from
      // assets, not the devserver, even if dev mode is enabled (such as when testing redboxes).
      // This makes sense because we never run the devserver in tests.
      //.setJSMainModuleName()
      .addPackage(spec.getAlternativeReactPackageForTest() != null ?
          spec.getAlternativeReactPackageForTest() : new MainReactPackage())
      .addPackage(new InstanceSpecForTestPackage(spec))
      .setUseDeveloperSupport(useDevSupport)
      .setBridgeIdleDebugListener(mBridgeIdleSignaler)
      .setInitialLifecycleState(mLifecycleState)
      .setUIImplementationProvider(uiImplementationProvider);

  mReactInstanceManager = builder.build();
  mReactInstanceManager.onHostResume(this, this);

  Assertions.assertNotNull(mReactRootView).getViewTreeObserver().addOnGlobalLayoutListener(
      new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
          currentLayoutEvent.countDown();
        }
      });
  Assertions.assertNotNull(mReactRootView)
      .startReactApplication(mReactInstanceManager, appKey, initialProps);
}
项目:react-native-ibeacon-android    文件:ReactInstanceManagerImpl.java   
ReactInstanceManagerImpl(
    Context applicationContext,
    @Nullable String jsBundleFile,
    @Nullable String jsMainModuleName,
    List<ReactPackage> packages,
    boolean useDeveloperSupport,
    @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
    LifecycleState initialLifecycleState,
    UIImplementationProvider uiImplementationProvider,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
    @Nullable JSCConfig jscConfig) {
  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  setDisplayMetrics(applicationContext);

  mApplicationContext = applicationContext;
  mJSBundleFile = jsBundleFile;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
}
项目:react-native-ibeacon-android    文件:CoreModulesPackage.java   
CoreModulesPackage(
    ReactInstanceManager reactInstanceManager,
    DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
    UIImplementationProvider uiImplementationProvider) {
  mReactInstanceManager = reactInstanceManager;
  mHardwareBackBtnHandler = hardwareBackBtnHandler;
  mUIImplementationProvider = uiImplementationProvider;
}
项目:react-native-ibeacon-android    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  String bundleName,
  UIImplementationProvider uiImplementationProvider) {
  loadApp(appKey, spec, null, bundleName, false /* = useDevSupport */, uiImplementationProvider);
}
项目:react-native-ibeacon-android    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  @Nullable Bundle initialProps,
  String bundleName,
  boolean useDevSupport,
  UIImplementationProvider uiImplementationProvider) {

  final CountDownLatch currentLayoutEvent = mLayoutEvent = new CountDownLatch(1);
  mBridgeIdleSignaler = new ReactBridgeIdleSignaler();

  ReactInstanceManager.Builder builder =
    ReactTestHelper.getReactTestFactory().getReactInstanceManagerBuilder()
      .setApplication(getApplication())
      .setBundleAssetName(bundleName)
      // By not setting a JS module name, we force the bundle to be always loaded from
      // assets, not the devserver, even if dev mode is enabled (such as when testing redboxes).
      // This makes sense because we never run the devserver in tests.
      //.setJSMainModuleName()
      .addPackage(spec.getAlternativeReactPackageForTest() != null ?
          spec.getAlternativeReactPackageForTest() : new MainReactPackage())
      .addPackage(new InstanceSpecForTestPackage(spec))
      .setUseDeveloperSupport(useDevSupport)
      .setBridgeIdleDebugListener(mBridgeIdleSignaler)
      .setInitialLifecycleState(mLifecycleState)
      .setUIImplementationProvider(uiImplementationProvider);

  mReactInstanceManager = builder.build();
  mReactInstanceManager.onHostResume(this, this);

  Assertions.assertNotNull(mReactRootView).getViewTreeObserver().addOnGlobalLayoutListener(
      new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
          currentLayoutEvent.countDown();
        }
      });
  Assertions.assertNotNull(mReactRootView)
      .startReactApplication(mReactInstanceManager, appKey, initialProps);
}
项目:react-native-box-loaders    文件:ReactInstanceManagerImpl.java   
ReactInstanceManagerImpl(
    Context applicationContext,
    @Nullable Activity currentActivity,
    @Nullable DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler,
    @Nullable String jsBundleFile,
    @Nullable String jsMainModuleName,
    List<ReactPackage> packages,
    boolean useDeveloperSupport,
    @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
    LifecycleState initialLifecycleState,
    UIImplementationProvider uiImplementationProvider,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
    @Nullable JSCConfig jscConfig) {
  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  setDisplayMetrics(applicationContext);

  mApplicationContext = applicationContext;
  mCurrentActivity = currentActivity;
  mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
  mJSBundleFile = jsBundleFile;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
}
项目:react-native-box-loaders    文件:CoreModulesPackage.java   
CoreModulesPackage(
    ReactInstanceManager reactInstanceManager,
    DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
    UIImplementationProvider uiImplementationProvider) {
  mReactInstanceManager = reactInstanceManager;
  mHardwareBackBtnHandler = hardwareBackBtnHandler;
  mUIImplementationProvider = uiImplementationProvider;
}
项目:react-native-box-loaders    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  String bundleName,
  UIImplementationProvider uiImplementationProvider) {
  loadApp(appKey, spec, null, bundleName, false /* = useDevSupport */, uiImplementationProvider);
}
项目:react-native-box-loaders    文件:ReactAppTestActivity.java   
public void loadApp(
  String appKey,
  ReactInstanceSpecForTest spec,
  @Nullable Bundle initialProps,
  String bundleName,
  boolean useDevSupport,
  UIImplementationProvider uiImplementationProvider) {

  final CountDownLatch currentLayoutEvent = mLayoutEvent = new CountDownLatch(1);
  mBridgeIdleSignaler = new ReactBridgeIdleSignaler();

  ReactInstanceManager.Builder builder =
    ReactTestHelper.getReactTestFactory().getReactInstanceManagerBuilder()
      .setApplication(getApplication())
      .setBundleAssetName(bundleName)
      // By not setting a JS module name, we force the bundle to be always loaded from
      // assets, not the devserver, even if dev mode is enabled (such as when testing redboxes).
      // This makes sense because we never run the devserver in tests.
      //.setJSMainModuleName()
      .addPackage(spec.getAlternativeReactPackageForTest() != null ?
          spec.getAlternativeReactPackageForTest() : new MainReactPackage())
      .addPackage(new InstanceSpecForTestPackage(spec))
      .setUseDeveloperSupport(useDevSupport)
      .setBridgeIdleDebugListener(mBridgeIdleSignaler)
      .setInitialLifecycleState(mLifecycleState)
      .setUIImplementationProvider(uiImplementationProvider);

  mReactInstanceManager = builder.build();
  mReactInstanceManager.onHostResume(this, this);

  Assertions.assertNotNull(mReactRootView).getViewTreeObserver().addOnGlobalLayoutListener(
      new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
          currentLayoutEvent.countDown();
        }
      });
  Assertions.assertNotNull(mReactRootView)
      .startReactApplication(mReactInstanceManager, appKey, initialProps);
}
项目:Ironman    文件:CoreModulesPackage.java   
CoreModulesPackage(
  ReactInstanceManager reactInstanceManager,
  DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
  UIImplementationProvider uiImplementationProvider) {
  mReactInstanceManager = reactInstanceManager;
  mHardwareBackBtnHandler = hardwareBackBtnHandler;
  mUIImplementationProvider = uiImplementationProvider;
}
项目:Ironman    文件:CatalystNativeJSToJavaParametersTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider());
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mRecordingTestModule = new RecordingTestModule();
  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mRecordingTestModule)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .addJSModule(TestJSToJavaParametersModule.class)
      .build();
}
项目:Ironman    文件:ProgressBarTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactProgressBarViewManager());
  mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider());
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mUIManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ProgressBarTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  mRootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  int rootTag = mUIManager.addMeasuredRootView(mRootView);
  mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag);
  waitForBridgeAndUIIdle();
}
项目:Ironman    文件:ViewRenderingTestCase.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ReactViewManager());
  final UIManagerModule uiManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider());
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          uiManager.onHostResume();
        }
      });
  waitForIdleSync();

  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ViewRenderingTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  mRootTag = uiManager.addMeasuredRootView(mRootView);
}