完成文案改字;横屏分割线只分时间;置顶图标黑色bug修复恢复品牌蓝;完成删除线恢复,版本 1.7
This commit is contained in:
@@ -127,16 +127,17 @@ class TaskAdapter(
|
||||
)
|
||||
}
|
||||
|
||||
tvTitle.text = title
|
||||
// 完成横线只画任务名本身(StrikethroughSpan 限定区间),
|
||||
// 后面的重要度/紧急度/置顶图标不跟着划线
|
||||
tvTitle.paintFlags = tvTitle.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||
// 后面的重要度/紧急度/置顶图标不跟着划线。
|
||||
// 注意:span 必须在 tvTitle.text = title 之前挂好
|
||||
if (task.done) {
|
||||
title.setSpan(
|
||||
android.text.style.StrikethroughSpan(),
|
||||
0, task.title.length, 0,
|
||||
)
|
||||
}
|
||||
tvTitle.text = title
|
||||
tvTitle.paintFlags = tvTitle.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||
tvTitle.setTextColor(ctx.col(if (task.done) R.color.text_tertiary else R.color.text))
|
||||
tvTitle.typeface = if (task.priority >= 2 && !task.done) Typeface.DEFAULT_BOLD else Typeface.DEFAULT
|
||||
|
||||
@@ -211,9 +212,10 @@ class TaskAdapter(
|
||||
* 置顶图标:圆圈内向上箭头。
|
||||
* 自绘而不是用字体字形——常用字体里没有"圆圈+箭头"的组合字符,
|
||||
* 画出来才能精确控制圆圈与箭头同色、且和重要度圆圈数字(0.85 倍字号)等高。
|
||||
* 颜色用品牌蓝(R.color.brand,深浅色主题各有一版),与之前的 ↑ 字符颜色一致。
|
||||
*/
|
||||
private class PinIconSpan(
|
||||
private val color: Int,
|
||||
private val iconColor: Int,
|
||||
private val size: Float,
|
||||
) : android.text.style.ReplacementSpan() {
|
||||
|
||||
@@ -239,12 +241,13 @@ private class PinIconSpan(
|
||||
val cx = x + s / 2f
|
||||
// 与 ①②③ 字形对齐:圆圈数字贴基线站立,圆心约在基线上方 0.5 个图标高
|
||||
val cy = baseline - s * 0.5f
|
||||
val p = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
this.color = color
|
||||
style = Paint.Style.STROKE
|
||||
strokeWidth = s / 8f
|
||||
strokeCap = Paint.Cap.ROUND
|
||||
}
|
||||
// 不能用 apply { this.color = ... }:作用域里 color 会命中 Paint 自己的
|
||||
// color 属性(默认黑色),把外面的品牌蓝遮掉——就是那版"图标变黑"的原因
|
||||
val p = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
p.color = iconColor
|
||||
p.style = Paint.Style.STROKE
|
||||
p.strokeWidth = s / 8f
|
||||
p.strokeCap = Paint.Cap.ROUND
|
||||
canvas.drawCircle(cx, cy, s / 2f - p.strokeWidth / 2f, p)
|
||||
|
||||
// 向上箭头:竖杆 + 两条斜线,整体落在圆内
|
||||
|
||||
Reference in New Issue
Block a user