修复任务图标间距与项目编辑键盘遮挡(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

@@ -1,5 +1,12 @@
# 变更记录 # 变更记录
## 2026-12-01 · 修复任务图标间距与项目编辑键盘遮挡(v3.6)
- 任务页图标间距:间距与图标改为各占一个字符。此前 `IconGapSpan` 与图标 `ReplacementSpan` 套在同一字符上,后设置的图标会覆盖间距,导致标题与置顶、置顶与重要度图标视觉贴住。现在两处均保留可见空隙,间距仍为原 3 空格的一半。
- 项目编辑弹层:`ProjectSheet` 改用 `fitOnIme(root)` 的满屏容器 + 键盘顶起方案,拉起输入法时弹层整体上移,项目名称输入框与弹层边框不再被键盘遮住;同时保留点弹层外关闭。
- 仅改 `TaskAdapter.kt` 与 `ProjectSheet.kt`,任务排序、图标样式、项目统计及其他页面逻辑不变。
- versionCode 60 / versionName 3.6,签名不变(7bcbd511…cc8c83),可覆盖安装 v3.5。
## 2026-12-01 · 回退 v3.3 基线并删除内置收件箱(v3.5) ## 2026-12-01 · 回退 v3.3 基线并删除内置收件箱(v3.5)
- 源码整体回退到 v3.3(commit 467d34a),撤销 v3.4 的项目页统计口径重构、完成记录折叠与执行入口移除;任务页、专注页选任务、项目展开均恢复 v3.3 行为。 - 源码整体回退到 v3.3(commit 467d34a),撤销 v3.4 的项目页统计口径重构、完成记录折叠与执行入口移除;任务页、专注页选任务、项目展开均恢复 v3.3 行为。

View File

@@ -35,7 +35,11 @@ class ProjectSheet(
private var color: Int = existing?.color ?: Palette.colorAt(0) private var color: Int = existing?.color ?: Palette.colorAt(0)
init { init {
setContentView(root) // 项目编辑含多个输入框:必须走满屏容器 + 键盘顶起,否则输入法会盖住弹层
fitOnIme(root)
// 满屏容器后仍保留“点弹层外关闭”,点弹层内部空白不关闭
(root.parent as? View)?.setOnClickListener { dismiss() }
root.setOnClickListener { }
root.findViewById<TextView>(R.id.sheetTitle).setText( root.findViewById<TextView>(R.id.sheetTitle).setText(
if (existing == null) R.string.add_project else R.string.edit 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 { 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) 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 inner class TaskViewHolder(v: View) : RecyclerView.ViewHolder(v) {
private val tvTitle: TextView = v.findViewById(R.id.tvTitle) private val tvTitle: TextView = v.findViewById(R.id.tvTitle)
private val tvMeta: TextView = v.findViewById(R.id.tvMeta) 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) { if (task.repeatType == com.focusbox.app.model.Repeat.ANYTIME && !task.done) {
appendIconGap(title) appendIconSpan(title, PinIconSpan(ctx.col(R.color.brand), iconSize))
title.setSpan(
PinIconSpan(ctx.col(R.color.brand), iconSize),
title.length - 1, title.length, 0,
)
} }
// 重要度圆圈:3 高 / 2 中 / 1 普通,颜色与紧急度同色系 // 重要度圆圈:3 高 / 2 中 / 1 普通,颜色与紧急度同色系
@@ -116,11 +122,7 @@ class TaskAdapter(
else -> "1" to R.color.urgent_low else -> "1" to R.color.urgent_low
} }
// 与标题、与置顶圆圈各留半个旧间距,避免图标贴在一起又不显得散 // 与标题、与置顶圆圈各留半个旧间距,避免图标贴在一起又不显得散
appendIconGap(title) appendIconSpan(title, PriorityBadgeSpan(ctx.col(badgeColor), iconSize, digit))
title.setSpan(
PriorityBadgeSpan(ctx.col(badgeColor), iconSize, digit),
title.length - 1, title.length, 0,
)
// 紧急度五角星:紧急三颗红 / 中两颗绿 / 不急一颗灰 // 紧急度五角星:紧急三颗红 / 中两颗绿 / 不急一颗灰
val (stars, starColor) = when (task.urgency) { val (stars, starColor) = when (task.urgency) {