v0.3.0:今日筛选含逾期与今日完成、统计今日区间、重复任务自动滚动、通知自定义布局

This commit is contained in:
XIGE
2026-11-28 01:07:24 +08:00
parent 7c8dc3d0de
commit 3e237fafdb
11 changed files with 301 additions and 56 deletions

View File

@@ -117,9 +117,17 @@ class TasksFragment : Fragment(R.layout.fragment_tasks) {
ViewFilter.TODAY -> {
val from = Dates.todayStart()
val to = Dates.addDays(from, 1)
val today = pending.filter { it.due >= from && it.due < to }
today.forEach { rows.add(toRow(it, spans)) }
tvCount.text = getString(R.string.task_count_today, today.size)
// 今日 = 截止日不晚于今天且未完成(含逾期,逾期本就该今天处理)
// + 今天勾选完成的任务
val dueToday = pending.filter { it.due > 0 && it.due < to }
val doneToday = done.filter { it.doneAt >= from && it.doneAt < to }
dueToday.forEach { rows.add(toRow(it, spans)) }
doneToday.forEach { rows.add(toRow(it, spans)) }
tvCount.text = if (doneToday.isEmpty()) {
getString(R.string.task_count_today, dueToday.size)
} else {
getString(R.string.task_count_today_mixed, dueToday.size, doneToday.size)
}
tvEmpty.setText(R.string.empty_today)
}