通知按钮留边距;选任务第一步标题贴左;项目操作弹层圆角;环图加粗;改名时间简史与 Things 蓝图标

This commit is contained in:
XIGE
2026-11-28 08:29:47 +08:00
parent a7f3ec3425
commit c5d9e3eb65
12 changed files with 150 additions and 43 deletions

View File

@@ -53,7 +53,7 @@ class LabelDonutView @JvmOverloads constructor(
/** 最多画几条引线标注,多出来的合并成「其他」,避免标注挤成一团 */
var maxLabels: Int = 6
private val strokeW = context.dpf(22f)
private val strokeW = context.dpf(28f)
private val arcPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
style = Paint.Style.STROKE
@@ -113,7 +113,7 @@ class LabelDonutView @JvmOverloads constructor(
val cy = height / 2f
// 环的直径同时受宽高约束:宽度让出两侧标注区,高度不足时优先保证标注能排开
val outer = minOf(width * 0.48f, height * 0.62f)
val outer = minOf(width * 0.48f, height * 0.66f)
val r = (outer / 2f - strokeW / 2f).coerceAtLeast(context.dpf(24f))
canvas.drawCircle(cx, cy, r, trackPaint)
@@ -138,14 +138,14 @@ class LabelDonutView @JvmOverloads constructor(
val arcLen = sweep / 360f * (2 * Math.PI.toFloat() * r)
val pct = "${(s.seconds * 100f / total).toInt().coerceAtLeast(1)}%"
// 环加粗后百分比必须完整落在色带里:按实测字宽缩字号,左右各留 3dp 边距
// 环加粗后百分比必须完整落在色带里:按实测字宽缩字号,两侧各留 5dp 边距
var pctSize = 11f
pctPaint.textSize = context.spf(pctSize)
while (pctPaint.measureText(pct) > arcLen - context.dpf(6f) && pctSize > 8f) {
while (pctPaint.measureText(pct) > arcLen - context.dpf(10f) && pctSize > 8f) {
pctSize -= 0.5f
pctPaint.textSize = context.spf(pctSize)
}
if (arcLen >= pctPaint.measureText(pct) + context.dpf(4f)) {
if (arcLen >= pctPaint.measureText(pct) + context.dpf(8f)) {
val rad = Math.toRadians(midDeg.toDouble())
val px = cx + r * cos(rad).toFloat()
val py = cy + r * sin(rad).toFloat()