com.facebook.react.devsupport.DoubleTapReloadRecognizer Java Examples

The following examples show how to use com.facebook.react.devsupport.DoubleTapReloadRecognizer. 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: VinciActivityDelegate.java    From vinci with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #2
Source File: ReactFragment.java    From react-native-android-fragment with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #3
Source File: ReactActivityDelegate.java    From react-native-GPay with MIT License 4 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
  if (mMainComponentName != null) {
    loadApp(mMainComponentName);
  }
  mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}
 
Example #4
Source File: MrReactActivity.java    From react-native-preloader with Apache License 2.0 4 votes vote down vote up
@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();
}