diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java
index 65f71e503..9c3454fe8 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java
@@ -50,6 +50,10 @@ public class DevInternalSettings implements
return mPreferences.getBoolean(PREFS_FPS_DEBUG_KEY, false);
}
+ public void setFpsDebugEnabled(boolean enabled) {
+ mPreferences.edit().putBoolean(PREFS_FPS_DEBUG_KEY, enabled).apply();
+ }
+
@Override
public boolean isAnimationFpsDebugEnabled() {
return mPreferences.getBoolean(PREFS_ANIMATIONS_DEBUG_KEY, false);
@@ -75,4 +79,8 @@ public class DevInternalSettings implements
public boolean isReloadOnJSChangeEnabled() {
return mPreferences.getBoolean(PREFS_RELOAD_ON_JS_CHANGE_KEY, false);
}
+
+ public void setReloadOnJSChangeEnabled(boolean enabled) {
+ mPreferences.edit().putBoolean(PREFS_RELOAD_ON_JS_CHANGE_KEY, enabled).apply();
+ }
}
diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java
index 11b5ffefe..69ef7fa96 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java
@@ -255,12 +255,13 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
}
});
options.put(
- mApplicationContext.getString(R.string.catalyst_settings), new DevOptionHandler() {
+ mDevSettings.isReloadOnJSChangeEnabled()
+ ? mApplicationContext.getString(R.string.catalyst_live_reload_off)
+ : mApplicationContext.getString(R.string.catalyst_live_reload),
+ new DevOptionHandler() {
@Override
public void onOptionSelected() {
- Intent intent = new Intent(mApplicationContext, DevSettingsActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mApplicationContext.startActivity(intent);
+ mDevSettings.setReloadOnJSChangeEnabled(!mDevSettings.isReloadOnJSChangeEnabled());
}
});
options.put(
@@ -271,12 +272,21 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
mReactInstanceCommandsHandler.toggleElementInspector();
}
});
-
+ options.put(
+ mDevSettings.isFpsDebugEnabled()
+ ? mApplicationContext.getString(R.string.catalyst_perf_monitor_off)
+ : mApplicationContext.getString(R.string.catalyst_perf_monitor),
+ new DevOptionHandler() {
+ @Override
+ public void onOptionSelected() {
+ mDevSettings.setFpsDebugEnabled(!mDevSettings.isFpsDebugEnabled());
+ }
+ });
if (mCurrentContext != null &&
- mCurrentContext.getCatalystInstance() != null &&
- !mCurrentContext.getCatalystInstance().isDestroyed() &&
- mCurrentContext.getCatalystInstance().getBridge() != null &&
- mCurrentContext.getCatalystInstance().getBridge().supportsProfiling()) {
+ mCurrentContext.getCatalystInstance() != null &&
+ !mCurrentContext.getCatalystInstance().isDestroyed() &&
+ mCurrentContext.getCatalystInstance().getBridge() != null &&
+ mCurrentContext.getCatalystInstance().getBridge().supportsProfiling()) {
options.put(
mApplicationContext.getString(
mIsCurrentlyProfiling ? R.string.catalyst_stop_profile :
@@ -310,6 +320,15 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
}
});
}
+ options.put(
+ mApplicationContext.getString(R.string.catalyst_settings), new DevOptionHandler() {
+ @Override
+ public void onOptionSelected() {
+ Intent intent = new Intent(mApplicationContext, DevSettingsActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mApplicationContext.startActivity(intent);
+ }
+ });
if (mCustomDevOptions.size() > 0) {
options.putAll(mCustomDevOptions);
@@ -317,21 +336,24 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
final DevOptionHandler[] optionHandlers = options.values().toArray(new DevOptionHandler[0]);
- mDevOptionsDialog = new AlertDialog.Builder(mApplicationContext)
- .setItems(options.keySet().toArray(new String[0]), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- optionHandlers[which].onOptionSelected();
- mDevOptionsDialog = null;
- }
- })
- .setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- mDevOptionsDialog = null;
- }
- })
- .create();
+ mDevOptionsDialog =
+ new AlertDialog.Builder(mApplicationContext)
+ .setItems(
+ options.keySet().toArray(new String[0]),
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ optionHandlers[which].onOptionSelected();
+ mDevOptionsDialog = null;
+ }
+ })
+ .setOnCancelListener(new DialogInterface.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ mDevOptionsDialog = null;
+ }
+ })
+ .create();
mDevOptionsDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mDevOptionsDialog.show();
}
diff --git a/ReactAndroid/src/main/res/devsupport/values/strings.xml b/ReactAndroid/src/main/res/devsupport/values/strings.xml
index 85a5ae3fd..8969fe61e 100644
--- a/ReactAndroid/src/main/res/devsupport/values/strings.xml
+++ b/ReactAndroid/src/main/res/devsupport/values/strings.xml
@@ -1,16 +1,20 @@
- Reload JS
- Debug in Chrome
- Stop Chrome Debugging
- Dev Settings
- Catalyst Dev Settings
- Please wait...
- Fetching JS bundle
- Unable to download JS bundle. Did you forget to start the development server or connect your device?
- Connecting to remote debugger
- Unable to connect with remote debugger
- Inspect Element
+ Reload JS
+ Debug in Chrome
+ Stop Chrome Debugging
+ Enable Live Reload
+ Disable Live Reload
+ Enable Perf Monitor
+ Disable Perf Monitor
+ Dev Settings
+ Catalyst Dev Settings
+ Please wait…
+ Fetching JS bundle
+ Unable to download JS bundle. Did you forget to start the development server or connect your device?
+ Connecting to remote debugger
+ Unable to connect with remote debugger
+ Inspect Element
Start Profile
Stop Profile
diff --git a/ReactAndroid/src/main/res/devsupport/xml/preferences.xml b/ReactAndroid/src/main/res/devsupport/xml/preferences.xml
index ee1e7c4bd..99f5408c0 100644
--- a/ReactAndroid/src/main/res/devsupport/xml/preferences.xml
+++ b/ReactAndroid/src/main/res/devsupport/xml/preferences.xml
@@ -13,12 +13,6 @@
android:summary="Load JavaScript bundle with __DEV__ = true for easier debugging. Disable for performance testing."
android:defaultValue="true"
/>
-
-