diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1531e38..d4dd776 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -34,7 +34,7 @@ android { applicationId = "cn.super12138.todo" minSdk = 24 targetSdk = 36 - versionCode = 675 + versionCode = 676 versionName = "2.1.2" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/ProgressFragment.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/ProgressFragment.kt index 80bd87c..6593b58 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/ProgressFragment.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/ProgressFragment.kt @@ -11,6 +11,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.clearAndSetSemantics +import androidx.compose.ui.semantics.stateDescription import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import cn.super12138.todo.R @@ -30,6 +32,17 @@ fun ProgressFragment( 0f } + val progressDescription = if (totalTasks != 0) { + stringResource( + R.string.accessibility_progress_tasks, + totalTasks, + completedTasks, + remainTasks + ) + } else { + stringResource(R.string.accessibility_progress_no_tasks) + } + Box( modifier = modifier, contentAlignment = Alignment.Center @@ -38,11 +51,18 @@ fun ProgressFragment( progress = progress, strokeWidth = 10.dp, gapSize = 10.dp, - modifier = Modifier.size(175.dp) + modifier = Modifier + .size(175.dp) + .clearAndSetSemantics {} ) Column(horizontalAlignment = Alignment.CenterHorizontally) { - Row(verticalAlignment = Alignment.CenterVertically) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.clearAndSetSemantics { + stateDescription = progressDescription + } + ) { Text( text = completedTasks.toString(), style = MaterialTheme.typography.displaySmall.copy( @@ -65,7 +85,8 @@ fun ProgressFragment( AnimatedVisibility(remainTasks != 0) { Text( text = stringResource(R.string.tip_remain_tasks, remainTasks), - style = MaterialTheme.typography.labelMedium + style = MaterialTheme.typography.labelMedium, + modifier = Modifier.clearAndSetSemantics {} ) } } diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 87b18e4..7a4a3d8 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -110,4 +110,6 @@ 待办1岁生日快乐 自定义 输入学科名称 + 当前共有 %1$d 项任务,其中 %2$d 项已完成,%3$d 项未完成 + 当前没有任务 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9e2854f..c2fefa2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -111,4 +111,6 @@ Happy 1st birthday to ToDo Customization Enter subject name + Currently, there are %1$d tasks in total, with %2$d completed and %3$d unfinished. + There are no tasks at the moment. \ No newline at end of file