分割线改fontMetrics直接计算修复消失;删除线按墨迹中点自绘居中;置顶圆圈粗细与底部对齐调整,版本 1.8
This commit is contained in:
@@ -145,19 +145,19 @@ object LockOverlay {
|
||||
}
|
||||
|
||||
/**
|
||||
* 横屏排版里的分割线只分割两块大时间:高度对齐倒计时文字的实际渲染高度。
|
||||
* 横屏排版里的分割线只分割两块大时间:高度直接由 paint.fontMetrics 算出
|
||||
* (includeFontPadding=false 时 TextView 高度就是 ascent..descent 跨度),
|
||||
* 不依赖布局完成时机——上一版 View.post 在悬浮窗链路上时序不稳导致线消失。
|
||||
* 竖屏布局没有这个控件,查找结果为 null 直接跳过。
|
||||
*/
|
||||
private fun syncDivider(view: View) {
|
||||
val divider = view.findViewById<View>(R.id.lockDivider) ?: return
|
||||
val countdown = view.findViewById<TextView>(R.id.tvLockCountdown) ?: return
|
||||
divider.post {
|
||||
if (countdown.height > 0 && divider.layoutParams != null &&
|
||||
divider.layoutParams.height != countdown.height
|
||||
) {
|
||||
divider.layoutParams.height = countdown.height
|
||||
divider.requestLayout()
|
||||
}
|
||||
val fm = countdown.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