diff --git a/app/src/main/java/com/placeholder/ringhealth/feature/profile/ProfileScreen.kt b/app/src/main/java/com/placeholder/ringhealth/feature/profile/ProfileScreen.kt index 1848493..4471e94 100644 --- a/app/src/main/java/com/placeholder/ringhealth/feature/profile/ProfileScreen.kt +++ b/app/src/main/java/com/placeholder/ringhealth/feature/profile/ProfileScreen.kt @@ -1,18 +1,138 @@ package com.placeholder.ringhealth.feature.profile -import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.AccountCircle +import androidx.compose.material.icons.filled.Info +import androidx.compose.material.icons.filled.Notifications +import androidx.compose.material.icons.filled.Refresh +import androidx.compose.material.icons.filled.Settings +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import com.placeholder.ringhealth.R +import com.placeholder.ringhealth.core.designsystem.MetricGreen +import com.placeholder.ringhealth.core.designsystem.RingHealthTheme +import com.placeholder.ringhealth.core.designsystem.TextSecondary +import com.placeholder.ringhealth.core.designsystem.component.HealthCard +import com.placeholder.ringhealth.core.designsystem.component.SectionHeader -/** 我的页(占位,待 Task 11 实现)。 */ +/** + * “我的”页。全部为静态入口,无状态、无 ViewModel。 + * + * 本页**不需要**再拆「有状态外壳 + 无状态内容」(ledger Ruling R26 的常规形状): + * 它本身就是无状态的,直接对它挂 `@Preview` 即可。 + */ @Composable fun ProfileScreen(modifier: Modifier = Modifier) { - Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) { - Text(stringResource(R.string.tab_profile)) + LazyColumn( + modifier = modifier.fillMaxSize(), + contentPadding = PaddingValues(16.dp), + verticalArrangement = Arrangement.spacedBy(12.dp), + ) { + item { + HealthCard { + Row(verticalAlignment = Alignment.CenterVertically) { + Icon( + imageVector = Icons.Filled.AccountCircle, + contentDescription = null, + tint = MetricGreen, + modifier = Modifier.size(48.dp), + ) + Column(modifier = Modifier.padding(start = 12.dp)) { + Text( + text = stringResource(R.string.profile_nickname), + style = MaterialTheme.typography.titleMedium, + ) + Text( + text = stringResource(R.string.profile_login_hint), + style = MaterialTheme.typography.bodySmall, + color = TextSecondary, + ) + } + } + } + } + item { SectionHeader(title = stringResource(R.string.profile_group_app)) } + item { + ProfileEntry( + icon = Icons.Filled.Settings, + title = stringResource(R.string.profile_units), + subtitle = stringResource(R.string.profile_units_desc), + ) + } + item { + ProfileEntry( + icon = Icons.Filled.Notifications, + title = stringResource(R.string.profile_notification), + subtitle = stringResource(R.string.profile_notification_desc), + ) + } + item { SectionHeader(title = stringResource(R.string.profile_group_about)) } + item { + ProfileEntry( + icon = Icons.Filled.Refresh, + title = stringResource(R.string.profile_check_update), + subtitle = stringResource(R.string.profile_check_update_desc), + ) + } + item { + ProfileEntry( + icon = Icons.Filled.Info, + title = stringResource(R.string.profile_help), + subtitle = stringResource(R.string.profile_help_desc), + ) + } + } +} + +/** 单条设置入口。 */ +@Composable +private fun ProfileEntry( + icon: ImageVector, + title: String, + subtitle: String, + modifier: Modifier = Modifier, +) { + HealthCard(modifier = modifier) { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + ) { + Icon( + imageVector = icon, + contentDescription = null, + tint = TextSecondary, + modifier = Modifier.size(20.dp), + ) + Column(modifier = Modifier.padding(start = 12.dp)) { + Text(text = title, style = MaterialTheme.typography.titleSmall) + Text(text = subtitle, style = MaterialTheme.typography.bodySmall, color = TextSecondary) + } + } + } +} + +/** 预览入口:直接渲染 [ProfileScreen](本页无状态、无示例数据),便于在 IDE 中免真机查看“我的”页效果。 */ +@Preview(showBackground = true) +@Composable +private fun ProfileScreenPreview() { + RingHealthTheme { + ProfileScreen() } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d85569c..a71cb89 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,4 +54,17 @@ 已开启 已关闭 阶段一为演示开关,接入戒指后将同步到设备。 + + 健康用户 + 登录后可同步数据(阶段一未开放) + 应用设置 + 单位设置 + 公里 / 公斤 + 通知权限 + 接收健康提醒 + 关于 + 检查更新 + 当前版本 0.1.0 + 帮助与反馈 + 常见问题与意见反馈