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 {