From f840740a1a6b042c7da38c385b06dc8d8befbdfc Mon Sep 17 00:00:00 2001 From: "844143714@qq,com" <844143714@qq,com> Date: Sun, 19 Jul 2026 03:20:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/stand/standapp/MainActivity.kt | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/stand/standapp/MainActivity.kt b/app/src/main/java/com/stand/standapp/MainActivity.kt index deef858..4b0a660 100644 --- a/app/src/main/java/com/stand/standapp/MainActivity.kt +++ b/app/src/main/java/com/stand/standapp/MainActivity.kt @@ -214,7 +214,7 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) geckoView = findViewById(R.id.geckoView) - ?: return + ?: return findViewById(R.id.btn_retry)?.setOnClickListener { hideErrorPage() @@ -388,7 +388,7 @@ class MainActivity : AppCompatActivity() { val result = handleBridgeCall(payload, prompt.defaultValue ?: "") return GeckoResult.fromValue(prompt.confirm(result)) } - + // 默认处理(显示对话框) val res = GeckoResult() runOnUiThread { @@ -499,19 +499,19 @@ class MainActivity : AppCompatActivity() { fun logout() { runOnUiThread { Timber.tag("MainActivity").i("用户注销,清理程序") - + // 1. PTT Logout and cancel login - try { - com.example.kingway.ptt.SendAtUtil.toCancelLogin() - } catch (e: Exception) { - Timber.tag("MainActivity").e(e, "PTT cancel failed") - } - try { - com.example.kingway.ptt.SendAtUtil.toLogout() - Timber.tag("MainActivity").i("PTT logout sent") - } catch (e: Exception) { - Timber.tag("MainActivity").e(e, "PTT logout failed") - } +// try { +// com.example.kingway.ptt.SendAtUtil.toCancelLogin() +// } catch (e: Exception) { +// Timber.tag("MainActivity").e(e, "PTT cancel failed") +// } +// try { +// com.example.kingway.ptt.SendAtUtil.toLogout() +// Timber.tag("MainActivity").i("PTT logout sent") +// } catch (e: Exception) { +// Timber.tag("MainActivity").e(e, "PTT logout failed") +// } // 2. Stop GPIO listening try { @@ -520,6 +520,20 @@ class MainActivity : AppCompatActivity() { } catch (e: Exception) { Timber.tag("MainActivity").e(e, "GPIO stop failed") } + try { + resetAutoJumpStates() + CallBackResolution.resetPttLoginStatus(); + }catch (e: Exception) { + Timber.tag("MainActivity").e(e, "Failed to clear public value") + } + + // 4. Stop and destroy AudioRecord + try { + com.example.kingway.ptt.AudioRecordManager.destroy() + Timber.tag("MainActivity").i("AudioRecordManager destroyed") + } catch (e: Exception) { + Timber.tag("MainActivity").e(e, "AudioRecordManager destroy failed") + } // 3. Destroy/release AudioTrack in PTT Native try { @@ -530,14 +544,6 @@ class MainActivity : AppCompatActivity() { Timber.tag("MainActivity").e(e, "PTT native destroy failed") } - // 4. Stop and destroy AudioRecord - try { - com.example.kingway.ptt.AudioRecordManager.destroy() - Timber.tag("MainActivity").i("AudioRecordManager destroyed") - } catch (e: Exception) { - Timber.tag("MainActivity").e(e, "AudioRecordManager destroy failed") - } - // 5. Close printer connection and reset try { com.stand.standapp.printer.PrinterManager.destroy() @@ -563,12 +569,6 @@ class MainActivity : AppCompatActivity() { } catch (e: Exception) { Timber.tag("MainActivity").e(e, "Failed to redirect to LoginActivity") } - try { - resetAutoJumpStates() - CallBackResolution.resetPttLoginStatus(); - }catch (e: Exception) { - Timber.tag("MainActivity").e(e, "Failed to clear public value") - } } }