reorder dev menu, surface live reload and perf monitor
Differential Revision: D2663707 fb-gh-sync-id: 42663a14e1bda7896867692473ae0bf3753aafe2
This commit is contained in:
parent
8491b579c8
commit
e22fb312d2
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="catalyst_reloadjs" project="catalyst">Reload JS</string>
|
||||
<string name="catalyst_debugjs" project="catalyst">Debug in Chrome</string>
|
||||
<string name="catalyst_debugjs_off" project="catalyst">Stop Chrome Debugging</string>
|
||||
<string name="catalyst_settings" project="catalyst">Dev Settings</string>
|
||||
<string name="catalyst_settings_title" project="catalyst">Catalyst Dev Settings</string>
|
||||
<string name="catalyst_jsload_title" project="catalyst">Please wait...</string>
|
||||
<string name="catalyst_jsload_message" project="catalyst">Fetching JS bundle</string>
|
||||
<string name="catalyst_jsload_error" project="catalyst">Unable to download JS bundle. Did you forget to start the development server or connect your device?</string>
|
||||
<string name="catalyst_remotedbg_message" project="catalyst">Connecting to remote debugger</string>
|
||||
<string name="catalyst_remotedbg_error" project="catalyst">Unable to connect with remote debugger</string>
|
||||
<string name="catalyst_inspect_element" project="catalyst">Inspect Element</string>
|
||||
<string name="catalyst_reloadjs" project="catalyst" translatable="false">Reload JS</string>
|
||||
<string name="catalyst_debugjs" project="catalyst" translatable="false">Debug in Chrome</string>
|
||||
<string name="catalyst_debugjs_off" project="catalyst" translatable="false">Stop Chrome Debugging</string>
|
||||
<string name="catalyst_live_reload" project="catalyst" translatable="false">Enable Live Reload</string>
|
||||
<string name="catalyst_live_reload_off" project="catalyst" translatable="false">Disable Live Reload</string>
|
||||
<string name="catalyst_perf_monitor" project="catalyst" translatable="false">Enable Perf Monitor</string>
|
||||
<string name="catalyst_perf_monitor_off" project="catalyst" translatable="false">Disable Perf Monitor</string>
|
||||
<string name="catalyst_settings" project="catalyst" translatable="false">Dev Settings</string>
|
||||
<string name="catalyst_settings_title" project="catalyst" translatable="false">Catalyst Dev Settings</string>
|
||||
<string name="catalyst_jsload_title" project="catalyst" translatable="false">Please wait…</string>
|
||||
<string name="catalyst_jsload_message" project="catalyst" translatable="false">Fetching JS bundle</string>
|
||||
<string name="catalyst_jsload_error" project="catalyst" translatable="false">Unable to download JS bundle. Did you forget to start the development server or connect your device?</string>
|
||||
<string name="catalyst_remotedbg_message" project="catalyst" translatable="false">Connecting to remote debugger</string>
|
||||
<string name="catalyst_remotedbg_error" project="catalyst" translatable="false">Unable to connect with remote debugger</string>
|
||||
<string name="catalyst_inspect_element" project="catalyst" translatable="false">Inspect Element</string>
|
||||
<string name="catalyst_start_profile" project="catalyst" translatable="false">Start Profile</string>
|
||||
<string name="catalyst_stop_profile" project="catalyst" translatable="false">Stop Profile</string>
|
||||
</resources>
|
||||
|
|
|
@ -13,12 +13,6 @@
|
|||
android:summary="Load JavaScript bundle with __DEV__ = true for easier debugging. Disable for performance testing."
|
||||
android:defaultValue="true"
|
||||
/>
|
||||
<CheckBoxPreference
|
||||
android:key="fps_debug"
|
||||
android:title="FPS Debugging"
|
||||
android:summary="Overlay FPS information and print debug FPS info about animations"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference
|
||||
android:key="animations_debug"
|
||||
android:title="Animations FPS Summaries"
|
||||
|
@ -30,12 +24,6 @@
|
|||
android:key="pref_key_catalyst_debug"
|
||||
android:title="Debugging"
|
||||
>
|
||||
<CheckBoxPreference
|
||||
android:key="reload_on_js_change"
|
||||
android:title="Auto reload on JS change"
|
||||
android:summary="Reload JS automatically when JS changes. It's required for this to work to have dev server connection setup correctly."
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<EditTextPreference
|
||||
android:key="debug_http_host"
|
||||
android:title="Debug server host & port for device"
|
||||
|
|
Loading…
Reference in New Issue