Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8446bcf51 | ||
|
|
54df5b398c | ||
|
|
8a1f41ca9d | ||
|
|
4a648669ea | ||
|
|
60fd3d1044 | ||
|
|
ed7927af1d |
26
CHANGELOG.md
26
CHANGELOG.md
@@ -1,5 +1,31 @@
|
|||||||
# 变更记录
|
# 变更记录
|
||||||
|
|
||||||
|
## 2026-11-30 · 横屏大时间换用 Source Code Pro Bold,修分割线左右间隙不等(v2.8)
|
||||||
|
|
||||||
|
- 诊断(基于用户 4 张锁屏照片的程序实测):右间距恒 36px、左间距 20~27px 随秒数变化;数字 advance 等宽(≈95px)但"1"墨迹仅 65px → 系统字体墨迹边距不均;分割线在 advance 中点,布局本身对称无问题。间隙差来自字形墨迹:右钟以"0"开头(墨迹内缩)、左倒计时以 7/3/4/8 结尾(墨迹顶边)。
|
||||||
|
- 选型(渲染位图实测各候选字体的墨迹间隙差):Source Code Pro Bold 最优(最坏 4.9dp vs 现状 ~15dp),其"1"带衬线脚、墨迹近满宽、各数字边距最均匀。
|
||||||
|
- 改动(纯静态 XML):新增 res/font/sourcecodepro_bold.ttf;layout-land 仅给 3 个 130sp 文本(左右时间+中列锚点)加 fontFamily,其余与 v2.3 逐行一致。竖屏与 Kotlin 代码零改动。
|
||||||
|
- 版本:versionCode 52 / versionName 2.8,签名不变(7bcbd511…cc8c83),覆盖安装,无数据迁移。数字字形略有变化("1"多一个衬线脚,类翻页钟样式),字号 130sp 不变。
|
||||||
|
|
||||||
|
## 2026-11-30 · 删除 CountdownFit,竖屏恢复 v2.3 行为(v2.7)
|
||||||
|
|
||||||
|
- 起因:用户报告竖屏专注时间变小(回归)。v2.6 的 CountdownFit 等宽缩号在锁屏页与悬浮窗两条链路都接入,竖屏被波及——该工具只要倒计时文字比时钟宽几像素(鸿蒙字体数字非严格等宽时必然发生)就缩小倒计时,前提错误。
|
||||||
|
- 处理(回退):LockScreenActivity.kt、LockOverlay.kt 从 v2.3 提交 2dd7f8b 原样恢复(md5 校验一致);删除 util/CountdownFit.kt。
|
||||||
|
- 全量比对:app/src 树与 v2.3 完全一致,仅 SettingsFragment.kt 版本号字符串不同;横竖屏布局 XML 本轮零改动。
|
||||||
|
- 版本:versionCode 51 / versionName 2.7(Android 禁止 versionCode 降级,无法回退到 45),签名 SHA-256 7bcbd511…cc8c83 不变,直接覆盖安装,无数据迁移。装上后锁屏/悬浮窗行为与确认正常的 v2.3 一致。
|
||||||
|
- 横屏线与左右数字的间距问题本轮未动,待截图实测后另行处理。
|
||||||
|
|
||||||
|
## 2026-11-30 · 回退 v2.3 布局基线 + 倒计时等宽缩号(v2.6)
|
||||||
|
|
||||||
|
- 起因:v2.5 的 autoSize 方案在锁屏/悬浮窗特殊窗口上渲染异常(时间缩小居中、高度只显示约三分之一),判定 autoSize 在该链路不可靠,彻底放弃。按用户要求回退到 v2.3(确认"高度对齐成功"的版本)重新修。
|
||||||
|
- 回退:layout-land 布局从 git 提交 2dd7f8b 原样恢复,撤销 v2.4/v2.5 全部布局改动(贴线边距、match_parent、autoSize、tnum、gravity end/start)。
|
||||||
|
- 重新修「右边距离比左边大」:唯一来源是倒计时 ≥100 分钟时为 6 位数(120:00),比右侧时钟宽出一个数字。新增 util/CountdownFit:按实际字体测量(Paint.measureText)把 6 位倒计时缩到与时钟完全等宽,居中布局下左右间隙天然相等;回到 5 位立即恢复 130sp(越大越好不变)。LockScreenActivity 与 LockOverlay 两条渲染链路同时接入。
|
||||||
|
- 竖向对齐不受影响:时间列「时间+10dp+小字」整体居中,时间垂直中心=列中心−(10dp+小字)/2 与字号无关;中列锚点保持 130sp。
|
||||||
|
- 版本号不回退(Android 不允许 versionCode 降级覆盖安装):2.6 / versionCode 50。
|
||||||
|
- 改动文件:layout-land/activity_lock_screen.xml(恢复 v2.3)、LockScreenActivity.kt、LockOverlay.kt、util/CountdownFit.kt(新增)、build.gradle.kts、build.sh、SettingsFragment.kt。
|
||||||
|
- 本地验证:构建通过,aapt2 确认 versionCode 50 / versionName 2.6,签名 SHA-256 7bcbd511…cc8c83 不变。
|
||||||
|
- 升级说明:直接覆盖安装(可覆盖 v2.4/v2.5),无数据迁移。
|
||||||
|
|
||||||
## 2026-11-30 · 分割线左右等距 + autoSize 防溢出(v2.5)
|
## 2026-11-30 · 分割线左右等距 + autoSize 防溢出(v2.5)
|
||||||
|
|
||||||
- 起因:v2.4 后用户反馈「距离没变、一个屏幕装不下、需要左右滑动才能完整显示两个时间」。
|
- 起因:v2.4 后用户反馈「距离没变、一个屏幕装不下、需要左右滑动才能完整显示两个时间」。
|
||||||
|
|||||||
@@ -539,6 +539,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val VERSION = "2.5"
|
const val VERSION = "2.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
src/main/res/font/sourcecodepro_bold.ttf
Normal file
BIN
src/main/res/font/sourcecodepro_bold.ttf
Normal file
Binary file not shown.
@@ -16,13 +16,6 @@
|
|||||||
v2.3 改为中列完整镜像左右两栏(时间锚点 + 同规格小字占位),三列同高同顶,
|
v2.3 改为中列完整镜像左右两栏(时间锚点 + 同规格小字占位),三列同高同顶,
|
||||||
锚点中心严格等于时间文字中心;纯静态 XML,不受锁屏/悬浮窗特殊窗口运行时
|
锚点中心严格等于时间文字中心;纯静态 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"
|
||||||
@@ -34,33 +27,22 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<!-- 左:倒计时 + 任务名(右对齐贴线:右缘距分割线固定 24dp,
|
<!-- 左:倒计时 + 任务名 -->
|
||||||
与右栏对称,保证线到两边时间的布局间隙恒相等)
|
|
||||||
v2.5:倒计时 ≥100 分钟时是 6 位数(如 120:00),130sp 下宽约 410dp,
|
|
||||||
超出半屏可用宽度,wrap_content 会被压缩且文字从框左缘起画、越过分割线
|
|
||||||
——v2.4「装不下/越过线」的根因。改为 match_parent 定宽 + autoSize
|
|
||||||
自动缩号(上限仍 130sp):5 位数保持 130sp 原样,6 位数缩到刚好装下,
|
|
||||||
永不溢出。时间列结构「时间+10dp+小字」整体居中,时间中心=列中心
|
|
||||||
-(10+小字)/2,与字号无关 → 一侧缩号不破坏竖向对齐。 -->
|
|
||||||
<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_vertical|end"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvLockCountdown"
|
android:id="@+id/tvLockCountdown"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="24dp"
|
android:fontFamily="@font/sourcecodepro_bold"
|
||||||
android:autoSizeTextType="uniform"
|
|
||||||
android:autoSizeMinTextSize="40sp"
|
|
||||||
android:autoSizeMaxTextSize="130sp"
|
|
||||||
android:fontFeatureSettings="tnum"
|
|
||||||
android:gravity="center_vertical|end"
|
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="130sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -68,7 +50,6 @@
|
|||||||
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"
|
||||||
@@ -92,16 +73,16 @@
|
|||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFeatureSettings="tnum"
|
android:fontFamily="@font/sourcecodepro_bold"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
android:text="00:00"
|
android:text="00:00"
|
||||||
android:textSize="130sp"
|
android:textSize="130sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/lockDivider"
|
android:id="@+id/lockDivider"
|
||||||
@@ -121,28 +102,22 @@
|
|||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 右:时钟(大)+ 日期星期在时钟下面(左对齐贴线:左缘距分割线固定 24dp;
|
<!-- 右:时钟(大)+ 日期星期在时钟下面 -->
|
||||||
与左栏同样 match_parent 定宽 + autoSize,字体缩放变大或位数变多时
|
|
||||||
自动缩号,永不溢出屏幕) -->
|
|
||||||
<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_vertical|start"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvLockClock"
|
android:id="@+id/tvLockClock"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:fontFamily="@font/sourcecodepro_bold"
|
||||||
android:autoSizeTextType="uniform"
|
|
||||||
android:autoSizeMinTextSize="40sp"
|
|
||||||
android:autoSizeMaxTextSize="130sp"
|
|
||||||
android:fontFeatureSettings="tnum"
|
|
||||||
android:gravity="center_vertical|start"
|
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="130sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -150,7 +125,6 @@
|
|||||||
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>
|
||||||
|
|||||||
Reference in New Issue
Block a user