当前位置: 首页>>代码示例>>Java>>正文


Java ReactConstants类代码示例

本文整理汇总了Java中com.facebook.react.common.ReactConstants的典型用法代码示例。如果您正苦于以下问题:Java ReactConstants类的具体用法?Java ReactConstants怎么用?Java ReactConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ReactConstants类属于com.facebook.react.common包,在下文中一共展示了ReactConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawOutput

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
private void drawOutput() {
  if (mSurface == null || !mSurface.isValid()) {
    markChildrenUpdatesSeen(this);
    return;
  }

  try {
    Canvas canvas = mSurface.lockCanvas(null);
    canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);

    Paint paint = new Paint();
    for (int i = 0; i < getChildCount(); i++) {
      ARTVirtualNode child = (ARTVirtualNode) getChildAt(i);
      child.draw(canvas, paint, 1f);
      child.markUpdateSeen();
    }

    if (mSurface == null) {
      return;
    }

    mSurface.unlockCanvasAndPost(canvas);
  } catch (IllegalArgumentException | IllegalStateException e) {
    Log.e(ReactConstants.TAG, e.getClass().getSimpleName() + " in Surface.unlockCanvasAndPost");
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:FlatARTSurfaceViewShadowNode.java

示例2: setupFillPaint

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
/**
 * Sets up {@link #mPaint} according to the props set on a shadow view. Returns {@code true}
 * if the fill should be drawn, {@code false} if not.
 */
protected boolean setupFillPaint(Paint paint, float opacity) {
  if (mFillColor != null && mFillColor.length > 0) {
    paint.reset();
    paint.setFlags(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    int colorType = (int) mFillColor[0];
    switch (colorType) {
      case 0:
        paint.setARGB(
            (int) (mFillColor.length > 4 ? mFillColor[4] * opacity * 255 : opacity * 255),
            (int) (mFillColor[1] * 255),
            (int) (mFillColor[2] * 255),
            (int) (mFillColor[3] * 255));
        break;
      default:
        // TODO(6352048): Support gradients etc.
        FLog.w(ReactConstants.TAG, "ART: Color type " + colorType + " not supported!");
    }
    return true;
  }
  return false;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:ARTShapeShadowNode.java

示例3: drawOutput

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
private void drawOutput() {
  if (mSurface == null || !mSurface.isValid()) {
    markChildrenUpdatesSeen(this);
    return;
  }

  try {
    Canvas canvas = mSurface.lockCanvas(null);
    canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);

    Paint paint = new Paint();
    for (int i = 0; i < getChildCount(); i++) {
      ARTVirtualNode child = (ARTVirtualNode) getChildAt(i);
      child.draw(canvas, paint, 1f);
      child.markUpdateSeen();
    }

    if (mSurface == null) {
      return;
    }

    mSurface.unlockCanvasAndPost(canvas);
  } catch (IllegalArgumentException | IllegalStateException e) {
    FLog.e(ReactConstants.TAG, e.getClass().getSimpleName() + " in Surface.unlockCanvasAndPost");
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:ARTSurfaceViewShadowNode.java

示例4: setElevation

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@Override
public void setElevation(ReactDrawerLayout view, float elevation) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    // Facebook is using an older version of the support lib internally that doesn't support
    // setDrawerElevation so we invoke it using reflection.
    // TODO: Call the method directly when this is no longer needed.
    try {
      Method method = ReactDrawerLayout.class.getMethod("setDrawerElevation", float.class);
      method.invoke(view, PixelUtil.toPixelFromDIP(elevation));
    } catch (Exception ex) {
      FLog.w(
          ReactConstants.TAG,
          "setDrawerElevation is not available in this version of the support lib.",
          ex);
    }
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:ReactDrawerLayoutManager.java

示例5: shouldOverrideUrlLoading

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.startsWith("http://") || url.startsWith("https://") ||
        url.startsWith("file://")) {
      return false;
    } else {
      try {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        view.getContext().startActivity(intent);
      } catch (ActivityNotFoundException e) {
        FLog.w(ReactConstants.TAG, "activity not found to handle uri scheme for: " + url, e);
      }
      return true;
    }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:ReactWebViewManager.java

示例6: initialize

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@Override
public void initialize() {
  super.initialize();
  getReactApplicationContext().addLifecycleEventListener(this);
  if (!hasBeenInitialized()) {
    // Make sure the SoLoaderShim is configured to use our loader for native libraries.
    // This code can be removed if using Fresco from Maven rather than from source
    SoLoaderShim.setHandler(new FrescoHandler());
    if (mConfig == null) {
      mConfig = getDefaultConfig(getReactApplicationContext());
    }
    Context context = getReactApplicationContext().getApplicationContext();
    Fresco.initialize(context, mConfig);
    sHasBeenInitialized = true;
  } else if (mConfig != null) {
    FLog.w(
        ReactConstants.TAG,
        "Fresco has already been initialized with a different config. "
        + "The new Fresco configuration will be ignored!");
  }
  mConfig = null;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:FrescoModule.java

示例7: copyExif

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
private static void copyExif(Context context, Uri oldImage, File newFile) throws IOException {
  File oldFile = getFileFromUri(context, oldImage);
  if (oldFile == null) {
    FLog.w(ReactConstants.TAG, "Couldn't get real path for uri: " + oldImage);
    return;
  }

  ExifInterface oldExif = new ExifInterface(oldFile.getAbsolutePath());
  ExifInterface newExif = new ExifInterface(newFile.getAbsolutePath());
  for (String attribute : EXIF_ATTRIBUTES) {
    String value = oldExif.getAttribute(attribute);
    if (value != null) {
      newExif.setAttribute(attribute, value);
    }
  }
  newExif.saveAttributes();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:ImageEditingManager.java

示例8: callFunction

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@Override
public void callFunction(
    ExecutorToken executorToken,
    final String module,
    final String method,
    final NativeArray arguments) {
  if (mDestroyed) {
    FLog.w(ReactConstants.TAG, "Calling JS function after bridge has been destroyed.");
    return;
  }
  if (!mAcceptCalls) {
    // Most of the time the instance is initialized and we don't need to acquire the lock
    synchronized (mJSCallsPendingInitLock) {
      if (!mAcceptCalls) {
        mJSCallsPendingInit.add(new PendingJSCall(executorToken, module, method, arguments));
        return;
      }
    }
  }

  jniCallJSFunction(executorToken, module, method, arguments);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:CatalystInstanceImpl.java

示例9: setHidden

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@ReactMethod
public void setHidden(final boolean hidden) {
  final Activity activity = getCurrentActivity();
  if (activity == null) {
    FLog.w(ReactConstants.TAG, "StatusBarModule: Ignored status bar change, current activity is null.");
    return;
  }
  UiThreadUtil.runOnUiThread(
    new Runnable() {
      @Override
      public void run() {
        if (hidden) {
          activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
          activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        } else {
          activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
          activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
      }
    });
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:StatusBarModule.java

示例10: setStyle

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@ReactMethod
public void setStyle(final String style) {
  final Activity activity = getCurrentActivity();
  if (activity == null) {
    FLog.w(ReactConstants.TAG, "StatusBarModule: Ignored status bar change, current activity is null.");
    return;
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    UiThreadUtil.runOnUiThread(
      new Runnable() {
        @TargetApi(Build.VERSION_CODES.M)
        @Override
        public void run() {
          View decorView = activity.getWindow().getDecorView();
          decorView.setSystemUiVisibility(
            style.equals("dark-content") ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0);
        }
      }
    );
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:StatusBarModule.java

示例11: clear

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
/**
 * Clears the database.
 */
@ReactMethod
public void clear(final Callback callback) {
  new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
    @Override
    protected void doInBackgroundGuarded(Void... params) {
      if (!mReactDatabaseSupplier.ensureDatabase()) {
        callback.invoke(AsyncStorageErrorUtil.getDBError(null));
        return;
      }
      try {
        mReactDatabaseSupplier.clear();
        callback.invoke();
      } catch (Exception e) {
        FLog.w(ReactConstants.TAG, e.getMessage(), e);
        callback.invoke(AsyncStorageErrorUtil.getError(null, e.getMessage()));
      }
    }
  }.execute();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:AsyncStorageModule.java

示例12: invoke

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@Override
public @Nullable Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable {
  ExecutorToken executorToken = mExecutorToken.get();
  if (executorToken == null) {
    FLog.w(ReactConstants.TAG, "Dropping JS call, ExecutorToken went away...");
    return null;
  }
  NativeArray jsArgs = args != null ? Arguments.fromJavaArgs(args) : new WritableNativeArray();
  mCatalystInstance.callFunction(
    executorToken,
    mModuleRegistration.getName(),
    method.getName(),
    jsArgs
  );
  return null;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:JavaScriptModuleRegistry.java

示例13: doInBackground

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
@Override
protected Void doInBackground(String... clipBoardString) {
  try {
    String sendClipBoardUrl =
        Uri.parse(mDevSupportManager.getSourceUrl()).buildUpon()
            .path("/copy-to-clipboard")
            .query(null)
            .build()
            .toString();
    for (String string: clipBoardString) {
      OkHttpClient client = new OkHttpClient();
      RequestBody body = RequestBody.create(null, string);
      Request request = new Request.Builder().url(sendClipBoardUrl).post(body).build();
      client.newCall(request).execute();
    }
  } catch (Exception e) {
    FLog.e(ReactConstants.TAG, "Could not copy to the host clipboard", e);
  }
  return null;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:RedBoxDialog.java

示例14: onNewIntent

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
/**
 * This method will give JS the opportunity to receive intents via Linking.
 */
public void onNewIntent(Intent intent) {
  if (mCurrentReactContext == null) {
    FLog.w(ReactConstants.TAG, "Instance detached from instance manager");
  } else {
    String action = intent.getAction();
    Uri uri = intent.getData();

    if (Intent.ACTION_VIEW.equals(action) && uri != null) {
      DeviceEventManagerModule deviceEventManagerModule =
              Assertions.assertNotNull(mCurrentReactContext).getNativeModule(DeviceEventManagerModule.class);
      deviceEventManagerModule.emitNewIntentReceived(uri);
    }

    mCurrentReactContext.onNewIntent(mCurrentActivity, intent);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:ReactInstanceManager.java

示例15: onCreate

import com.facebook.react.common.ReactConstants; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
  boolean needsOverlayPermission = false;
  if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    // Get permission to show redbox in dev builds.
    if (!Settings.canDrawOverlays(getContext())) {
      needsOverlayPermission = true;
      Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getContext().getPackageName()));
      FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
      Toast.makeText(getContext(), REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
      ((Activity) getContext()).startActivityForResult(serviceIntent, REQUEST_OVERLAY_PERMISSION_CODE);
    }
  }

  if (mMainComponentName != null && !needsOverlayPermission) {
    loadApp(mMainComponentName);
  }
  mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactActivityDelegate.java


注:本文中的com.facebook.react.common.ReactConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。