From 1abf44296aa386b9a57973ad7899dd95f3c2862c Mon Sep 17 00:00:00 2001 From: XIGE <710062962@qq.com> Date: Sat, 28 Nov 2026 07:54:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E9=80=89=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=BC=B9=E5=B1=82=E6=8F=90=E7=A4=BA=E4=B8=8E=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=A1=8C=E7=BC=A9=E8=BF=9B=EF=BC=9B=E7=8E=AF=E5=9B=BE=E5=8A=A0?= =?UTF-8?q?=E7=B2=97=E7=95=99=E8=BE=B9=E8=B7=9D=EF=BC=9B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=B8=B8=E9=A9=BB=EF=BC=9B=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=A0=B7=E5=BC=8F=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++ .../java/com/focusbox/app/service/Notif.kt | 4 +-- .../focusbox/app/ui/focus/FocusFragment.kt | 13 ++++++---- .../com/focusbox/app/widget/LabelDonutView.kt | 26 +++++++++++-------- src/main/res/drawable/ic_notif.xml | 14 ++++++++++ src/main/res/layout/fragment_stats.xml | 6 ++--- src/main/res/layout/item_pick_row.xml | 1 + src/main/res/values/strings.xml | 2 +- src/main/res/values/themes.xml | 8 ++++++ 9 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 src/main/res/drawable/ic_notif.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index b47770d..0022c62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # 变更记录 +## 2026-11-28 · 精简选任务弹层提示与项目行缩进;环图加粗留边距;通知图标常驻;统计标题样式统一 + +- 同步源码更新 8 个文件(新增/修改 8,删除 0)。 + ## 2026-11-28 · v0.4.1:任务选择两步式、深色新增按钮、统计文案与热力图 - **首页「选择任务」改为自绘底部弹层**(替代系统 AlertDialog): diff --git a/src/main/java/com/focusbox/app/service/Notif.kt b/src/main/java/com/focusbox/app/service/Notif.kt index 2fa31b5..ebe436f 100644 --- a/src/main/java/com/focusbox/app/service/Notif.kt +++ b/src/main/java/com/focusbox/app/service/Notif.kt @@ -89,8 +89,8 @@ object Notif { ?: context.getString(R.string.notif_no_task) val b = NotificationCompat.Builder(context, CHANNEL_TIMER) - // 透明小图标:状态栏与通知左侧不再出现应用图标 - .setSmallIcon(R.drawable.ic_notif_blank) + // 常驻可见的白色秒表图标:透明图标在 EMUI 上会时隐时现,不能保证状态栏一直有提示 + .setSmallIcon(R.drawable.ic_notif) .setContentIntent(contentIntent(context)) .setOngoing(true) .setOnlyAlertOnce(true) diff --git a/src/main/java/com/focusbox/app/ui/focus/FocusFragment.kt b/src/main/java/com/focusbox/app/ui/focus/FocusFragment.kt index 3ec7405..435976e 100644 --- a/src/main/java/com/focusbox/app/ui/focus/FocusFragment.kt +++ b/src/main/java/com/focusbox/app/ui/focus/FocusFragment.kt @@ -416,6 +416,7 @@ class FocusFragment : Fragment(R.layout.fragment_focus) { val tvTitle = root.findViewById(R.id.pickTitle) val tvStep = root.findViewById(R.id.pickStep) val tvHint = root.findViewById(R.id.pickHint) + tvHint.visibility = View.GONE // 两步都只留标题与列表,不再占一行说明文字 val btnBack = root.findViewById(R.id.pickBack) val btnClose = root.findViewById(R.id.pickClose) val btnClear = root.findViewById(R.id.pickClear) @@ -427,12 +428,15 @@ class FocusFragment : Fragment(R.layout.fragment_focus) { meta: String, color: Int?, selected: Boolean, + alignLeft: Boolean = false, onClick: () -> Unit, ) { val row = layoutInflater.inflate(R.layout.item_pick_row, list, false) - row.findViewById(R.id.rowDot).apply { - visible(color != null) - if (color != null) background = ctx.circleBg(color) + val dot = row.findViewById(R.id.rowDot) + dot.visible(!alignLeft && color != null) + if (color != null) dot.background = ctx.circleBg(color) + (row.findViewById(R.id.rowInfo).layoutParams as LinearLayout.LayoutParams).apply { + marginStart = if (alignLeft || color == null) 0 else dpi(12f) } row.findViewById(R.id.rowTitle).text = title row.findViewById(R.id.rowMeta).text = meta @@ -452,7 +456,6 @@ class FocusFragment : Fragment(R.layout.fragment_focus) { val project = Store.project(projectId) tvTitle.text = project?.name ?: getString(R.string.inbox) tvStep.text = getString(R.string.pick_step, 2) - tvHint.text = getString(R.string.pick_task_hint) btnBack.visibility = View.VISIBLE btnClear.visibility = View.VISIBLE list.removeAllViews() @@ -490,7 +493,6 @@ class FocusFragment : Fragment(R.layout.fragment_focus) { fun showProjects() { tvTitle.text = getString(R.string.pick_project) tvStep.text = getString(R.string.pick_step, 1) - tvHint.text = getString(R.string.pick_project_hint) btnBack.visibility = View.INVISIBLE btnClear.visibility = View.GONE list.removeAllViews() @@ -501,6 +503,7 @@ class FocusFragment : Fragment(R.layout.fragment_focus) { meta = getString(R.string.pick_project_meta, p.openTasks), color = p.color, selected = p.id == currentPid, + alignLeft = true, // 项目列表不要左侧色点缩进,名称贴左对齐 ) { showTasks(p.id) } } scroll.scrollTo(0, 0) diff --git a/src/main/java/com/focusbox/app/widget/LabelDonutView.kt b/src/main/java/com/focusbox/app/widget/LabelDonutView.kt index 4d4692e..72fd073 100644 --- a/src/main/java/com/focusbox/app/widget/LabelDonutView.kt +++ b/src/main/java/com/focusbox/app/widget/LabelDonutView.kt @@ -53,7 +53,7 @@ class LabelDonutView @JvmOverloads constructor( /** 最多画几条引线标注,多出来的合并成「其他」,避免标注挤成一团 */ var maxLabels: Int = 6 - private val strokeW = context.dpf(15f) + private val strokeW = context.dpf(22f) private val arcPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.STROKE @@ -66,7 +66,7 @@ class LabelDonutView @JvmOverloads constructor( color = context.col(R.color.ring_track) } private val pctPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - textSize = context.spf(10f) + textSize = context.spf(11f) textAlign = Paint.Align.CENTER isFakeBoldText = true } @@ -137,18 +137,21 @@ class LabelDonutView @JvmOverloads constructor( canvas.drawArc(box, start + gapDeg / 2f, (sweep - gapDeg).coerceAtLeast(0.5f), false, arcPaint) val arcLen = sweep / 360f * (2 * Math.PI.toFloat() * r) - if (arcLen >= context.dpf(20f)) { + val pct = "${(s.seconds * 100f / total).toInt().coerceAtLeast(1)}%" + // 环加粗后百分比必须完整落在色带里:按实测字宽缩字号,左右各留 3dp 边距 + var pctSize = 11f + pctPaint.textSize = context.spf(pctSize) + while (pctPaint.measureText(pct) > arcLen - context.dpf(6f) && pctSize > 8f) { + pctSize -= 0.5f + pctPaint.textSize = context.spf(pctSize) + } + if (arcLen >= pctPaint.measureText(pct) + context.dpf(4f)) { val rad = Math.toRadians(midDeg.toDouble()) val px = cx + r * cos(rad).toFloat() val py = cy + r * sin(rad).toFloat() pctPaint.color = readableOn(s.color) val fm = pctPaint.fontMetrics - canvas.drawText( - "${(s.seconds * 100f / total).toInt().coerceAtLeast(1)}%", - px, - py - (fm.ascent + fm.descent) / 2f, - pctPaint, - ) + canvas.drawText(pct, px, py - (fm.ascent + fm.descent) / 2f, pctPaint) } // 太薄的扇区不牵线,否则几条线会叠在同一个点上 @@ -220,7 +223,8 @@ class LabelDonutView @JvmOverloads constructor( val color = tag.slice.color val dotR = context.dpf(2.6f) val dotX = if (side > 0) width - context.dpf(3f) - dotR else context.dpf(3f) + dotR - val kneeX = cx + side * (r + context.dpf(13f)) + // 折点落在环外缘再往外 10dp,环加粗后引线不会压在色带上 + val kneeX = cx + side * (r + strokeW / 2f + context.dpf(10f)) val cosA = cos(radians(tag.midDeg)).toFloat() val sinA = sin(radians(tag.midDeg)).toFloat() @@ -237,7 +241,7 @@ class LabelDonutView @JvmOverloads constructor( canvas.drawCircle(dotX, tag.y, dotR, dotPaint) val textX = dotX - side * context.dpf(9f) - val maxW = (kotlin.math.abs(textX - (cx + side * (r + strokeW))) - context.dpf(6f)) + val maxW = (kotlin.math.abs(textX - (cx + side * (r + strokeW / 2f))) - context.dpf(8f)) .coerceAtLeast(context.dpf(20f)) tagValuePaint.color = color diff --git a/src/main/res/drawable/ic_notif.xml b/src/main/res/drawable/ic_notif.xml new file mode 100644 index 0000000..8a066d8 --- /dev/null +++ b/src/main/res/drawable/ic_notif.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/src/main/res/layout/fragment_stats.xml b/src/main/res/layout/fragment_stats.xml index 6f5338b..e2af9b5 100644 --- a/src/main/res/layout/fragment_stats.xml +++ b/src/main/res/layout/fragment_stats.xml @@ -189,7 +189,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/trend_title" - style="@style/T.Section" /> + style="@style/T.CardTitle" /> + style="@style/T.CardTitle" /> + style="@style/T.CardTitle" /> 今日目标 %1$d%% %1$dM 专注趋势 - 打卡热力图 + 专注频率 项目分布 任务分布 任务占比 diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 7aa414c..7e28c6d 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -31,6 +31,14 @@ false + + +