List of usage examples for com.facebook.react.devsupport DoubleTapReloadRecognizer DoubleTapReloadRecognizer
DoubleTapReloadRecognizer
From source file:com.github.markzhai.react.preloader.MrReactActivity.java
License:Apache License
@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(); }//from w ww . j av a 2s .c om } 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(); }