feat(proxy): 探针输出美化 + 一键复制原始输出
Some checks are pending
Release / build (push) Waiting to run

- 调试输出改为滚动等宽代码块,状态一眼可读
- 新增“复制全部”按钮,一键把原始输出写入剪贴板
- 版本升至 1.7.3
This commit is contained in:
Liuxinyu176 2026-10-09 10:28:19 +08:00
parent a804d46acd
commit dcd5cab2b2
2 changed files with 44 additions and 8 deletions

View File

@ -16,8 +16,8 @@ android {
applicationId = "com.rainy.token"
minSdk = 31
targetSdk = 35
versionCode = 22
versionName = "1.7.2"
versionCode = 23
versionName = "1.7.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {

View File

@ -2,7 +2,17 @@ package com.rainy.token.ui.settings
import android.app.Activity
import android.os.Build
import android.widget.Toast
import android.content.ClipboardManager
import android.content.ClipData
import android.content.Context
import androidx.compose.foundation.clickable
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.draw.clip
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@ -207,6 +217,7 @@ private fun ProxyGatewayCard(
onTestTrae: () -> Unit,
onTestWorkBuddy: () -> Unit
) {
val context = LocalContext.current
Card(
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(20.dp),
@ -257,14 +268,39 @@ private fun ProxyGatewayCard(
}
}
if (debug != null) {
Spacer(modifier = Modifier.padding(top = 8.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "原始输出",
style = MaterialTheme.typography.labelSmall,
color = InkMuted,
modifier = Modifier.weight(1f)
)
TextButton(onClick = {
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
clipboard.setPrimaryClip(ClipData.newPlainText("代理网关探针输出", debug))
Toast.makeText(context, "已复制全部原始输出", Toast.LENGTH_SHORT).show()
}) {
Text("复制全部")
}
}
Box(
modifier = Modifier
.fillMaxWidth()
.heightIn(max = 220.dp)
.clip(RoundedCornerShape(12.dp))
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.6f))
.verticalScroll(rememberScrollState())
.padding(10.dp)
) {
Text(
text = debug,
style = MaterialTheme.typography.bodySmall,
color = InkMuted,
modifier = Modifier.padding(top = 4.dp)
style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace),
color = InkMuted
)
}
}
}
Switch(
checked = running,
onCheckedChange = onToggle