diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/components/Dialogs.kt b/app/src/main/kotlin/cn/super12138/todo/ui/components/Dialogs.kt
index f9f192a..313faca 100644
--- a/app/src/main/kotlin/cn/super12138/todo/ui/components/Dialogs.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/ui/components/Dialogs.kt
@@ -29,7 +29,10 @@ fun WarningDialog(
text = { Text(description) },
confirmButton = stringResource(R.string.action_confirm),
dismissButton = stringResource(R.string.action_cancel),
- onConfirm = onConfirm,
+ onConfirm = {
+ onConfirm()
+ onDismiss()
+ },
onDismiss = onDismiss,
modifier = modifier
)
diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt
index 297a2bb..c323d8c 100644
--- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt
@@ -68,7 +68,8 @@ fun TodoEditorPage(
animatedVisibilityScope: AnimatedVisibilityScope,
modifier: Modifier = Modifier
) {
- var showConfirmDialog by rememberSaveable { mutableStateOf(false) }
+ var showExitConfirmDialog by rememberSaveable { mutableStateOf(false) }
+ var showDeleteConfirmDialog by rememberSaveable { mutableStateOf(false) }
val context = LocalContext.current
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
@@ -84,7 +85,7 @@ fun TodoEditorPage(
if ((toDo?.subject ?: 0) != selectedSubjectIndex) isModified = true
if ((toDo?.priority ?: 0f) != priorityState) isModified = true
if (isModified) {
- showConfirmDialog = true
+ showExitConfirmDialog = true
} else {
onNavigateUp()
}
@@ -105,20 +106,20 @@ fun TodoEditorPage(
icon = {
Icon(
imageVector = Icons.Outlined.Delete,
- contentDescription = stringResource(R.string.action_delete)
+ contentDescription = null
)
},
text = { Text(stringResource(R.string.action_delete)) },
expanded = true,
containerColor = MaterialTheme.colorScheme.errorContainer,
- onClick = onDelete
+ onClick = { showDeleteConfirmDialog = true }
)
}
AnimatedExtendedFloatingActionButton(
icon = {
Icon(
imageVector = Icons.Outlined.Save,
- contentDescription = stringResource(R.string.action_save)
+ contentDescription = null
)
},
text = { Text(stringResource(R.string.action_save)) },
@@ -246,13 +247,21 @@ fun TodoEditorPage(
}
WarningDialog(
- visible = showConfirmDialog,
+ visible = showExitConfirmDialog,
icon = Icons.AutoMirrored.Outlined.Undo,
description = stringResource(R.string.tip_discard_changes),
onConfirm = {
- showConfirmDialog = false
+ showExitConfirmDialog = false
onNavigateUp()
},
- onDismiss = { showConfirmDialog = false }
+ onDismiss = { showExitConfirmDialog = false }
+ )
+
+ WarningDialog(
+ visible = showDeleteConfirmDialog,
+ icon = Icons.Outlined.Delete,
+ description = stringResource(R.string.tip_delete_task, 1),
+ onConfirm = onDelete,
+ onDismiss = { showDeleteConfirmDialog = false }
)
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/MainPage.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/MainPage.kt
index 743a115..14157d9 100644
--- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/MainPage.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/main/MainPage.kt
@@ -212,10 +212,7 @@ fun MainPage(
visible = showDeleteConfirmDialog,
icon = Icons.Outlined.Delete,
description = stringResource(R.string.tip_delete_task, selectedTodoIds.value.size),
- onConfirm = {
- showDeleteConfirmDialog = false
- viewModel.deleteSelectedTodo()
- },
+ onConfirm = { viewModel.deleteSelectedTodo() },
onDismiss = { showDeleteConfirmDialog = false }
)
}
\ No newline at end of file
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 002a7be..9d6ee8c 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -31,7 +31,7 @@
已选择 %s 项
确定
警告
- 即将删除你选择的 %s 项待办。删除后将无法恢复这些待办,确定删除?
+ 即将删除 %s 项待办。删除后将无法恢复这些待办,确定删除?
返回
关于
关于本应用
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3454b95..c0020af 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -30,7 +30,7 @@
%s selected
Confirm
Warning
- You are about to delete the %s selected tasks. Once deleted, these tasks cannot be recovered. Are you sure you want to delete them?
+ You are about to delete the %s tasks. Once deleted, these tasks cannot be recovered. Are you sure you want to delete them?
/
Back
About