修复任务图标间距与项目编辑键盘遮挡(v3.6)

This commit is contained in:
XIGE
2026-12-01 14:06:17 +08:00
parent 35a7c4a785
commit 65f56490e9
4 changed files with 25 additions and 12 deletions

View File

@@ -35,7 +35,11 @@ class ProjectSheet(
private var color: Int = existing?.color ?: Palette.colorAt(0)
init {
setContentView(root)
// 项目编辑含多个输入框:必须走满屏容器 + 键盘顶起,否则输入法会盖住弹层
fitOnIme(root)
// 满屏容器后仍保留“点弹层外关闭”,点弹层内部空白不关闭
(root.parent as? View)?.setOnClickListener { dismiss() }
root.setOnClickListener { }
root.findViewById<TextView>(R.id.sheetTitle).setText(
if (existing == null) R.string.add_project else R.string.edit
)

View File

@@ -539,6 +539,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
}
companion object {
const val VERSION = "3.5"
const val VERSION = "3.6"
}
}

View File

@@ -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) {