From db1f5f6fc4357f7f31a31bdb38505a99d1f13102 Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Fri, 22 Dec 2023 12:23:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 3 +- .../com/xypower/mpapp/ChannelActivity.java | 48 ++++++++++++++++ .../java/com/xypower/mpapp/MainActivity.java | 30 +++++++--- .../main/res/layout-land/activity_main.xml | 56 ++++++++++++++++++- app/src/main/res/layout/activity_channel.xml | 41 +++++++++++++- app/src/main/res/layout/activity_main.xml | 54 +++++++++++++++++- app/src/main/res/menu/menu_channel.xml | 10 ++++ app/src/main/res/values/strings.xml | 11 ++++ 8 files changed, 237 insertions(+), 16 deletions(-) create mode 100644 app/src/main/res/menu/menu_channel.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cf10b8d0..ed03619d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -77,7 +77,8 @@ + android:exported="false" + android:label="@string/activity_channel_title" /> 0 ? (new JSONObject(stringBuilder.toString())) : (new JSONObject()); - jsonObject.put("CMDID", cmdid); - jsonObject.put("Server", server); - jsonObject.put("Port", port); - jsonObject.put("Protocol", protocol); - jsonObject.put("NetworkProtocol", networkProtocol); + jsonObject.put("CMDID", appConfig.cmdid); + jsonObject.put("Server", appConfig.server); + jsonObject.put("Port", appConfig.port); + jsonObject.put("Protocol", appConfig.protocol); + jsonObject.put("NetworkProtocol", appConfig.networkProtocol); + + if (appConfig.heartbeat > 0) { + jsonObject.put("heartbeat", appConfig.heartbeat); + } else { + jsonObject.remove("heartbeat"); + } + if (appConfig.packetSize > 0) { + jsonObject.put("packetSize", appConfig.packetSize); + } else { + jsonObject.remove("packetSize"); + } outputStreamWriter = new OutputStreamWriter(new FileOutputStream(new File(appPath + "data/App.json")), "UTF-8"); outputStreamWriter.write(jsonObject.toString()); diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index 5b6de180..c3b501cd 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -62,7 +62,7 @@ android:maxLines="1" android:inputType="text" android:imeOptions="actionDone" - android:text="47.96.238.157" + android:hint="main_server" app:layout_constraintStart_toStartOf="@+id/cmdid" app:layout_constraintTop_toBottomOf="@+id/cmdid" /> @@ -89,6 +89,56 @@ app:layout_constraintLeft_toRightOf="@+id/port" app:layout_constraintTop_toTopOf="@+id/port" /> + + + + + + + +