修正长休提示与实际时长不一致

This commit is contained in:
XIGE
2026-11-28 12:43:59 +08:00
parent 8875d60c0d
commit 2241773a49
2 changed files with 7 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
# 变更记录 # 变更记录
## 2026-11-28 · 修正长休提示与实际时长不一致
- 同步源码更新 1 个文件(新增/修改 1,删除 0)。
## 2026-11-28 · v0.5.2:倒计时读数、输入法遮挡与备注显示修复 ## 2026-11-28 · v0.5.2:倒计时读数、输入法遮挡与备注显示修复
- **倒计时读数冻结**:根因是空闲时页面会移除 250ms 轮询,而点击「开始专注 / 开始休息」只调用 `render()`,没有重新挂上轮询,圆环内数字停在点击那一刻。改为每次 `render()` 末尾统一同步轮询状态:运行且页面可见时挂上,空闲或隐藏时撤掉;前台服务继续负责息屏走时与到点结算。 - **倒计时读数冻结**:根因是空闲时页面会移除 250ms 轮询,而点击「开始专注 / 开始休息」只调用 `render()`,没有重新挂上轮询,圆环内数字停在点击那一刻。改为每次 `render()` 末尾统一同步轮询状态:运行且页面可见时挂上,空闲或隐藏时撤掉;前台服务继续负责息屏走时与到点结算。

View File

@@ -478,7 +478,9 @@ object TimerCore {
// 提示里要报的是"下一段"的真实时长:第四轮专注后应提示长休,而不是固定 5 分钟 // 提示里要报的是"下一段"的真实时长:第四轮专注后应提示长休,而不是固定 5 分钟
val nextMinutes = if (wasFocus) { val nextMinutes = if (wasFocus) {
val every = Prefs.longBreakEvery.coerceAtLeast(2) val every = Prefs.longBreakEvery.coerceAtLeast(2)
if ((round + 1) % every == 0) Prefs.longBreakMinutes else Prefs.shortBreakMinutes // 与 advanceFromFocus() 用同一个判定:第 4 轮完成后 round=4,实际进入长休,
// 提示也必须报长休时长;不能拿 round+1 去算,否则第 3/4 轮的提示会说反。
if (round > 0 && round % every == 0) Prefs.longBreakMinutes else Prefs.shortBreakMinutes
} else Prefs.focusMinutes } else Prefs.focusMinutes
if (wasFocus) { if (wasFocus) {
advanceFromFocus() advanceFromFocus()