From ac9019d56a70d8ef13d0358ae6417da62cbd0041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E9=B2=81=E6=AD=A3?= <13780741225@163.com> Date: Thu, 10 Sep 2026 10:18:54 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E6=AD=A3=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E4=B8=AD=E7=9A=84=E7=A1=AC=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E6=96=87=E6=A1=88=EF=BC=88R9=EF=BC=89=EF=BC=8C=E8=A1=A5?= =?UTF-8?q?=E9=BD=90=20stringResource=20=E7=94=A8=E6=B3=95=E4=B8=8E?= =?UTF-8?q?=E8=AD=A6=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plans/2026-09-10-ring-health-app-m0-m1.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/superpowers/plans/2026-09-10-ring-health-app-m0-m1.md b/superpowers/plans/2026-09-10-ring-health-app-m0-m1.md index 19b9355..58e3a03 100644 --- a/superpowers/plans/2026-09-10-ring-health-app-m0-m1.md +++ b/superpowers/plans/2026-09-10-ring-health-app-m0-m1.md @@ -385,6 +385,7 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource /** 唯一 Activity,承载 Compose 界面。 */ class MainActivity : ComponentActivity() { @@ -395,7 +396,7 @@ class MainActivity : ComponentActivity() { MaterialTheme { Surface(modifier = Modifier.fillMaxSize()) { Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { - Text("RingHealth") + Text(stringResource(R.string.app_name)) } } } @@ -631,14 +632,19 @@ setContent { RingHealthTheme { Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { - Text("RingHealth") + Text(stringResource(R.string.app_name)) } } } } ``` -并补充 import:`com.placeholder.ringhealth.core.designsystem.RingHealthTheme`。 +并补充 import:`com.placeholder.ringhealth.core.designsystem.RingHealthTheme`、 +`androidx.compose.ui.res.stringResource`。 + +注意:文案必须走 `stringResource(R.string.app_name)`,不得写成 `Text("RingHealth")` 字面量 —— +全局约束「不硬编码用户可见文案」对 Compose 里的每一处 `Text(...)` 都成立。Task 1 的初版 +就是因为计划里的示例代码写成了字面量而引入该缺陷,修复轮才扳正(见 ledger 裁定)。 - [ ] **Step 5: 构建验证**