项目任务行恢复统计口径与完成记录对齐任务页(v3.9)
This commit is contained in:
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,5 +1,18 @@
|
|||||||
# 变更记录
|
# 变更记录
|
||||||
|
|
||||||
|
## 2026-12-01 · 项目任务行恢复统计口径与完成记录对齐任务页(v3.9)
|
||||||
|
|
||||||
|
- 同步源码更新 4 个文件(新增/修改 4,删除 0)。
|
||||||
|
|
||||||
|
## 2026-12-01 · 项目任务行恢复统计口径、完成记录对齐任务页(v3.9)
|
||||||
|
|
||||||
|
- 项目展开顶部任务行恢复为「任务名称 + 专注时长 + 最近完成 + 累计次数/累计专注」,不再用「截止/随时」代替任务时间。
|
||||||
|
- 顶部任务行不划线、不变灰:那是「创建了就一直在」的清单,只有删除才消失,不受完成、重复影响。
|
||||||
|
- 完成记录行与任务页底部一致:任务名划线(备注不划线),meta 为「日期 周几 起-止 · 专注X」;没有真实专注时长(如自动完成)只写完成时刻。
|
||||||
|
- 专注页选任务行同样改为任务时间(专注时长),不写截止/随时、不标完成或逾期。
|
||||||
|
- 仅改 `ProjectAdapter.kt`、`FocusFragment.kt` 与 `item_project_task.xml` 注释;v3.8 的重复任务自动完成、逾期口径收窄、项目任务与完成记录来源不变。
|
||||||
|
- versionCode 63 / versionName 3.9,签名不变(7bcbd511…cc8c83),可覆盖安装 v3.8。
|
||||||
|
|
||||||
## 2026-12-01 · 重复任务自动完成与项目页口径对齐(v3.8)
|
## 2026-12-01 · 重复任务自动完成与项目页口径对齐(v3.8)
|
||||||
|
|
||||||
- 重复任务不再计逾期:任务页的「已逾期」标记与逾期分桶只对不重复任务(`repeat_type=0`)生效;`Store.tasks` 的 `includeOverdue` 过滤同步收窄,重复实例不会被当成逾期行。
|
- 重复任务不再计逾期:任务页的「已逾期」标记与逾期分桶只对不重复任务(`repeat_type=0`)生效;`Store.tasks` 的 `includeOverdue` 过滤同步收窄,重复实例不会被当成逾期行。
|
||||||
|
|||||||
@@ -555,11 +555,8 @@ class FocusFragment : Fragment(R.layout.fragment_focus) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
tasks.forEach { t ->
|
tasks.forEach { t ->
|
||||||
val meta = if (t.due > 0) {
|
// 行内只写任务时间(专注时长),不挂截止/随时、也不标完成或逾期
|
||||||
"${Dates.dueLabel(t.due)}截止"
|
val meta = "${t.focusMinutes}分钟"
|
||||||
} else {
|
|
||||||
getString(R.string.time_anytime)
|
|
||||||
}
|
|
||||||
addRow(
|
addRow(
|
||||||
title = t.title,
|
title = t.title,
|
||||||
meta = meta,
|
meta = meta,
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.focusbox.app.ui.projects
|
|||||||
|
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
|
import android.text.Spannable
|
||||||
|
import android.text.SpannableString
|
||||||
|
import android.text.style.StrikethroughSpan
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -140,20 +143,29 @@ class ProjectAdapter(
|
|||||||
val btnPlay: ImageView = item.findViewById(R.id.btnTaskPlay)
|
val btnPlay: ImageView = item.findViewById(R.id.btnTaskPlay)
|
||||||
item.findViewById<View>(R.id.taskColorBar).background = ctx.roundBg(p.color, 2f)
|
item.findViewById<View>(R.id.taskColorBar).background = ctx.roundBg(p.color, 2f)
|
||||||
|
|
||||||
|
// 顶部是「创建了就一直在」的任务清单:不划线、不变灰;
|
||||||
|
// 完成与否只体现在下面的完成记录里
|
||||||
tvTitle.text = task.title
|
tvTitle.text = task.title
|
||||||
tvTitle.setTextColor(ctx.col(if (task.done) R.color.text_tertiary else R.color.text))
|
tvTitle.setTextColor(ctx.col(R.color.text))
|
||||||
tvTitle.paintFlags = if (task.done) {
|
tvTitle.paintFlags = tvTitle.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||||
tvTitle.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
|
|
||||||
} else {
|
|
||||||
tvTitle.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 任务名称下面的时间:只有截止时间(无截止写「随时」),不挂完成与逾期状态
|
// 任务时间(专注时长)· 最近完成 · 累计次数与累计专注
|
||||||
tvMeta.text = if (task.due > 0) {
|
val parts = ArrayList<String>(3)
|
||||||
"${Dates.dueLabel(task.due)}截止"
|
parts.add("${task.focusMinutes}分钟")
|
||||||
} else {
|
if (row.lastDoneAt > 0) {
|
||||||
ctx.getString(R.string.time_anytime)
|
val whenText = "${Dates.md(row.lastDoneAt)}·${Dates.hm(row.lastDoneAt)}"
|
||||||
|
parts.add(ctx.getString(R.string.project_task_last_done, whenText))
|
||||||
}
|
}
|
||||||
|
val totals = StringBuilder()
|
||||||
|
if (row.doneCount > 0) {
|
||||||
|
totals.append(ctx.getString(R.string.project_task_done_count, row.doneCount))
|
||||||
|
}
|
||||||
|
if (row.focusSeconds > 0) {
|
||||||
|
// 累计专注只写「数字分钟」,不加说明文案,也不留空格
|
||||||
|
totals.append(row.focusSeconds / 60).append("分钟")
|
||||||
|
}
|
||||||
|
if (totals.isNotEmpty()) parts.add(totals.toString())
|
||||||
|
tvMeta.text = parts.joinToString(" · ")
|
||||||
|
|
||||||
btnPlay.visible(!task.done)
|
btnPlay.visible(!task.done)
|
||||||
btnPlay.tint(ctx.col(R.color.brand))
|
btnPlay.tint(ctx.col(R.color.brand))
|
||||||
@@ -173,19 +185,31 @@ class ProjectAdapter(
|
|||||||
val btnPlay: ImageView = item.findViewById(R.id.btnTaskPlay)
|
val btnPlay: ImageView = item.findViewById(R.id.btnTaskPlay)
|
||||||
btnPlay.visible(false)
|
btnPlay.visible(false)
|
||||||
|
|
||||||
tvTitle.text = if (record.note.isBlank()) {
|
// 完成记录与任务页底部一致:任务名划线,完成原因跟在后面但不划线
|
||||||
|
val noteText = record.note.replace('\n', ' ')
|
||||||
|
val titleText = if (noteText.isBlank()) {
|
||||||
record.taskTitle
|
record.taskTitle
|
||||||
} else {
|
} else {
|
||||||
"${record.taskTitle} · ${record.note.replace('\n', ' ')}"
|
"${record.taskTitle} · $noteText"
|
||||||
}
|
}
|
||||||
|
val line = SpannableString(titleText)
|
||||||
|
if (record.taskTitle.isNotEmpty()) {
|
||||||
|
line.setSpan(
|
||||||
|
StrikethroughSpan(), 0, record.taskTitle.length,
|
||||||
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
tvTitle.text = line
|
||||||
tvTitle.setTextColor(ctx.col(R.color.text_secondary))
|
tvTitle.setTextColor(ctx.col(R.color.text_secondary))
|
||||||
tvTitle.paintFlags = tvTitle.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
tvTitle.paintFlags = tvTitle.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||||
|
|
||||||
// 完成记录与任务页同口径:显示完成时刻;有真实专注时长才追加时长
|
// 与任务页完成记录同格式:日期 周几 起-止 · 专注X;没有真实时长就只写完成时刻
|
||||||
val metaText = StringBuilder()
|
tvMeta.text = if (record.seconds > 0) {
|
||||||
metaText.append("${Dates.md(record.endAt)}·${Dates.hm(record.endAt)}完成")
|
"${Dates.dateWithWeek(record.startAt)} ${Dates.hms(record.startAt)}" +
|
||||||
if (record.seconds > 0) metaText.append(" · 专注${Dates.duration(record.seconds)}")
|
"-${Dates.hms(record.endAt)} · 专注${Dates.duration(record.seconds)}"
|
||||||
tvMeta.text = metaText.toString()
|
} else {
|
||||||
|
"${Dates.dateWithWeek(record.endAt)} ${Dates.hms(record.endAt)}完成"
|
||||||
|
}
|
||||||
item.isClickable = false
|
item.isClickable = false
|
||||||
item.setOnClickListener(null)
|
item.setOnClickListener(null)
|
||||||
taskList.addView(item)
|
taskList.addView(item)
|
||||||
|
|||||||
@@ -539,6 +539,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val VERSION = "3.8"
|
const val VERSION = "3.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- 项目卡展开后的任务行:结构与任务列表一致,但不显示分类(项目名),
|
<!-- 项目卡展开后的任务行:结构与任务列表一致,但不显示分类(项目名)。
|
||||||
meta 改为「单轮时长 · 最近完成时间 · 累计完成次数」,右侧保留开始按钮。 -->
|
顶部任务行 meta =「专注时长 · 最近完成 · 累计次数+累计专注」,不划线;
|
||||||
|
完成记录行同一布局,任务名划线、meta 为「日期 周几 起-止 · 专注X」。 -->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
Reference in New Issue
Block a user