diff --git a/app/src/main/assets/logo.jpeg b/app/src/main/assets/logo.jpeg new file mode 100644 index 0000000..24bc73c Binary files /dev/null and b/app/src/main/assets/logo.jpeg differ diff --git a/app/src/main/assets/print_demo.html b/app/src/main/assets/print_demo.html index b43aa90..249d073 100644 --- a/app/src/main/assets/print_demo.html +++ b/app/src/main/assets/print_demo.html @@ -165,6 +165,11 @@ +
+ 当前群组: - + +
+
@@ -194,6 +199,7 @@ +
@@ -552,6 +558,14 @@ var loginId = window.android.pttGetLoginId ? window.android.pttGetLoginId() : ""; updatePttLoginStatus(status, loginId); } + if (window.android && window.android.pttGetCurrentGroup) { + try { + var group = JSON.parse(window.android.pttGetCurrentGroup()); + if (group.groupId) { + updatePttCurrentGroup(group.groupId, group.groupName); + } + } catch(e) {} + } }, 500); // 告知 Android 页面加载完成 @@ -748,6 +762,13 @@ } }; + // 更新当前群组信息 (由 Android 实时推送) + function updatePttCurrentGroup(groupId, groupName) { + document.getElementById('ptt-current-group').innerText = groupName || '-'; + document.getElementById('ptt-current-group-id').innerText = groupId ? '(' + groupId + ')' : ''; + showPttResult("进入群组: " + groupName + " (" + groupId + ")"); + }; + // PTT 登录成功回调 (由 Android 调用) function onPttLoginSuccess() { updatePttLoginStatusUI("02"); @@ -872,6 +893,21 @@ } } + function pttGetCurrentGroup() { + if (window.android && window.android.pttGetCurrentGroup) { + try { + var group = JSON.parse(window.android.pttGetCurrentGroup()); + if (group.groupId) { + updatePttCurrentGroup(group.groupId, group.groupName); + } else { + showPttResult("当前无群组信息"); + } + } catch(e) { + showPttResult("获取群组信息失败"); + } + } + } + function pttSendAtCmd() { var cmd = document.getElementById('ptt-at-cmd').value.trim(); if (!cmd) { diff --git a/app/src/main/java/com/example/kingway/ptt/CallBackResolution.java b/app/src/main/java/com/example/kingway/ptt/CallBackResolution.java index 6ea642a..41a0203 100644 --- a/app/src/main/java/com/example/kingway/ptt/CallBackResolution.java +++ b/app/src/main/java/com/example/kingway/ptt/CallBackResolution.java @@ -40,6 +40,14 @@ public class CallBackResolution { pttLoginId = ""; } + public static String getCurrentGroupId() { + return indexGroupId; + } + + public static String getCurrentGroupName() { + return indexGroupName; + } + public static void at_OEM_AT_cb(List lisHex){ if (lisHex.size() == 0) { return; diff --git a/app/src/main/java/com/stand/standapp/AndroidInterface.kt b/app/src/main/java/com/stand/standapp/AndroidInterface.kt index 93a980a..a070313 100644 --- a/app/src/main/java/com/stand/standapp/AndroidInterface.kt +++ b/app/src/main/java/com/stand/standapp/AndroidInterface.kt @@ -31,6 +31,7 @@ class AndroidInterface(private val activity: MainActivity) { "pttSpeakPlay" -> { pttSpeakPlay(); "" } "pttGetLoginStatus" -> pttGetLoginStatus() "pttGetLoginId" -> pttGetLoginId() + "pttGetCurrentGroup" -> pttGetCurrentGroup() "pttSpeakRelease" -> { pttSpeakRelease(); "" } "pttForceRelease" -> { pttForceRelease(); "" } "pttGetGroupInfo" -> { pttGetGroupInfo(); "" } @@ -113,6 +114,17 @@ class AndroidInterface(private val activity: MainActivity) { return com.example.kingway.ptt.CallBackResolution.getPttLoginId() } + fun pttGetCurrentGroup(): String { + return try { + val json = JSONObject() + json.put("groupId", com.example.kingway.ptt.CallBackResolution.getCurrentGroupId()) + json.put("groupName", com.example.kingway.ptt.CallBackResolution.getCurrentGroupName()) + json.toString() + } catch (e: Exception) { + "{\"groupId\":\"\",\"groupName\":\"\"}" + } + } + fun pttSpeakRelease() { if (isSpeaking) { val now = System.currentTimeMillis() diff --git a/app/src/main/java/com/stand/standapp/LoginActivity.kt b/app/src/main/java/com/stand/standapp/LoginActivity.kt index 1d160ef..4fae4bc 100644 --- a/app/src/main/java/com/stand/standapp/LoginActivity.kt +++ b/app/src/main/java/com/stand/standapp/LoginActivity.kt @@ -152,7 +152,7 @@ class LoginActivity : AppCompatActivity() { // 使用 Handler 替代硬编码 Thread.sleep,避免阻塞或随意开辟线程 android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({ try { - com.example.kingway.ptt.SendAtUtil.toLogin("gzzdweb01", "123456", "61.243.1.123", 1, 1) + com.example.kingway.ptt.SendAtUtil.toLogin(username, "123456", "220.154.131.231", 1, 1) } catch (e: Exception) { Timber.tag("PTT").e(e, "PTT login error") } diff --git a/app/src/main/res/drawable/ic_fire_logo.png b/app/src/main/res/drawable/ic_fire_logo.png new file mode 100644 index 0000000..ccf35dc Binary files /dev/null and b/app/src/main/res/drawable/ic_fire_logo.png differ diff --git a/app/src/main/res/drawable/ic_fire_logo.xml b/app/src/main/res/drawable/ic_fire_logo.xml deleted file mode 100644 index 63f2fbb..0000000 --- a/app/src/main/res/drawable/ic_fire_logo.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 1f62c35..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml deleted file mode 100644 index 70bf28c..0000000 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_main.png b/app/src/main/res/drawable/ic_launcher_main.png new file mode 100644 index 0000000..c231a47 Binary files /dev/null and b/app/src/main/res/drawable/ic_launcher_main.png differ diff --git a/app/src/main/res/drawable/ic_launcher_main.xml b/app/src/main/res/drawable/ic_launcher_main.xml deleted file mode 100644 index 8d0a890..0000000 --- a/app/src/main/res/drawable/ic_launcher_main.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index d0929dc..0fb9d23 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -72,14 +72,14 @@ android:textSize="20sp" /> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="15dp" + android:text="测试账号 锋: test004 助力农: test005 kui: test006 密码: 123456 必须,不然用不了ptt(或者2个后台都要加)" + android:textColor="#CCFFFFFF" + android:textSize="14sp" /> - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 6f3b755..0000000 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a65e917 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..a65e917 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..ffbf6a4 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..ffbf6a4 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..49bd31b Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..49bd31b Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..6f18235 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..6f18235 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..c231a47 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..c231a47 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ