修复任务图标间距与项目编辑键盘遮挡(v3.6)
This commit is contained in:
@@ -80,6 +80,16 @@ class TaskAdapter(
|
||||
title.setSpan(IconGapSpan(), title.length - 1, title.length, 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* 间距与图标必须各占一个字符。若把两个 ReplacementSpan 套在同一字符上,
|
||||
* 后设置的图标会覆盖间距,视觉上就贴住了。
|
||||
*/
|
||||
private fun appendIconSpan(title: SpannableStringBuilder, span: Any) {
|
||||
appendIconGap(title)
|
||||
title.append(" ")
|
||||
title.setSpan(span, title.length - 1, title.length, 0)
|
||||
}
|
||||
|
||||
private inner class TaskViewHolder(v: View) : RecyclerView.ViewHolder(v) {
|
||||
private val tvTitle: TextView = v.findViewById(R.id.tvTitle)
|
||||
private val tvMeta: TextView = v.findViewById(R.id.tvMeta)
|
||||
@@ -102,11 +112,7 @@ class TaskAdapter(
|
||||
|
||||
// 置顶图标前移到重要度圆圈之前(品牌蓝圆圈内向上箭头)
|
||||
if (task.repeatType == com.focusbox.app.model.Repeat.ANYTIME && !task.done) {
|
||||
appendIconGap(title)
|
||||
title.setSpan(
|
||||
PinIconSpan(ctx.col(R.color.brand), iconSize),
|
||||
title.length - 1, title.length, 0,
|
||||
)
|
||||
appendIconSpan(title, PinIconSpan(ctx.col(R.color.brand), iconSize))
|
||||
}
|
||||
|
||||
// 重要度圆圈:3 高 / 2 中 / 1 普通,颜色与紧急度同色系
|
||||
@@ -116,11 +122,7 @@ class TaskAdapter(
|
||||
else -> "1" to R.color.urgent_low
|
||||
}
|
||||
// 与标题、与置顶圆圈各留半个旧间距,避免图标贴在一起又不显得散
|
||||
appendIconGap(title)
|
||||
title.setSpan(
|
||||
PriorityBadgeSpan(ctx.col(badgeColor), iconSize, digit),
|
||||
title.length - 1, title.length, 0,
|
||||
)
|
||||
appendIconSpan(title, PriorityBadgeSpan(ctx.col(badgeColor), iconSize, digit))
|
||||
|
||||
// 紧急度五角星:紧急三颗红 / 中两颗绿 / 不急一颗灰
|
||||
val (stars, starColor) = when (task.urgency) {
|
||||
|
||||
Reference in New Issue
Block a user