完成任务删除线只画任务名;置顶改圆圈箭头图标;饼图中心删小字居中;悬浮窗权限已开启不可点;每日目标可输入去上限,版本 1.6
This commit is contained in:
@@ -43,13 +43,6 @@ class LabelDonutView @JvmOverloads constructor(
|
||||
invalidate()
|
||||
}
|
||||
|
||||
/** 环中心的小字(总专注 / 任务占比) */
|
||||
var centerCaption: String = ""
|
||||
set(value) {
|
||||
field = value
|
||||
invalidate()
|
||||
}
|
||||
|
||||
/** 最多画几条引线标注,多出来的合并成「其他」,避免标注挤成一团 */
|
||||
var maxLabels: Int = 6
|
||||
|
||||
@@ -76,13 +69,7 @@ class LabelDonutView @JvmOverloads constructor(
|
||||
textAlign = Paint.Align.CENTER
|
||||
isFakeBoldText = true
|
||||
}
|
||||
private val captionPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
textSize = context.spf(10f)
|
||||
color = context.col(R.color.text_tertiary)
|
||||
textAlign = Paint.Align.CENTER
|
||||
}
|
||||
private val linePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
style = Paint.Style.STROKE
|
||||
private val linePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.STROKE
|
||||
strokeWidth = context.dpf(1.2f)
|
||||
}
|
||||
private val dotPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.FILL }
|
||||
@@ -188,13 +175,15 @@ class LabelDonutView @JvmOverloads constructor(
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 环中心只画一行:累计时间(或空态提示)。
|
||||
* 之前按 cy + 2dp 硬偏移定位,字面重心偏下;改为按字体度量
|
||||
* 把墨迹垂直中心落在圆心,并删除原来的小字说明行。
|
||||
*/
|
||||
private fun drawCenter(canvas: Canvas, cx: Float, cy: Float, emptyHint: String?) {
|
||||
val big = centerText.takeIf { it.isNotBlank() } ?: "0m"
|
||||
canvas.drawText(big, cx, cy + context.dpf(2f), centerPaint)
|
||||
val cap = emptyHint ?: centerCaption
|
||||
if (cap.isNotBlank()) {
|
||||
canvas.drawText(cap, cx, cy + context.dpf(18f), captionPaint)
|
||||
}
|
||||
val text = emptyHint ?: centerText.ifBlank { "0m" }
|
||||
val fm = centerPaint.fontMetrics
|
||||
canvas.drawText(text, cx, cy - (fm.ascent + fm.descent) / 2f, centerPaint)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user