Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d8995ead0 | ||
|
|
4444b18b29 | ||
|
|
11dc2825cc | ||
|
|
2dd7f8b506 | ||
|
|
3277fa5826 | ||
|
|
00a01b3f22 | ||
|
|
01ca852b2a | ||
|
|
8e7de267a4 | ||
|
|
9305bd588b | ||
|
|
77319b30da | ||
|
|
8694908305 | ||
|
|
5b58596727 | ||
|
|
7762e463d6 | ||
|
|
3cad26fbdb | ||
|
|
035da90a76 | ||
|
|
68b9961784 | ||
|
|
d03fb45adf | ||
|
|
e7089ae76b |
79
CHANGELOG.md
79
CHANGELOG.md
@@ -1,5 +1,84 @@
|
|||||||
# 变更记录
|
# 变更记录
|
||||||
|
|
||||||
|
## 2026-11-30 · 分割线左右等距 + 等宽数字(v2.4)
|
||||||
|
|
||||||
|
- 起因:v2.3 垂直对齐成功后,用户反馈线到左右两边时间的水平间隙不相等。
|
||||||
|
- 诊断(实测而非猜测):布局左右两栏 weight 严格对称,分割线恒在正中;下载 Roboto-Bold 解析 hmtx 并用 Pillow 复核,10 个数字 advance 全部 0.5737em(等宽),`DD:DD` 恒等于 2.5771em。间隙不等只能来自系统字体(鸿蒙 HarmonyOS Sans 数字非等宽)或倒计时 ≥100 分钟时的 6 位(3.1509em)。
|
||||||
|
- 方案双保险:①左栏右对齐 + marginEnd 24dp、右栏左对齐 + marginStart 24dp——线到两边时间的布局间隙无条件恒等;②两侧大时间与锚点加 `fontFeatureSettings="tnum"`,系统字体支持时强制数字等宽、消除逐秒抖动(不支持则无副作用)。
|
||||||
|
- 视觉变化:时间从「半屏居中」改为「贴线排布」,文字向外生长,与线的距离恒定。
|
||||||
|
- 改动文件:layout-land/activity_lock_screen.xml、build.gradle.kts、build.sh、SettingsFragment.kt。
|
||||||
|
- 本地验证:构建通过,aapt2 确认 versionCode 48 / versionName 2.4,签名 SHA-256 7bcbd511…cc8c83 不变。
|
||||||
|
- 升级说明:直接覆盖安装,无数据迁移。
|
||||||
|
|
||||||
|
## 2026-11-30 · 分割线中列完整镜像,真正与时间上下对齐(v2.3)
|
||||||
|
|
||||||
|
- 起因:v2.2 修复无效——锚点 FrameLayout 与左右两栏同被 `center_vertical` 居中,但锚点列只有时间高(T),侧栏多出「10dp+15sp 小字」(C>T),高度不同的列各自居中后顶不对齐,锚点中心仍落在屏幕中心,与旧版位置完全相同。
|
||||||
|
- 方案:中列完整镜像左右两栏——`vertical LinearLayout` 内①1dp FrameLayout(130sp 粗体不可见锚点文字 + center 分割线)②与侧栏同规格(15sp、marginTop 10dp)的不可见小字占位。三列同高同顶,锚点中心严格等于时间中心。锚点文字加 `maxLines=1`,防止 1dp 宽父容器把 "00:00" 折行撑高。
|
||||||
|
- 纯静态 XML,锁屏/悬浮窗两条链路同时生效;字体缩放同步。
|
||||||
|
- 改动文件:layout-land/activity_lock_screen.xml、build.gradle.kts、build.sh、SettingsFragment.kt。
|
||||||
|
- 本地验证:构建通过,aapt 确认 versionCode 47 / versionName 2.3,签名 SHA-256 7bcbd511…cc8c83 不变。
|
||||||
|
- 升级说明:直接覆盖安装,无数据迁移。
|
||||||
|
|
||||||
|
## 2026-11-30 · 横屏分割线与时间上下精确对齐(v2.2)
|
||||||
|
|
||||||
|
- 起因:用户反馈分割线高度已与左右时间一致,但位置偏下、底部超出时间墨迹边线。
|
||||||
|
- 根因:分割线是横排 `center_vertical` LinearLayout 的直系子 View,居中基准是整个左右两栏(时间 + 10dp 间距 + 15sp 小字),下方多出的一截把线中心下拉约 15dp。
|
||||||
|
- 方案:镜像锚点——分割线外套 1dp 宽 FrameLayout,内放与左右时间同规格(130sp 粗体、includeFontPadding=false)的不可见占位文字,分割线在其中 center 对齐;线中心严格等于时间文字中心。纯静态 XML,不受锁屏/悬浮窗特殊窗口运行时布局失效问题影响,字体缩放变化也同步。悬浮窗复用同一布局,两条链路同时生效。
|
||||||
|
- 改动文件:layout-land/activity_lock_screen.xml、build.gradle.kts、build.sh、SettingsFragment.kt。
|
||||||
|
- 本地验证:构建通过,aapt 确认 versionCode 46 / versionName 2.2,签名 SHA-256 7bcbd511…cc8c83 不变。
|
||||||
|
- 升级说明:直接覆盖安装,无数据迁移。
|
||||||
|
|
||||||
|
## 2026-11-30 · 分割线降至与时间等高 + 改项目迁移关联任务 + 重要紧急排序(v2.1)
|
||||||
|
|
||||||
|
- 分割线:150dp 偏高,降到 92dp(≈130sp 粗体数字字面高度 0.71em×130),与左右时间视觉等高。
|
||||||
|
- 改项目重复 bug:编辑已有任务换项目时,只有当前行更新了 project_id,而周期系列的其他实例(origin_id=根id)和完成记录副本(origin_id=实例id)都还复制着旧项目,导致新旧项目各显示一份同名任务。现在 updateTask 检测到项目变化时,把根任务、系列实例、实例的完成记录副本一起迁移到新项目(带旧项目条件保证幂等);编辑完成记录副本本身则只移动该行、不牵连源任务。
|
||||||
|
- 普通任务排序:改为按重要度+紧急度总分降序(各 0低/1中/2高,总分 4→0 对应:最重要最紧急 → 最重要或最紧急 → 中重要中紧急 → 中重要或中紧急 → 低低),同分内再按有截止日优先/截止日升序/创建先后。置顶、逾期分组保持在前不变。
|
||||||
|
- 改动文件:layout-land/activity_lock_screen.xml、Store.kt、build.gradle.kts、build.sh、SettingsFragment.kt。
|
||||||
|
- 本地验证:构建通过,aapt 确认 versionCode 45 / versionName 2.1,签名 SHA-256 7bcbd511…cc8c83 不变。
|
||||||
|
- 升级说明:直接覆盖安装,无数据迁移。
|
||||||
|
|
||||||
|
## 2026-11-30 · 分割线恢复原始可见实现 + 逾期任务置顶后优先(v2.0)
|
||||||
|
|
||||||
|
- 起因:v1.9 分割线仍不可见(match_parent 结构化方案也失效);用户确认最初静态 View 方案可见,要求恢复原实现只调高度;另要求逾期任务排在列表前面、置顶之后。
|
||||||
|
- 分割线方案:横屏布局整体恢复最初可见版本的原始结构——静态 View(1dp 宽)直接放在左右两栏之间,固定 150dp 高(≈130sp 时间文字墨迹高度 1.17×130sp,仅分割时间不盖下方文字),零运行时代码。
|
||||||
|
- 逾期排序:Store.tasks 的 ORDER BY 增加逾期分组层,未完成任务顺序变为:①随时置顶 ②已逾期(due>0 且 due<今天0点,阈值由 Dates.todayStart() 在查询时算好)③其余按截止日/优先级不变;逾期只提升位置,组内顺序不变。
|
||||||
|
- 改动文件:layout-land/activity_lock_screen.xml、Store.kt、build.gradle.kts、build.sh、SettingsFragment.kt。
|
||||||
|
- 本地验证:构建通过,aapt 确认 versionCode 44 / versionName 2.0,签名 SHA-256 7bcbd511…cc8c83 不变。
|
||||||
|
- 升级说明:直接覆盖安装,无数据迁移。
|
||||||
|
|
||||||
|
## 2026-11-30 · 横屏分割线结构化对齐(v1.9)
|
||||||
|
|
||||||
|
- 起因:分割线高度连续两版用「运行时改 LayoutParams」(View.post / fontMetrics 计算后 requestLayout)都在锁屏/悬浮窗链路上失效,线不显示。
|
||||||
|
- 根因:运行时改高度依赖布局系统对特殊窗口的重新布局,链路不可靠。
|
||||||
|
- 方案:改为纯 XML 结构约束——横屏布局重排为上下两行:上行「倒计时 | 分割线 | 时钟」同行排布,分割线 layout_height=match_parent 直接继承行高(行高即 130sp 时间文字高度);下行「任务名 | 占位 | 日期」与上行两栏逐列对齐。删除 Activity 与 LockOverlay 里的 syncDivider 代码,零运行时逻辑。
|
||||||
|
- 改动文件:layout-land/activity_lock_screen.xml、LockScreenActivity.kt、LockOverlay.kt、build.gradle.kts、build.sh、SettingsFragment.kt。
|
||||||
|
- 本地验证:构建通过,aapt 确认 versionCode 43 / versionName 1.9,签名 SHA-256 7bcbd511…cc8c83 不变。
|
||||||
|
- 升级说明:直接覆盖安装,无数据迁移。
|
||||||
|
|
||||||
|
## 2026-11-29 · 分割线算法化/删除线居中/置顶图标对齐(v1.8)
|
||||||
|
|
||||||
|
- 横屏分割线消失修复:上一版用 View.post 等布局完成后取 height 再赋值,在锁屏/悬浮窗链路上时机不稳导致线整条消失;改为直接由 paint.fontMetrics 算出文字实际高度(includeFontPadding=false 时 TextView 高度即 ascent..descent 跨度),零时序依赖、立即生效(Activity 与悬浮窗两链路同步)
|
||||||
|
- 删除线视觉居中:系统 StrikethroughSpan 按「字体半高」定位(baseline + ascent/2),数字/汉字实际墨迹顶比字体 ascent 低,线看起来偏下;改为 MidStrikeSpan 自绘——按 getTextBounds 实际墨迹边界取垂直中点,线严格穿过文字中间,仍只划任务名不划图标
|
||||||
|
- 置顶图标对齐与粗细:圈线粗细改为 1/10 图标高(贴近重要度圆圈数字的描边),箭头细化为 1/15;圆心从基线上方 0.50 下移到 0.45 个图标高(圆圈数字底缘本就略过基线,底部对齐不再偏上)
|
||||||
|
- versionCode 42
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
- 已完成任务:删除线只画任务名(StrikethroughSpan 限定区间),后面的重要度圆圈/紧急度星标/置顶图标不再被划线
|
||||||
|
- 「随时」置顶图标:由裸 ↑ 字符改为自绘「圆圈内向上箭头」(PinIconSpan,ReplacementSpan 实现)——圆圈与箭头同为品牌蓝,图标大小与重要度圆圈数字一致(0.85 倍字号)
|
||||||
|
- 统计页两个饼图(项目分布/任务分布):环中心的「总专注」「任务占比」小字删除,累计时间按字体度量把墨迹垂直中心落在圆心,真正居中
|
||||||
|
- 设置页悬浮窗权限行:已授权时不再显示右侧箭头、且整行不可点(该权限无应用内开关,避免误以为可点);未授权保持「去设置」可点跳授权页
|
||||||
|
- 每日目标:数值支持点击弹窗直接输入分钟数(软键盘数字盘,非法输入红框提示),加减步进保留;去除 720 分钟上限(下限 15 防误输)
|
||||||
|
- versionCode 40
|
||||||
|
|
||||||
## 2026-11-29 · 悬浮窗补齐遮状态栏与横竖屏排版;解锁残留秒级自动关窗(v1.5)
|
## 2026-11-29 · 悬浮窗补齐遮状态栏与横竖屏排版;解锁残留秒级自动关窗(v1.5)
|
||||||
|
|
||||||
- 悬浮窗遮状态栏:EMUI 把悬浮窗限制在状态栏以下内容区,顶部时间/信号/电池露出——窗口改为比屏幕更大(高度补状态栏+导航栏)、y 负偏移状态栏高度向上顶出,配 FLAG_LAYOUT_NO_LIMITS 越界绘制,黑底完整盖住状态栏区域(护眼滤镜类 App 同款做法)
|
- 悬浮窗遮状态栏:EMUI 把悬浮窗限制在状态栏以下内容区,顶部时间/信号/电池露出——窗口改为比屏幕更大(高度补状态栏+导航栏)、y 负偏移状态栏高度向上顶出,配 FLAG_LAYOUT_NO_LIMITS 越界绘制,黑底完整盖住状态栏区域(护眼滤镜类 App 同款做法)
|
||||||
|
|||||||
@@ -249,12 +249,17 @@ object Store {
|
|||||||
args.add(projectId.toString())
|
args.add(projectId.toString())
|
||||||
}
|
}
|
||||||
if (!includeDone) where.append(" AND done = 0")
|
if (!includeDone) where.append(" AND done = 0")
|
||||||
// 已完成的按完成时间倒序(最近做完的排前面),未完成的按截止/优先级;
|
// 已完成的按完成时间倒序(最近做完的排前面)。未完成分组依次是:
|
||||||
// 「随时」任务(repeat_type=4)排到未完成最前面,随时可以开始
|
// ①「随时」置顶(repeat_type=4)②已逾期(有截止日且早于今天 0 点)
|
||||||
|
// ③普通任务按重要+紧急总分排(各 0低/1中/2高:4=最重要最紧急、3=最重要或
|
||||||
|
// 最紧急、2=中重要中紧急、1=中重要或中紧急、0=低低),同分再按截止日/先后
|
||||||
|
val todayStart = com.focusbox.app.util.Dates.todayStart()
|
||||||
val sql = "SELECT $taskColumns FROM tasks WHERE $where " +
|
val sql = "SELECT $taskColumns FROM tasks WHERE $where " +
|
||||||
"ORDER BY done ASC, CASE WHEN done = 1 THEN done_at ELSE 0 END DESC, " +
|
"ORDER BY done ASC, CASE WHEN done = 1 THEN done_at ELSE 0 END DESC, " +
|
||||||
"CASE WHEN done = 0 AND repeat_type = ${Repeat.ANYTIME} THEN 0 ELSE 1 END ASC, " +
|
"CASE WHEN done = 0 AND repeat_type = ${Repeat.ANYTIME} THEN 0 ELSE 1 END ASC, " +
|
||||||
"CASE WHEN due = 0 THEN 1 ELSE 0 END ASC, due ASC, priority DESC, _id DESC"
|
"CASE WHEN done = 0 AND due > 0 AND due < $todayStart THEN 0 ELSE 1 END ASC, " +
|
||||||
|
"CASE WHEN done = 0 THEN priority + urgency ELSE 0 END DESC, " +
|
||||||
|
"CASE WHEN due = 0 THEN 1 ELSE 0 END ASC, due ASC, _id DESC"
|
||||||
val list = ArrayList<Task>()
|
val list = ArrayList<Task>()
|
||||||
db.rawQuery(sql, args.toTypedArray()).use { c ->
|
db.rawQuery(sql, args.toTypedArray()).use { c ->
|
||||||
while (c.moveToNext()) list.add(cursorToTask(c))
|
while (c.moveToNext()) list.add(cursorToTask(c))
|
||||||
@@ -300,6 +305,8 @@ object Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateTask(task: Task) {
|
fun updateTask(task: Task) {
|
||||||
|
// 改动前先取旧行:判断项目是否变化、以及该行是不是"完成记录副本"
|
||||||
|
val old = task(task.id)
|
||||||
val cv = ContentValues().apply {
|
val cv = ContentValues().apply {
|
||||||
put("title", task.title)
|
put("title", task.title)
|
||||||
put("note", task.note)
|
put("note", task.note)
|
||||||
@@ -313,6 +320,20 @@ object Store {
|
|||||||
put("repeat_every", task.repeatEvery.coerceAtLeast(1))
|
put("repeat_every", task.repeatEvery.coerceAtLeast(1))
|
||||||
}
|
}
|
||||||
db.update("tasks", cv, "_id = ?", arrayOf(task.id.toString()))
|
db.update("tasks", cv, "_id = ?", arrayOf(task.id.toString()))
|
||||||
|
// 项目变了 → 关联行一起迁移,否则旧项目会残留同名任务:
|
||||||
|
// 周期系列的其他实例(origin_id=根id)和完成记录副本(origin_id=实例id)
|
||||||
|
// 都是创建时从当前行复制的旧项目。完成记录副本本身被编辑时不牵连源任务。
|
||||||
|
if (old != null && old.projectId != task.projectId &&
|
||||||
|
!(old.done && old.repeatType == Repeat.NONE && old.originId > 0)
|
||||||
|
) {
|
||||||
|
val root = if (old.originId > 0) old.originId else old.id
|
||||||
|
db.execSQL(
|
||||||
|
"UPDATE tasks SET project_id = ? WHERE project_id = ? AND (" +
|
||||||
|
"_id = ? OR origin_id = ? OR " +
|
||||||
|
"origin_id IN (SELECT _id FROM tasks WHERE origin_id = ?))",
|
||||||
|
arrayOf(task.projectId, old.projectId, root, root, root),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -94,15 +94,16 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
toggle(getString(R.string.vibrate), Prefs.vibrateOn) { Prefs.vibrateOn = it },
|
toggle(getString(R.string.vibrate), Prefs.vibrateOn) { Prefs.vibrateOn = it },
|
||||||
toggle(getString(R.string.keep_screen_on), Prefs.keepScreenOn) { Prefs.keepScreenOn = it },
|
toggle(getString(R.string.keep_screen_on), Prefs.keepScreenOn) { Prefs.keepScreenOn = it },
|
||||||
toggle(getString(R.string.lock_fullscreen_title), Prefs.lockFullscreen) { Prefs.lockFullscreen = it },
|
toggle(getString(R.string.lock_fullscreen_title), Prefs.lockFullscreen) { Prefs.lockFullscreen = it },
|
||||||
// 悬浮窗权限:锁屏倒计时主链路(鸿蒙拦 Activity 后台启动,悬浮窗不受限)
|
// 悬浮窗权限:锁屏倒计时主链路(鸿蒙拦 Activity 后台启动,悬浮窗不受限)。
|
||||||
action(
|
// 已授权时既没有右侧箭头也不可点——权限本身没有应用内开关,免得误以为能点进去设置
|
||||||
getString(R.string.overlay_perm_title),
|
run {
|
||||||
if (com.focusbox.app.service.LockOverlay.canShow(requireContext())) {
|
val granted = com.focusbox.app.service.LockOverlay.canShow(requireContext())
|
||||||
getString(R.string.perm_granted)
|
if (granted) {
|
||||||
|
action(getString(R.string.overlay_perm_title), getString(R.string.perm_granted), showArrow = false)
|
||||||
} else {
|
} else {
|
||||||
getString(R.string.go_set)
|
action(getString(R.string.overlay_perm_title), getString(R.string.go_set)) { openOverlayPerm() }
|
||||||
},
|
}
|
||||||
) { openOverlayPerm() },
|
},
|
||||||
// 华为/鸿蒙默认拦截后台拉起页面,无悬浮窗权限时的 Activity 兜底链路也要这两项权限;
|
// 华为/鸿蒙默认拦截后台拉起页面,无悬浮窗权限时的 Activity 兜底链路也要这两项权限;
|
||||||
// 放在开关正下方,用户开了开关不生效时第一眼就能看到入口
|
// 放在开关正下方,用户开了开关不生效时第一眼就能看到入口
|
||||||
action(getString(R.string.lock_perm_title), getString(R.string.lock_perm_value)) { openLockPerm() },
|
action(getString(R.string.lock_perm_title), getString(R.string.lock_perm_value)) { openLockPerm() },
|
||||||
@@ -113,6 +114,8 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
stepper(
|
stepper(
|
||||||
getString(R.string.daily_goal),
|
getString(R.string.daily_goal),
|
||||||
getString(R.string.value_minutes, Prefs.dailyGoalMinutes),
|
getString(R.string.value_minutes, Prefs.dailyGoalMinutes),
|
||||||
|
// 数值支持直接点击输入;步进用于微调。Prefs 里没有上限
|
||||||
|
onEdit = { inputDailyGoal() },
|
||||||
) { delta ->
|
) { delta ->
|
||||||
Prefs.dailyGoalMinutes += delta * 15
|
Prefs.dailyGoalMinutes += delta * 15
|
||||||
build()
|
build()
|
||||||
@@ -184,7 +187,8 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
setBackgroundColor(col(R.color.divider))
|
setBackgroundColor(col(R.color.divider))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stepper(title: String, value: String, onChange: (Int) -> Unit): View {
|
/** onEdit 非空时点击数值可直接输入(目前只有每日目标用);onChange 为加减步进 */
|
||||||
|
private fun stepper(title: String, value: String, onEdit: (() -> Unit)? = null, onChange: (Int) -> Unit): View {
|
||||||
val ctx = requireContext()
|
val ctx = requireContext()
|
||||||
val row = LinearLayout(ctx).apply {
|
val row = LinearLayout(ctx).apply {
|
||||||
orientation = LinearLayout.HORIZONTAL
|
orientation = LinearLayout.HORIZONTAL
|
||||||
@@ -205,6 +209,7 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
gravity = Gravity.CENTER
|
gravity = Gravity.CENTER
|
||||||
setTextColor(col(R.color.title))
|
setTextColor(col(R.color.title))
|
||||||
layoutParams = LinearLayout.LayoutParams(dpi(74f), LinearLayout.LayoutParams.WRAP_CONTENT)
|
layoutParams = LinearLayout.LayoutParams(dpi(74f), LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||||
|
if (onEdit != null) setOnClickListener { onEdit() }
|
||||||
})
|
})
|
||||||
row.addView(stepButton("+") { onChange(1) })
|
row.addView(stepButton("+") { onChange(1) })
|
||||||
return row
|
return row
|
||||||
@@ -246,13 +251,19 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
return row
|
return row
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun action(title: String, value: String, danger: Boolean = false, onClick: () -> Unit): View {
|
private fun action(
|
||||||
|
title: String,
|
||||||
|
value: String,
|
||||||
|
danger: Boolean = false,
|
||||||
|
showArrow: Boolean = true,
|
||||||
|
onClick: (() -> Unit)? = null,
|
||||||
|
): View {
|
||||||
val ctx = requireContext()
|
val ctx = requireContext()
|
||||||
val row = LinearLayout(ctx).apply {
|
val row = LinearLayout(ctx).apply {
|
||||||
orientation = LinearLayout.HORIZONTAL
|
orientation = LinearLayout.HORIZONTAL
|
||||||
gravity = Gravity.CENTER_VERTICAL
|
gravity = Gravity.CENTER_VERTICAL
|
||||||
minimumHeight = dpi(54f)
|
minimumHeight = dpi(54f)
|
||||||
setOnClickListener { onClick() }
|
if (onClick != null) setOnClickListener { onClick() }
|
||||||
}
|
}
|
||||||
row.addView(TextView(ctx).apply {
|
row.addView(TextView(ctx).apply {
|
||||||
text = title
|
text = title
|
||||||
@@ -268,11 +279,13 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
setPadding(0, 0, dpi(6f), 0)
|
setPadding(0, 0, dpi(6f), 0)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
row.addView(android.widget.ImageView(ctx).apply {
|
if (showArrow) {
|
||||||
setImageResource(R.drawable.ic_chevron_right)
|
row.addView(android.widget.ImageView(ctx).apply {
|
||||||
tint(col(R.color.text_tertiary))
|
setImageResource(R.drawable.ic_chevron_right)
|
||||||
layoutParams = LinearLayout.LayoutParams(dpi(15f), dpi(15f))
|
tint(col(R.color.text_tertiary))
|
||||||
})
|
layoutParams = LinearLayout.LayoutParams(dpi(15f), dpi(15f))
|
||||||
|
})
|
||||||
|
}
|
||||||
return row
|
return row
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,6 +341,78 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 每日目标:弹小窗直接输入分钟数(无上限,下限 15 由 Prefs 兜底) */
|
||||||
|
private fun inputDailyGoal() {
|
||||||
|
val ctx = requireContext()
|
||||||
|
val dialog = android.app.Dialog(ctx)
|
||||||
|
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
|
||||||
|
|
||||||
|
val panel = LinearLayout(ctx).apply {
|
||||||
|
orientation = LinearLayout.VERTICAL
|
||||||
|
background = ctx.roundBg(ctx.col(R.color.surface), 16f, ctx.col(R.color.card_stroke), 1f)
|
||||||
|
setPadding(dpi(20f), dpi(20f), dpi(20f), dpi(14f))
|
||||||
|
}
|
||||||
|
panel.addView(TextView(ctx).apply {
|
||||||
|
text = getString(R.string.daily_goal)
|
||||||
|
textSize = 16f
|
||||||
|
typeface = Typeface.DEFAULT_BOLD
|
||||||
|
setTextColor(col(R.color.text))
|
||||||
|
})
|
||||||
|
val et = android.widget.EditText(ctx).apply {
|
||||||
|
inputType = android.text.InputType.TYPE_CLASS_NUMBER
|
||||||
|
setText(Prefs.dailyGoalMinutes.toString())
|
||||||
|
textSize = 15f
|
||||||
|
setTextColor(col(R.color.text))
|
||||||
|
background = ctx.roundBg(ctx.col(R.color.surface_alt), 12f)
|
||||||
|
setPadding(dpi(14f), dpi(12f), dpi(14f), dpi(12f))
|
||||||
|
layoutParams = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
).apply { topMargin = dpi(14f) }
|
||||||
|
}
|
||||||
|
panel.addView(et)
|
||||||
|
et.requestFocus()
|
||||||
|
|
||||||
|
val btnRow = LinearLayout(ctx).apply {
|
||||||
|
orientation = LinearLayout.HORIZONTAL
|
||||||
|
gravity = Gravity.END
|
||||||
|
setPadding(0, dpi(12f), 0, 0)
|
||||||
|
}
|
||||||
|
fun btn(labelRes: Int, onClick: () -> Unit) = TextView(ctx).apply {
|
||||||
|
text = getString(labelRes)
|
||||||
|
textSize = 14f
|
||||||
|
typeface = Typeface.DEFAULT_BOLD
|
||||||
|
gravity = Gravity.CENTER
|
||||||
|
setTextColor(col(R.color.brand))
|
||||||
|
background = ctx.roundBg(ctx.col(R.color.surface_alt), 12f)
|
||||||
|
setPadding(dpi(22f), dpi(10f), dpi(22f), dpi(10f))
|
||||||
|
setOnClickListener { onClick() }
|
||||||
|
}
|
||||||
|
btnRow.addView(btn(R.string.cancel) { dialog.dismiss() })
|
||||||
|
btnRow.addView(btn(R.string.save) {
|
||||||
|
val input = et.text.toString().trim().toIntOrNull()
|
||||||
|
if (input != null) {
|
||||||
|
Prefs.dailyGoalMinutes = input
|
||||||
|
dialog.dismiss()
|
||||||
|
build()
|
||||||
|
} else {
|
||||||
|
et.error = " "
|
||||||
|
}
|
||||||
|
}, LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply {
|
||||||
|
marginStart = dpi(10f)
|
||||||
|
})
|
||||||
|
panel.addView(btnRow)
|
||||||
|
|
||||||
|
dialog.setContentView(panel)
|
||||||
|
dialog.show()
|
||||||
|
// 弹窗不自动抢输入法焦点,手动拉起软键盘
|
||||||
|
et.postDelayed({
|
||||||
|
val imm = ctx.getSystemService(android.content.Context.INPUT_METHOD_SERVICE)
|
||||||
|
as? android.view.inputmethod.InputMethodManager
|
||||||
|
imm?.showSoftInput(et, android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT)
|
||||||
|
}, 100L)
|
||||||
|
}
|
||||||
|
|
||||||
/** 悬浮窗权限:标准 Android 特殊权限,有公开检测 API 和授权页,一键直达本应用 */
|
/** 悬浮窗权限:标准 Android 特殊权限,有公开检测 API 和授权页,一键直达本应用 */
|
||||||
private fun openOverlayPerm() {
|
private fun openOverlayPerm() {
|
||||||
val ctx = requireContext()
|
val ctx = requireContext()
|
||||||
@@ -454,6 +539,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val VERSION = "1.5"
|
const val VERSION = "2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,8 +205,6 @@ class PeriodDistributionCard @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
donut.centerText = Dates.durationBrief(raw.sumOf { it.seconds })
|
donut.centerText = Dates.durationBrief(raw.sumOf { it.seconds })
|
||||||
donut.centerCaption =
|
|
||||||
context.getString(if (byTask) R.string.task_share else R.string.total_focus)
|
|
||||||
|
|
||||||
tvPeriod.text = periodLabel(from, to)
|
tvPeriod.text = periodLabel(from, to)
|
||||||
applySegments()
|
applySegments()
|
||||||
|
|||||||
@@ -116,24 +116,26 @@ class TaskAdapter(
|
|||||||
)
|
)
|
||||||
title.setSpan(RelativeSizeSpan(0.95f), title.length - stars.length, title.length, 0)
|
title.setSpan(RelativeSizeSpan(0.95f), title.length - stars.length, title.length, 0)
|
||||||
|
|
||||||
// 「随时」任务:标题后带品牌蓝上箭头表示置顶,列表里排在未完成最前面。
|
// 「随时」任务:标题后带品牌蓝圆圈上箭头表示置顶,列表里排在未完成最前面。
|
||||||
// ↑ 字形窄、两侧留白大,全角空格会显得左边距比五角星宽,
|
// 图标与重要度圆圈数字同规格(0.85 倍字号,圆圈里画向上箭头),
|
||||||
// 改用细空格(U+2009)让两侧间隙与星标一致。
|
// 圆圈与箭头同色(品牌蓝);前面的细空格(U+2009)保持与星标的间距一致。
|
||||||
if (task.repeatType == com.focusbox.app.model.Repeat.ANYTIME && !task.done) {
|
if (task.repeatType == com.focusbox.app.model.Repeat.ANYTIME && !task.done) {
|
||||||
title.append("\u2009↑")
|
title.append("\u2009 ")
|
||||||
title.setSpan(
|
title.setSpan(
|
||||||
android.text.style.ForegroundColorSpan(ctx.col(R.color.brand)),
|
PinIconSpan(ctx.col(R.color.brand), tvTitle.textSize * 0.85f),
|
||||||
title.length - 2, title.length, 0
|
title.length - 1, title.length, 0,
|
||||||
)
|
)
|
||||||
title.setSpan(RelativeSizeSpan(0.85f), title.length - 2, title.length, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tvTitle.text = title
|
// 完成横线只画任务名本身(MidStrikeSpan 限定区间,且划线取文字墨迹
|
||||||
tvTitle.paintFlags = if (task.done) {
|
// 的垂直中点——系统 StrikethroughSpan 用整字面半高定位,数字/汉字
|
||||||
tvTitle.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
|
// 会让线显得偏下)。重要度/紧急度/置顶图标不跟着划线。
|
||||||
} else {
|
// 注意:span 必须在 tvTitle.text = title 之前挂好
|
||||||
tvTitle.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
if (task.done) {
|
||||||
|
title.setSpan(MidStrikeSpan(), 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
|
||||||
|
|
||||||
@@ -203,3 +205,90 @@ class TaskAdapter(
|
|||||||
private const val TYPE_FOOTER = 1
|
private const val TYPE_FOOTER = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务名删除线:系统 StrikethroughSpan 的划线位置按"字体半高"(baseline + ascent/2)
|
||||||
|
* 计算,但数字/汉字的实际墨迹顶比字体 ascent 低不少,划线视觉上偏下。
|
||||||
|
* 这里自绘:按实际墨迹边界(getTextBounds)取垂直中点,线严格穿过文字中间。
|
||||||
|
*/
|
||||||
|
private class MidStrikeSpan : android.text.style.ReplacementSpan() {
|
||||||
|
|
||||||
|
override fun getSize(
|
||||||
|
paint: Paint, text: CharSequence, start: Int, end: Int, fm: Paint.FontMetricsInt?,
|
||||||
|
): Int = paint.measureText(text, start, end).toInt()
|
||||||
|
|
||||||
|
override fun draw(
|
||||||
|
canvas: android.graphics.Canvas, text: CharSequence, start: Int, end: Int,
|
||||||
|
x: Float, top: Int, baseline: Int, bottom: Int, paint: Paint,
|
||||||
|
) {
|
||||||
|
// 先按原样式画字(无删除线标志)
|
||||||
|
canvas.drawText(text, start, end, x, baseline.toFloat(), paint)
|
||||||
|
val s = text.toString()
|
||||||
|
val bounds = android.graphics.Rect()
|
||||||
|
paint.getTextBounds(s, start, end, bounds)
|
||||||
|
// 墨迹垂直中点:bounds.top/bottom 相对基线的偏移(top 为负)
|
||||||
|
val lineY = baseline + (bounds.top + bounds.bottom) / 2f
|
||||||
|
val w = paint.measureText(text, start, end)
|
||||||
|
val line = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||||
|
line.color = paint.color
|
||||||
|
line.strokeWidth = (paint.textSize / 28f).coerceAtLeast(1f)
|
||||||
|
canvas.drawLine(x, lineY, x + w, lineY, line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 置顶图标:圆圈内向上箭头。
|
||||||
|
* 自绘而不是用字体字形——常用字体里没有"圆圈+箭头"的组合字符,
|
||||||
|
* 画出来才能精确控制圆圈与箭头同色、且和重要度圆圈数字(0.85 倍字号)等高。
|
||||||
|
* 颜色用品牌蓝(R.color.brand,深浅色主题各有一版),与之前的 ↑ 字符颜色一致。
|
||||||
|
*/
|
||||||
|
private class PinIconSpan(
|
||||||
|
private val iconColor: Int,
|
||||||
|
private val size: Float,
|
||||||
|
) : android.text.style.ReplacementSpan() {
|
||||||
|
|
||||||
|
override fun getSize(
|
||||||
|
paint: Paint, text: CharSequence, start: Int, end: Int, fm: Paint.FontMetricsInt?,
|
||||||
|
): Int {
|
||||||
|
val s = size.toInt()
|
||||||
|
if (fm != null) {
|
||||||
|
// 占位与字形等高(顶部到基线),避免行高被图标撑开
|
||||||
|
fm.ascent = -s
|
||||||
|
fm.descent = 0
|
||||||
|
fm.top = fm.ascent
|
||||||
|
fm.bottom = fm.descent
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun draw(
|
||||||
|
canvas: android.graphics.Canvas, text: CharSequence, start: Int, end: Int,
|
||||||
|
x: Float, top: Int, baseline: Int, bottom: Int, paint: Paint,
|
||||||
|
) {
|
||||||
|
val s = size
|
||||||
|
// 与 ①②③ 底部对齐:字体里的圆圈数字底缘略微越过基线(约 -0.05 个图标高),
|
||||||
|
// 圆心取基线上方 0.45 个图标高,比之前 0.50 略下移,底部不再"悬空"显偏上
|
||||||
|
val cx = x + s / 2f
|
||||||
|
val cy = baseline - s * 0.45f
|
||||||
|
// 圈线与重要度圆圈数字的描边粗细一致(约 1/10 图标高)
|
||||||
|
val ring = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||||
|
ring.color = iconColor
|
||||||
|
ring.style = Paint.Style.STROKE
|
||||||
|
ring.strokeWidth = s / 10f
|
||||||
|
ring.strokeCap = Paint.Cap.ROUND
|
||||||
|
canvas.drawCircle(cx, cy, s / 2f - ring.strokeWidth / 2f, ring)
|
||||||
|
|
||||||
|
// 箭头比圈线更细(约 1/15 图标高),整体落在圆内
|
||||||
|
val arrow = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||||
|
arrow.color = iconColor
|
||||||
|
arrow.style = Paint.Style.STROKE
|
||||||
|
arrow.strokeWidth = s / 15f
|
||||||
|
arrow.strokeCap = Paint.Cap.ROUND
|
||||||
|
val head = s * 0.18f
|
||||||
|
val yTop = cy - s * 0.16f
|
||||||
|
val yBot = cy + s * 0.18f
|
||||||
|
canvas.drawLine(cx, yBot, cx, yTop, arrow)
|
||||||
|
canvas.drawLine(cx - head, yTop + head, cx, yTop, arrow)
|
||||||
|
canvas.drawLine(cx + head, yTop + head, cx, yTop, arrow)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -62,9 +62,10 @@ object Prefs {
|
|||||||
set(v) = sp.edit().putBoolean("lock_fullscreen", v).apply()
|
set(v) = sp.edit().putBoolean("lock_fullscreen", v).apply()
|
||||||
|
|
||||||
// ---- 目标 ----
|
// ---- 目标 ----
|
||||||
|
// 无上限:输入多大存多大(下限 15 防止误输 0/负数把目标显示搞崩)
|
||||||
var dailyGoalMinutes: Int
|
var dailyGoalMinutes: Int
|
||||||
get() = sp.getInt("daily_goal", 120)
|
get() = sp.getInt("daily_goal", 120)
|
||||||
set(v) = sp.edit().putInt("daily_goal", v.coerceIn(15, 720)).apply()
|
set(v) = sp.edit().putInt("daily_goal", v.coerceAtLeast(15)).apply()
|
||||||
|
|
||||||
/** 0 跟随系统 / 1 浅色 / 2 深色 */
|
/** 0 跟随系统 / 1 浅色 / 2 深色 */
|
||||||
var themeMode: Int
|
var themeMode: Int
|
||||||
|
|||||||
@@ -43,13 +43,6 @@ class LabelDonutView @JvmOverloads constructor(
|
|||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 环中心的小字(总专注 / 任务占比) */
|
|
||||||
var centerCaption: String = ""
|
|
||||||
set(value) {
|
|
||||||
field = value
|
|
||||||
invalidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 最多画几条引线标注,多出来的合并成「其他」,避免标注挤成一团 */
|
/** 最多画几条引线标注,多出来的合并成「其他」,避免标注挤成一团 */
|
||||||
var maxLabels: Int = 6
|
var maxLabels: Int = 6
|
||||||
|
|
||||||
@@ -76,13 +69,7 @@ class LabelDonutView @JvmOverloads constructor(
|
|||||||
textAlign = Paint.Align.CENTER
|
textAlign = Paint.Align.CENTER
|
||||||
isFakeBoldText = true
|
isFakeBoldText = true
|
||||||
}
|
}
|
||||||
private val captionPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
private val linePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.STROKE
|
||||||
textSize = context.spf(10f)
|
|
||||||
color = context.col(R.color.text_tertiary)
|
|
||||||
textAlign = Paint.Align.CENTER
|
|
||||||
}
|
|
||||||
private val linePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
||||||
style = Paint.Style.STROKE
|
|
||||||
strokeWidth = context.dpf(1.2f)
|
strokeWidth = context.dpf(1.2f)
|
||||||
}
|
}
|
||||||
private val dotPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.FILL }
|
private val dotPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.FILL }
|
||||||
@@ -188,13 +175,15 @@ class LabelDonutView @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环中心只画一行:累计时间(或空态提示)。
|
||||||
|
* 之前按 cy + 2dp 硬偏移定位,字面重心偏下;改为按字体度量
|
||||||
|
* 把墨迹垂直中心落在圆心,并删除原来的小字说明行。
|
||||||
|
*/
|
||||||
private fun drawCenter(canvas: Canvas, cx: Float, cy: Float, emptyHint: String?) {
|
private fun drawCenter(canvas: Canvas, cx: Float, cy: Float, emptyHint: String?) {
|
||||||
val big = centerText.takeIf { it.isNotBlank() } ?: "0m"
|
val text = emptyHint ?: centerText.ifBlank { "0m" }
|
||||||
canvas.drawText(big, cx, cy + context.dpf(2f), centerPaint)
|
val fm = centerPaint.fontMetrics
|
||||||
val cap = emptyHint ?: centerCaption
|
canvas.drawText(text, cx, cy - (fm.ascent + fm.descent) / 2f, centerPaint)
|
||||||
if (cap.isNotBlank()) {
|
|
||||||
canvas.drawText(cap, cx, cy + context.dpf(18f), captionPaint)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
锁屏全屏倒计时·横屏专属排版(区别于竖屏的纯纵向堆叠):
|
锁屏全屏倒计时·横屏专属排版(区别于竖屏的纯纵向堆叠):
|
||||||
左右对称分栏 —— 左侧倒计时(大)+ 任务名,右侧时钟(大)+ 日期星期,
|
左右对称分栏——左侧倒计时(大)+ 任务名,右侧时钟(大)+ 日期星期,
|
||||||
两侧主字号统一 96sp,视觉左右对应;无「工作中/休息中」提示。
|
两侧主字号统一 130sp,视觉左右对应;无「工作中/休息中」提示。
|
||||||
|
|
||||||
|
分割线:保持最初可见版本的原始实现——静态 View 直接放在两栏之间,
|
||||||
|
固定 dp 高度,无任何运行时改动(此前的 View.post / fontMetrics /
|
||||||
|
match_parent 结构化三版方案在锁屏/悬浮窗链路上全部失效)。
|
||||||
|
高度 150dp ≈ 130sp 时间文字的墨迹高度(1.17 × 130sp),仅分割两块大时间。
|
||||||
|
|
||||||
|
v2.2/v2.3 位置对齐:分割线作为横排直系子 View 时,center_vertical 相对「整个
|
||||||
|
左右两栏(时间+10dp间距+15sp小字)」居中,下方多出的一截把线的中心往下拉。
|
||||||
|
v2.2 只在分割线外套锚点 FrameLayout,但锚点列比侧栏矮(没有补小字占位),
|
||||||
|
三列各自居中后锚点中心仍落在屏幕中心,位置不变、修复无效。
|
||||||
|
v2.3 改为中列完整镜像左右两栏(时间锚点 + 同规格小字占位),三列同高同顶,
|
||||||
|
锚点中心严格等于时间文字中心;纯静态 XML,不受锁屏/悬浮窗特殊窗口运行时
|
||||||
|
调整失效问题影响,字体缩放变化也同步。
|
||||||
|
|
||||||
|
v2.4 左右等距:v2.3 后用户反馈线到两边时间的左右间隙不相等。实测 Roboto
|
||||||
|
数字等宽且布局对称,间隙不等只可能来自系统字体(鸿蒙 HarmonyOS Sans)
|
||||||
|
数字非等宽,或倒计时 ≥100 分钟时多出一位。对策:①左栏改右对齐、右栏改
|
||||||
|
左对齐,各距分割线固定 24dp——布局间隙无条件相等,不依赖文字宽度;
|
||||||
|
②两侧大时间与锚点加 fontFeatureSettings=tnum,系统字体支持时强制数字
|
||||||
|
等宽,连墨迹抖动也消除(不支持时无副作用)。
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/lockRoot"
|
android:id="@+id/lockRoot"
|
||||||
@@ -14,18 +34,22 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<!-- 左:倒计时 + 任务名 -->
|
<!-- 左:倒计时 + 任务名(右对齐贴线:右缘距分割线固定 24dp,
|
||||||
|
与右栏对称,保证线到两边时间的布局间隙恒相等,
|
||||||
|
不依赖两侧文字宽度恰好相同——鸿蒙系统字体数字非等宽时也成立) -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center_vertical|end"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvLockCountdown"
|
android:id="@+id/tvLockCountdown"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:fontFeatureSettings="tnum"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="130sp"
|
android:textSize="130sp"
|
||||||
@@ -36,6 +60,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxWidth="320dp"
|
android:maxWidth="320dp"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
@@ -43,24 +68,66 @@
|
|||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 中:细分隔线 -->
|
<!-- 中:细分隔线(92dp≈130sp 粗体数字的字面高度 0.71em×130,与时间视觉等高)
|
||||||
<View
|
v2.3 中列完整镜像左右两栏:上方 1dp FrameLayout 内放与时间同规格的 130sp
|
||||||
android:layout_width="1dp"
|
不可见锚点文字(maxLines=1,防止 1dp 宽度触发折行撑高),分割线在其中
|
||||||
android:layout_height="180dp"
|
center;下方补一段与侧栏小字同规格(15sp、marginTop 10dp)的不可见占位,
|
||||||
android:background="#26FFFFFF" />
|
使中列总高与左右两栏一致。三列同高且都被 center_vertical 居中 → 同顶,
|
||||||
|
锚点中心严格等于时间文字中心。(v2.2 只放了锚点没补占位,中列比侧栏矮
|
||||||
|
一截,居中后中心仍落在屏幕中心,与旧版位置相同,故无效) -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- 右:时钟(大)+ 日期星期在时钟下面 -->
|
<FrameLayout
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFeatureSettings="tnum"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:text="00:00"
|
||||||
|
android:textSize="130sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/lockDivider"
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="92dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="#26FFFFFF" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:text="0"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 右:时钟(大)+ 日期星期在时钟下面(左对齐贴线:左缘距分割线固定 24dp,
|
||||||
|
与左栏对称;tnum 强制等宽数字,系统字体支持时两侧宽度恒等、不再抖动) -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center_vertical|start"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvLockClock"
|
android:id="@+id/tvLockClock"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
android:fontFeatureSettings="tnum"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="130sp"
|
android:textSize="130sp"
|
||||||
@@ -71,6 +138,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
android:textColor="#99FFFFFF"
|
android:textColor="#99FFFFFF"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user