diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dc4fc9d..1fd602e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -47,11 +47,17 @@ android:label="@string/app_name" android:theme="@style/Theme.StandAPP" /> + + + android:theme="@style/Theme.StandAPP" /> (R.id.btn_close).setOnClickListener { + finish() + } + + // PTT 测试 + findViewById(R.id.item_ptt).setOnClickListener { + startActivity(Intent(this, com.example.kingway.ptt.pttActivity::class.java)) + } + + // 打印测试 + findViewById(R.id.item_printer).setOnClickListener { + startActivity(Intent(this, com.stand.standapp.printer.PrintTestActivity::class.java)) + } + + // 崩溃模拟 + findViewById(R.id.item_crash_test).setOnClickListener { + androidx.appcompat.app.AlertDialog.Builder(this) + .setTitle("确认崩溃测试?") + .setMessage("应用将立即崩溃并尝试记录日志,确定继续吗?") + .setPositiveButton("确定") { _, _ -> + throw RuntimeException("这是一次开发者手动触发的模拟崩溃测试") + } + .setNegativeButton("取消", null) + .show() + } + + // 加载调试信息 + loadDebugInfo() + } + + private fun loadDebugInfo() { + val tvInfo = findViewById(R.id.tv_debug_info) + val info = StringBuilder() + info.append("设备型号: ${Build.MODEL}\n") + info.append("系统版本: Android ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT})\n") + info.append("架构(ABI): ${Build.SUPPORTED_ABIS.joinToString(", ")}\n") + info.append("运行模式: ${if (android.os.Process.is64Bit()) "64位" else "32位兼容模式"}\n") + info.append("服务器地址: ${AppConfig.getServerUrl(this)}\n") + info.append("串口路径: ${AppConfig.getSerialPort(this)}") + + tvInfo.text = info.toString() + } +} diff --git a/app/src/main/java/com/stand/standapp/LoginActivity.kt b/app/src/main/java/com/stand/standapp/LoginActivity.kt index 4eb8375..4afac80 100644 --- a/app/src/main/java/com/stand/standapp/LoginActivity.kt +++ b/app/src/main/java/com/stand/standapp/LoginActivity.kt @@ -1,14 +1,15 @@ package com.stand.standapp +import android.content.Context import android.content.Intent import android.os.Bundle -import timber.log.Timber import android.widget.* import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity +import com.stand.standapp.printer.PrinterManager import okhttp3.* -import okhttp3.MediaType.Companion.toMediaType import org.json.JSONObject +import timber.log.Timber import java.io.IOException class LoginActivity : AppCompatActivity() { @@ -23,9 +24,9 @@ class LoginActivity : AppCompatActivity() { val etPassword = findViewById(R.id.et_password) val cbRemember = findViewById(R.id.cb_remember) val btnLogin = findViewById