From 3b4cd103d016846ad57f287a29bc65f98071e516 Mon Sep 17 00:00:00 2001 From: Liuxinyu176 <1041316040@qq.com> Date: Sun, 13 Sep 2026 13:14:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(sub2api):=20tab=E6=94=B9=E7=BA=AF=E6=96=87?= =?UTF-8?q?=E5=AD=97=E6=A0=B7=E5=BC=8F=EF=BC=9B=E5=8E=BB=E6=8E=89=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E3=80=8C=E6=8C=89=E6=A8=A1=E5=9E=8B=E3=80=8D=E6=A0=87?= =?UTF-8?q?=E9=A2=98=EF=BC=9B=E4=BB=8A=E5=A4=A9=E6=98=8E=E7=BB=86=E6=8C=89?= =?UTF-8?q?=E5=B0=8F=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 「按模型 / 按 Key」tab 从 FilterChip 按钮改为纯 Text + clickable, 去掉按钮背景和圆角,更像文字标签而非按钮。 2. MODEL tab 下方原来有一行「按模型」小标题(sub2_models_header), 和 tab 本身重复,去掉。 3. 「今天」窗口的每日用量明细从隐藏改为按小时倒序列出, 每行显示 HH:00 + 请求/tokens/费用。 --- .../ui/servicedetail/Sub2ApiUsageCard.kt | 61 +++++++++++-------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/rainy/token/ui/servicedetail/Sub2ApiUsageCard.kt b/app/src/main/java/com/rainy/token/ui/servicedetail/Sub2ApiUsageCard.kt index 10e3a79..d7b25ff 100644 --- a/app/src/main/java/com/rainy/token/ui/servicedetail/Sub2ApiUsageCard.kt +++ b/app/src/main/java/com/rainy/token/ui/servicedetail/Sub2ApiUsageCard.kt @@ -271,15 +271,26 @@ internal fun Sub2ApiUsageCard( ) } - // 每日明细只在按天且有数据时列出(按小时时逐小时列会过长) - if (!isHourly) { - Spacer(modifier = Modifier.height(12.dp)) - Text( - text = stringResource(R.string.sub2_daily_header), - style = MaterialTheme.typography.labelLarge, - color = inkMuted() - ) - Spacer(modifier = Modifier.height(6.dp)) + // 每日/每小时明细列表 + Spacer(modifier = Modifier.height(12.dp)) + Text( + text = stringResource(R.string.sub2_daily_header), + style = MaterialTheme.typography.labelLarge, + color = inkMuted() + ) + Spacer(modifier = Modifier.height(6.dp)) + if (isHourly) { + // 「今天」按小时:倒序展示每小时明细 + chartSeries.reversed().forEachIndexed { index, hour -> + DailyRow(hour) + if (index != chartSeries.lastIndex) { + HorizontalDivider( + modifier = Modifier.padding(vertical = 2.dp), + color = MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.4f) + ) + } + } + } else { days.reversed().forEachIndexed { index, day -> DailyRow(day) if (index != days.lastIndex) { @@ -303,17 +314,21 @@ internal fun Sub2ApiUsageCard( HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.5f)) Spacer(modifier = Modifier.height(10.dp)) - // tab 切换:按模型 / 按 Key(文字样式,非按钮) - Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { - FilterChip( - selected = detailTab == DetailTab.MODEL, - onClick = { detailTab = DetailTab.MODEL }, - label = { Text(stringResource(R.string.sub2_tab_by_model)) } + // tab 切换:按模型 / 按 Key(纯文字 tab,非按钮) + Row(horizontalArrangement = Arrangement.spacedBy(20.dp)) { + Text( + text = stringResource(R.string.sub2_tab_by_model), + style = MaterialTheme.typography.labelLarge, + fontWeight = if (detailTab == DetailTab.MODEL) FontWeight.SemiBold else FontWeight.Normal, + color = if (detailTab == DetailTab.MODEL) MaterialTheme.colorScheme.primary else inkMuted(), + modifier = Modifier.clickable { detailTab = DetailTab.MODEL } ) - FilterChip( - selected = detailTab == DetailTab.KEY, - onClick = { detailTab = DetailTab.KEY }, - label = { Text(stringResource(R.string.sub2_tab_by_key)) } + Text( + text = stringResource(R.string.sub2_tab_by_key), + style = MaterialTheme.typography.labelLarge, + fontWeight = if (detailTab == DetailTab.KEY) FontWeight.SemiBold else FontWeight.Normal, + color = if (detailTab == DetailTab.KEY) MaterialTheme.colorScheme.primary else inkMuted(), + modifier = Modifier.clickable { detailTab = DetailTab.KEY } ) } Spacer(modifier = Modifier.height(12.dp)) @@ -321,14 +336,6 @@ internal fun Sub2ApiUsageCard( if (detailTab == DetailTab.KEY) { KeyUsageSection(keyStatsState) } else { - Text( - text = stringResource(R.string.sub2_models_header) + - if (windowStatsAllTime) stringResource(R.string.sub2_models_alltime_suffix) else "", - style = MaterialTheme.typography.labelLarge, - color = inkMuted() - ) - Spacer(modifier = Modifier.height(8.dp)) - // 模型筛选 chips(按当前周期内有数据的模型;「全部」时用网关全量) LazyRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) { item {