Java 类com.facebook.react.devsupport.DoubleTapReloadRecognizer 实例源码

项目:RNLearn_Project1    文件:ReactActivityDelegate.java   
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();
}
项目:RNLearn_Project1    文件:ReactActivityDelegate.java   
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();
}
项目:Ironman    文件:ReactActivityDelegate.java   
protected void onCreate(Bundle savedInstanceState) {
  if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) {
    // Get permission to show redbox in dev builds.
    if (!Settings.canDrawOverlays(getContext())) {
      Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
      getContext().startActivity(serviceIntent);
      FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
      Toast.makeText(getContext(), REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
    }
  }

  if (mMainComponentName != null) {
    loadApp(mMainComponentName);
  }
  mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}
项目:react-native-android-fragment    文件:ReactFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        mComponentName = getArguments().getString(ARG_COMPONENT_NAME);
        mLaunchOptions = getArguments().getBundle(ARG_LAUNCH_OPTIONS);
    }
    if (mComponentName == null) {
        throw new IllegalStateException("Cannot loadApp if component name is null");
    }
    mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}
项目:react-native-preloader    文件:MrReactActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) {
        // Get permission to show redbox in dev builds.
        if (!Settings.canDrawOverlays(this)) {
            Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
            startActivity(serviceIntent);
            FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
            Toast.makeText(this, REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
        }
    }

    mReactRootView = ReactPreLoader.getRootView(getReactInfo());

    if (mReactRootView != null) {
        Log.i(TAG, "use pre-load view");
        MutableContextWrapper contextWrapper = (MutableContextWrapper) mReactRootView.getContext();
        contextWrapper.setBaseContext(this);
        try {
            ViewGroup viewGroup = (ViewGroup) mReactRootView.getParent();
            if (viewGroup != null) {
                viewGroup.removeView(mReactRootView);
            }
        } catch (Exception exception) {
            Log.e(TAG, "getParent error", exception);
        }
    } else {
        Log.i(TAG, "createRootView");
        mReactRootView = createRootView();
        if (mReactRootView != null) {
            mReactRootView.startReactApplication(
                    getReactNativeHost().getReactInstanceManager(),
                    getMainComponentName(),
                    getLaunchOptions());
        }
    }

    setContentView(mReactRootView);

    mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}