android: devkit support add port

This commit is contained in:
pengfei.zhou 2023-08-11 16:25:07 +08:00 committed by jingpeng
parent b61699a450
commit aa7820a3b3
3 changed files with 100 additions and 46 deletions

View File

@ -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) {
if (wsClient != null) {
wsClient.sendToDebugger("DEBUG_STOP", new JSONBuilder()
.put("msg", "Stop debugging")
.toJSONObject());
}
if (debuggable != null) {
uiHandler.post(new Runnable() {
@Override

View File

@ -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() {

View File

@ -14,6 +14,7 @@
android:paddingRight="15dp"
android:paddingBottom="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -24,7 +25,8 @@
android:textSize="30dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -47,11 +49,6 @@
android:textColor="#dfe4ea"
android:textSize="12dp" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_input"
android:layout_width="wrap_content"
@ -97,8 +94,23 @@
android:textColor="#dfe4ea"
android:textSize="15dp"
android:visibility="visible" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollIndicators="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -121,6 +133,7 @@
</LinearLayout>
<LinearLayout
android:layout_marginLeft="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
@ -140,7 +153,34 @@
android:layout_height="wrap_content"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:layout_marginLeft="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Mask"
android:textColor="#dfe4ea"
android:textSize="15dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch_mask"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView