2 Commits
v1.6 ... v1.7

7 changed files with 64 additions and 15 deletions

View File

@@ -1,8 +1,16 @@
# 变更记录 # 变更记录
## 2026-11-29 · 完成任务删除线只画任务名;置顶改圆圈箭头图标;饼图中心删小字居中;悬浮窗权限已开启不可点;每日目标可输入去上限,版本 1.6 ## 2026-11-29 · 完成文案改字;横屏分割线只分时间;置顶图标黑色bug修复恢复品牌蓝;完成删除线恢复,版本 1.7
- 同步源码更新 5 个文件(新增/修改 5,删除 0)。 - 同步源码更新 6 个文件(新增/修改 6,删除 0)。
## 2026-11-29 · 锁屏/通知/任务列表细节修复(v1.7)
- 任务完成文案:「恭喜你,再接再厉,休息下再继续」→「再接再厉,短暂的休息下再继续」(通知与锁屏共用)
- 横屏锁屏分割线:只分割两块大时间——运行时把分割线高度对齐倒计时文字的实际渲染高度(Activity 与悬浮窗两条链路都同步),不再盖住下方任务名/日期行
- 置顶图标颜色修复:PinIconSpan 在 `Paint(...).apply { this.color = color }` 里,作用域内 color 被 Paint 自身属性遮蔽,实际画的是 Paint 默认黑色——改名 iconColor 并显式赋值,恢复品牌蓝;深色 #64A8FF / 浅色 #2F80ED 自动适配
- 已完成删除线恢复:StrikethroughSpan 之前在 tvTitle.text 赋值之后才挂 span 导致不生效,移到赋值之前;仍然只划任务名、不划图标
- versionCode 41
## 2026-11-29 · 任务列表/统计细节打磨(v1.6) ## 2026-11-29 · 任务列表/统计细节打磨(v1.6)

View File

@@ -137,11 +137,30 @@ object LockOverlay {
view.findViewById<TextView>(R.id.tvLockClock)?.text = clockFmt.format(cal.time) view.findViewById<TextView>(R.id.tvLockClock)?.text = clockFmt.format(cal.time)
view.findViewById<TextView>(R.id.tvLockCountdown)?.text = Dates.clock(now) view.findViewById<TextView>(R.id.tvLockCountdown)?.text = Dates.clock(now)
syncDivider(view)
val task = if (TimerCore.taskId > 0) Store.task(TimerCore.taskId)?.title else null val task = if (TimerCore.taskId > 0) Store.task(TimerCore.taskId)?.title else null
view.findViewById<TextView>(R.id.tvLockTask)?.text = view.findViewById<TextView>(R.id.tvLockTask)?.text =
task?.takeIf { it.isNotBlank() } ?: view.context.getString(R.string.notif_no_task) task?.takeIf { it.isNotBlank() } ?: view.context.getString(R.string.notif_no_task)
} }
/**
* 横屏排版里的分割线只分割两块大时间:高度对齐倒计时文字的实际渲染高度。
* 竖屏布局没有这个控件,查找结果为 null 直接跳过。
*/
private fun syncDivider(view: View) {
val divider = view.findViewById<View>(R.id.lockDivider) ?: return
val countdown = view.findViewById<TextView>(R.id.tvLockCountdown) ?: return
divider.post {
if (countdown.height > 0 && divider.layoutParams != null &&
divider.layoutParams.height != countdown.height
) {
divider.layoutParams.height = countdown.height
divider.requestLayout()
}
}
}
/** Calendar 的 DAY_OF_WEEK(周日=1)转成 weekdayShort 的下标(周一=0 … 周日=6) */ /** Calendar 的 DAY_OF_WEEK(周日=1)转成 weekdayShort 的下标(周一=0 … 周日=6) */
private fun weekdayIndex(cal: Calendar): Int = (cal.get(Calendar.DAY_OF_WEEK) + 5) % 7 private fun weekdayIndex(cal: Calendar): Int = (cal.get(Calendar.DAY_OF_WEEK) + 5) % 7
} }

View File

@@ -156,10 +156,28 @@ class LockScreenActivity : AppCompatActivity() {
tvClock.text = clockFmt.format(cal.time) tvClock.text = clockFmt.format(cal.time)
tvCountdown.text = Dates.clock(now) tvCountdown.text = Dates.clock(now)
syncDivider()
val task = if (TimerCore.taskId > 0) Store.task(TimerCore.taskId)?.title else null val task = if (TimerCore.taskId > 0) Store.task(TimerCore.taskId)?.title else null
tvTask.text = task?.takeIf { it.isNotBlank() } ?: getString(R.string.notif_no_task) tvTask.text = task?.takeIf { it.isNotBlank() } ?: getString(R.string.notif_no_task)
} }
/**
* 横屏排版里的分割线只分割两块大时间:高度对齐倒计时文字的实际渲染高度,
* 不再盖住下方的任务名/日期行。竖屏布局没有这个控件,查找结果为 null 直接跳过。
*/
private fun syncDivider() {
val divider = findViewById<View>(R.id.lockDivider) ?: return
divider.post {
if (tvCountdown.height > 0 && divider.layoutParams != null &&
divider.layoutParams.height != tvCountdown.height
) {
divider.layoutParams.height = tvCountdown.height
divider.requestLayout()
}
}
}
/** Calendar 的 DAY_OF_WEEK(周日=1)转成 weekdayShort 的下标(周一=0 … 周日=6) */ /** Calendar 的 DAY_OF_WEEK(周日=1)转成 weekdayShort 的下标(周一=0 … 周日=6) */
private fun weekdayIndex(cal: Calendar): Int = (cal.get(Calendar.DAY_OF_WEEK) + 5) % 7 private fun weekdayIndex(cal: Calendar): Int = (cal.get(Calendar.DAY_OF_WEEK) + 5) % 7
} }

View File

@@ -539,6 +539,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
} }
companion object { companion object {
const val VERSION = "1.6" const val VERSION = "1.7"
} }
} }

View File

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

View File

@@ -43,8 +43,9 @@
android:textSize="15sp" /> android:textSize="15sp" />
</LinearLayout> </LinearLayout>
<!-- 中:细分隔线 --> <!-- 中:细分隔线(只分割两块大时间,高度运行时对齐倒计时文字的实际高度) -->
<View <View
android:id="@+id/lockDivider"
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="180dp" android:layout_height="180dp"
android:background="#26FFFFFF" /> android:background="#26FFFFFF" />

View File

@@ -222,7 +222,7 @@
<string name="notif_action_stop">结束</string> <string name="notif_action_stop">结束</string>
<string name="notif_no_task">未选择任务</string> <string name="notif_no_task">未选择任务</string>
<string name="notif_focus_done">任务完成</string> <string name="notif_focus_done">任务完成</string>
<string name="notif_focus_done_text">恭喜你,再接再厉,休息下再继续</string> <string name="notif_focus_done_text">再接再厉,短暂的休息下再继续</string>
<string name="notif_break_done">休息结束</string> <string name="notif_break_done">休息结束</string>
<string name="notif_break_done_text">准备好就开始下一轮</string> <string name="notif_break_done_text">准备好就开始下一轮</string>