Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d8995ead0 | ||
|
|
4444b18b29 | ||
|
|
11dc2825cc | ||
|
|
2dd7f8b506 |
19
CHANGELOG.md
19
CHANGELOG.md
@@ -1,5 +1,24 @@
|
||||
# 变更记录
|
||||
|
||||
## 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)
|
||||
|
||||
- 起因:用户反馈分割线高度已与左右时间一致,但位置偏下、底部超出时间墨迹边线。
|
||||
|
||||
@@ -539,6 +539,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val VERSION = "2.2"
|
||||
const val VERSION = "2.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,20 @@
|
||||
match_parent 结构化三版方案在锁屏/悬浮窗链路上全部失效)。
|
||||
高度 150dp ≈ 130sp 时间文字的墨迹高度(1.17 × 130sp),仅分割两块大时间。
|
||||
|
||||
v2.2 位置对齐:此前分割线作为横排 LinearLayout 的直系子 View,center_vertical
|
||||
是相对「整个左右两栏(时间+10dp间距+15sp小字)」居中,下方多出的一截把线的
|
||||
中心往下拉,导致线整体下移、底部超出时间墨迹。改为镜像锚点方案——分割线外套
|
||||
一层 1dp 宽 FrameLayout,内放一个与左右时间字号字重完全一致的 130sp 不可见
|
||||
占位文字,分割线在其中 center 对齐:线的中心严格等于时间文字的中心,且纯静态
|
||||
XML,不受锁屏/悬浮窗特殊窗口运行时调整失效问题影响,字体缩放变化也同步。
|
||||
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"
|
||||
android:id="@+id/lockRoot"
|
||||
@@ -26,18 +34,22 @@
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 左:倒计时 + 任务名 -->
|
||||
<!-- 左:倒计时 + 任务名(右对齐贴线:右缘距分割线固定 24dp,
|
||||
与右栏对称,保证线到两边时间的布局间隙恒相等,
|
||||
不依赖两侧文字宽度恰好相同——鸿蒙系统字体数字非等宽时也成立) -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:gravity="center_vertical|end"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLockCountdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:fontFeatureSettings="tnum"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="130sp"
|
||||
@@ -48,6 +60,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="320dp"
|
||||
android:maxLines="1"
|
||||
@@ -56,41 +69,65 @@
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 中:细分隔线(92dp≈130sp 粗体数字的字面高度 0.71em×130,与时间视觉等高)
|
||||
外层 FrameLayout 固定 1dp 宽,内部 130sp 不可见占位文字与左右时间同规格,
|
||||
分割线 center 对齐 → 线中心与时间文字中心严格重合,不再下移 -->
|
||||
<FrameLayout
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="wrap_content">
|
||||
v2.3 中列完整镜像左右两栏:上方 1dp FrameLayout 内放与时间同规格的 130sp
|
||||
不可见锚点文字(maxLines=1,防止 1dp 宽度触发折行撑高),分割线在其中
|
||||
center;下方补一段与侧栏小字同规格(15sp、marginTop 10dp)的不可见占位,
|
||||
使中列总高与左右两栏一致。三列同高且都被 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>
|
||||
<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
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:gravity="center_vertical|start"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLockClock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:fontFeatureSettings="tnum"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="130sp"
|
||||
@@ -101,6 +138,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user