Java Code Examples for com.facebook.react.uimanager.DisplayMetricsHolder#initDisplayMetricsIfNotInitialized()

The following examples show how to use com.facebook.react.uimanager.DisplayMetricsHolder#initDisplayMetricsIfNotInitialized() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FabricUIManager.java    From react-native-GPay with MIT License 6 votes vote down vote up
public FabricUIManager(
    ReactApplicationContext reactContext,
    ViewManagerRegistry viewManagerRegistry,
    JavaScriptContextHolder jsContext,
    EventDispatcher eventDispatcher) {
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
  mReactApplicationContext = reactContext;
  mViewManagerRegistry = viewManagerRegistry;
  mNativeViewHierarchyManager = new NativeViewHierarchyManager(viewManagerRegistry);
  mUIViewOperationQueue =
      new UIViewOperationQueue(
          reactContext, mNativeViewHierarchyManager, 0);
  mFabricReconciler = new FabricReconciler(mUIViewOperationQueue);
  mFabricEventEmitter =
    new FabricEventEmitter(mReactApplicationContext, this);
  mEventDispatcher = eventDispatcher;
  mJSContext = jsContext;
}
 
Example 2
Source File: DeviceInfoModule.java    From react-native-GPay with MIT License 4 votes vote down vote up
public DeviceInfoModule(Context context) {
  mReactApplicationContext = null;
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(context);
  mFontScale = context.getResources().getConfiguration().fontScale;
}
 
Example 3
Source File: ReactInstanceManager.java    From react-native-GPay with MIT License 4 votes vote down vote up
ReactInstanceManager(
  Context applicationContext,
  @Nullable Activity currentActivity,
  @Nullable DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler,
  JavaScriptExecutorFactory javaScriptExecutorFactory,
  @Nullable JSBundleLoader bundleLoader,
  @Nullable String jsMainModulePath,
  List<ReactPackage> packages,
  boolean useDeveloperSupport,
  @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
  LifecycleState initialLifecycleState,
  @Nullable UIImplementationProvider mUIImplementationProvider,
  NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
  @Nullable RedBoxHandler redBoxHandler,
  boolean lazyViewManagersEnabled,
  @Nullable DevBundleDownloadListener devBundleDownloadListener,
  int minNumShakes,
  int minTimeLeftInFrameForNonBatchedOperationMs,
  @Nullable JSIModulePackage jsiModulePackage,
  @Nullable Map<String, RequestHandler> customPackagerCommandHandlers) {
  Log.d(ReactConstants.TAG, "ReactInstanceManager.ctor()");
  initializeSoLoaderIfNecessary(applicationContext);

  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);

  mApplicationContext = applicationContext;
  mCurrentActivity = currentActivity;
  mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
  mJavaScriptExecutorFactory = javaScriptExecutorFactory;
  mBundleLoader = bundleLoader;
  mJSMainModulePath = jsMainModulePath;
  mPackages = new ArrayList<>();
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager =
      DevSupportManagerFactory.create(
          applicationContext,
          createDevHelperInterface(),
          mJSMainModulePath,
          useDeveloperSupport,
          redBoxHandler,
          devBundleDownloadListener,
          minNumShakes,
          customPackagerCommandHandlers);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  synchronized (mPackages) {
    PrinterHolder.getPrinter()
        .logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Use Split Packages");
    mPackages.add(
        new CoreModulesPackage(
            this,
            new DefaultHardwareBackBtnHandler() {
              @Override
              public void invokeDefaultOnBackPressed() {
                ReactInstanceManager.this.invokeDefaultOnBackPressed();
              }
            },
            mUIImplementationProvider,
            lazyViewManagersEnabled,
            minTimeLeftInFrameForNonBatchedOperationMs));
    if (mUseDeveloperSupport) {
      mPackages.add(new DebugCorePackage());
    }
    mPackages.addAll(packages);
  }
  mJSIModulePackage = jsiModulePackage;

  // Instantiate ReactChoreographer in UI thread.
  ReactChoreographer.initialize();
  if (mUseDeveloperSupport) {
    mDevSupportManager.startInspector();
  }
}
 
Example 4
Source File: ReactRootView.java    From react-native-GPay with MIT License 4 votes vote down vote up
CustomGlobalLayoutListener() {
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(getContext().getApplicationContext());
  mVisibleViewArea = new Rect();
  mMinKeyboardHeightDetected = (int) PixelUtil.toPixelFromDIP(60);
}