diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java b/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java index 08bde479..2598bf5a 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java @@ -85,8 +85,8 @@ public class DoricDev { } public void closeDevMode() { - stopDebugging(true); if (wsClient != null) { + stopDebugging(true); wsClient.close(); wsClient = null; } @@ -172,9 +172,11 @@ public class DoricDev { } public void stopDebugging(final boolean resume) { - wsClient.sendToDebugger("DEBUG_STOP", new JSONBuilder() - .put("msg", "Stop debugging") - .toJSONObject()); + if (wsClient != null) { + wsClient.sendToDebugger("DEBUG_STOP", new JSONBuilder() + .put("msg", "Stop debugging") + .toJSONObject()); + } if (debuggable != null) { uiHandler.post(new Runnable() { @Override diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DoricDevActivity.java b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DoricDevActivity.java index 2242fd21..4fb8ad29 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DoricDevActivity.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DoricDevActivity.java @@ -122,7 +122,13 @@ public class DoricDevActivity extends AppCompatActivity implements DoricDev.Stat } if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_SUCCESS) { String result = bundle.getString(CodeUtils.RESULT_STRING); - DoricDev.getInstance().connectDevKit("ws://" + result + ":7777"); + if (!result.contains(":")) { + result = result + ":7777"; + } + if (!result.contains("://")) { + result = "ws://" + result; + } + DoricDev.getInstance().connectDevKit(result); } } } @@ -187,8 +193,14 @@ public class DoricDevActivity extends AppCompatActivity implements DoricDev.Stat .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - String ip = editText.getText().toString(); - DoricDev.getInstance().connectDevKit("ws://" + ip + ":7777"); + String url = editText.getText().toString(); + if (!url.contains(":")) { + url = url + ":7777"; + } + if (!url.contains("://")) { + url = "ws://" + url; + } + DoricDev.getInstance().connectDevKit(url); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { diff --git a/doric-android/devkit/src/main/res/layout/layout_debug_context.xml b/doric-android/devkit/src/main/res/layout/layout_debug_context.xml index e64c775e..f8f18ca5 100644 --- a/doric-android/devkit/src/main/res/layout/layout_debug_context.xml +++ b/doric-android/devkit/src/main/res/layout/layout_debug_context.xml @@ -14,6 +14,7 @@ android:paddingRight="15dp" android:paddingBottom="5dp"> + @@ -47,11 +49,6 @@ android:textColor="#dfe4ea" android:textSize="12dp" /> - - + + - + android:scrollIndicators="none"> - + android:orientation="horizontal"> - - + - + - + + + + + + + + + + + + + + + + + + + - - +