项目展开完成记录加开始按钮,专注页无任务改为立即创建(v3.10)
This commit is contained in:
@@ -32,7 +32,7 @@ class TaskSheet(
|
||||
context: Context,
|
||||
private val existing: Task?,
|
||||
presetProjectId: Long,
|
||||
private val onSaved: () -> Unit,
|
||||
private val onSaved: (Long) -> Unit,
|
||||
) : SheetDialog(context) {
|
||||
|
||||
private val root = LayoutInflater.from(context).inflate(R.layout.sheet_task, null)
|
||||
@@ -110,7 +110,7 @@ class TaskSheet(
|
||||
// 否则计时继续走,到点后完成记录会落成"未关联任务"
|
||||
if (TimerCore.taskId == it.id) TimerCore.setTask(0, 0)
|
||||
}
|
||||
onSaved()
|
||||
onSaved(0L)
|
||||
dismiss()
|
||||
}
|
||||
.show()
|
||||
@@ -258,7 +258,8 @@ class TaskSheet(
|
||||
periodic && due <= 0 -> Dates.todayStart()
|
||||
else -> due
|
||||
}
|
||||
if (existing == null) {
|
||||
// 回传任务 id:专注页「没有任务 → 立即创建」需要拿新行 id 自动选中
|
||||
val savedId = if (existing == null) {
|
||||
Store.addTask(title, note, projectId, priority, focusMin, effectiveDue, repeatType, every, urgency)
|
||||
} else {
|
||||
Store.updateTask(
|
||||
@@ -274,8 +275,9 @@ class TaskSheet(
|
||||
repeatEvery = every,
|
||||
)
|
||||
)
|
||||
existing.id
|
||||
}
|
||||
onSaved()
|
||||
onSaved(savedId)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user