分割线改fontMetrics直接计算修复消失;删除线按墨迹中点自绘居中;置顶圆圈粗细与底部对齐调整,版本 1.8
This commit is contained in:
@@ -163,18 +163,19 @@ class LockScreenActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 横屏排版里的分割线只分割两块大时间:高度对齐倒计时文字的实际渲染高度,
|
||||
* 不再盖住下方的任务名/日期行。竖屏布局没有这个控件,查找结果为 null 直接跳过。
|
||||
* 横屏排版里的分割线只分割两块大时间,高度对齐倒计时文字的实际渲染高度。
|
||||
* 上一版用 View.post 等布局完成后再取 height,实测在悬浮窗/锁屏链路上
|
||||
* 时机不稳导致分割线整条消失;这里改为直接由 paint.fontMetrics 算出
|
||||
* (includeFontPadding=false 时 TextView 高度就是 ascent..descent 跨度),
|
||||
* 零时序依赖、立即生效。竖屏布局没有这个控件,查找结果为 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()
|
||||
}
|
||||
val fm = tvCountdown.paint.fontMetrics
|
||||
val h = (fm.descent - fm.ascent).toInt()
|
||||
if (h > 0 && divider.layoutParams != null && divider.layoutParams.height != h) {
|
||||
divider.layoutParams.height = h
|
||||
divider.requestLayout()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user