通知完成卡文案更新;已完成显示紧急度;饼图标注对称;热力图标签间距;重要度改竖线图标;重复新增随时置顶(v0.9)

This commit is contained in:
XIGE
2026-11-29 09:49:18 +08:00
parent cac0fc66f4
commit e5111fdf79
10 changed files with 91 additions and 31 deletions

View File

@@ -84,22 +84,41 @@ class TaskAdapter(
val task = row.task
val ctx = itemView.context
// 紧急度五角星直接拼在标题后:紧急三颗红 / 中两颗绿 / 不急一颗灰;
// 完成任务不再显示。用 spannable 保证星星紧贴标题而不是被推到行尾。
// 标题右侧的属性图标,未完成与已完成都显示:
// 重要度竖线(高3/中2/低1,颜色与紧急度同色系)→ 紧急度五角星 → 随时图钉。
// 用 spannable 保证图标紧贴标题而不是被推到行尾。
val title = SpannableStringBuilder(task.title)
if (!task.done) {
val (stars, color) = when (task.urgency) {
2 -> " ★★★" to R.color.urgent_high
1 -> " ★★" to R.color.urgent_mid
else -> " ★" to R.color.urgent_low
}
val start = title.length
title.append(stars)
title.setSpan(
android.text.style.ForegroundColorSpan(ctx.col(color)), start, title.length, 0
)
title.setSpan(RelativeSizeSpan(0.95f), start, title.length, 0)
val (bars, barColor) = when (task.priority) {
2 -> " ▏▏▏" to R.color.urgent_high
1 -> " ▏▏" to R.color.urgent_mid
else -> " ▏" to R.color.urgent_low
}
title.append(bars)
title.setSpan(
android.text.style.ForegroundColorSpan(ctx.col(barColor)),
title.length - bars.length, title.length, 0
)
title.setSpan(RelativeSizeSpan(0.95f), title.length - bars.length, title.length, 0)
// 紧急度五角星:紧急三颗红 / 中两颗绿 / 不急一颗灰
val (stars, starColor) = when (task.urgency) {
2 -> " ★★★" to R.color.urgent_high
1 -> " ★★" to R.color.urgent_mid
else -> " ★" to R.color.urgent_low
}
title.append(stars)
title.setSpan(
android.text.style.ForegroundColorSpan(ctx.col(starColor)),
title.length - stars.length, title.length, 0
)
title.setSpan(RelativeSizeSpan(0.95f), title.length - stars.length, title.length, 0)
// 「随时」任务:标题后带置顶图钉,列表里排在未完成最前面
if (task.repeatType == com.focusbox.app.model.Repeat.ANYTIME && !task.done) {
title.append(" 📌")
}
tvTitle.text = title
tvTitle.paintFlags = if (task.done) {
tvTitle.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
@@ -156,7 +175,7 @@ class TaskAdapter(
val label = Dates.dueLabel(task.due)
parts.add(if (row.overdue) ctx.getString(R.string.task_meta_overdue, label) else label)
}
if (task.priority >= 2) parts.add(ctx.getString(R.string.task_priority_high))
// 重要度已改为标题后的竖线图标,meta 里不再重复「高优先」文字
return parts.joinToString(" · ")
}
}