fix: 任务页面优化老年人布局
- 去掉左右标签行(ConfigRow),改为全部居中展示 - 状态标签顶部居中带pill背景色 - 任务名 30sp 最大最醒目 - 地点 22sp 蓝色 - 时间信息合并显示(派单+截止+要求完成) - 积分 24sp 橙色(0分时隐藏) - 操作按钮 24sp 更大 - 返回按钮 40dp 更大触摸区 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -197,7 +197,10 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
||||
|
||||
// ===== UI 显示 =====
|
||||
|
||||
/** 显示任务详情(使用服务端实际返回的字段) */
|
||||
/**
|
||||
* 显示任务详情(居中布局,老年人大字优化)
|
||||
* 重点突出:状态 → 任务名 → 地点 → 时间/积分
|
||||
*/
|
||||
private fun displayDetail(detail: TaskDetail) {
|
||||
binding.taskContent.visibility = View.VISIBLE
|
||||
binding.tvEmpty.visibility = View.GONE
|
||||
@@ -206,18 +209,34 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
||||
// 标题:第X/Y个任务
|
||||
binding.tvTitle.text = "第${taskIndex + 1}/${taskList.size}个任务"
|
||||
|
||||
// 派单时间(sendTime: "04.28 09:10")
|
||||
if (detail.sendTime.isNotEmpty()) {
|
||||
binding.tvSendTime.text = "${detail.sendTime}派单"
|
||||
binding.tvSendTime.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvSendTime.visibility = View.GONE
|
||||
// 状态标签(最顶部,带背景色)
|
||||
when (detail.status) {
|
||||
2 -> {
|
||||
binding.tvStatus.text = "待抢单"
|
||||
binding.tvStatus.setTextColor(requireContext().getColor(R.color.primary))
|
||||
binding.tvStatus.setBackgroundResource(R.drawable.bg_pill_blue)
|
||||
}
|
||||
3 -> {
|
||||
binding.tvStatus.text = "待打卡"
|
||||
binding.tvStatus.setTextColor(requireContext().getColor(R.color.warning))
|
||||
binding.tvStatus.setBackgroundResource(R.drawable.bg_pill_orange)
|
||||
}
|
||||
4 -> {
|
||||
binding.tvStatus.text = "进行中"
|
||||
binding.tvStatus.setTextColor(requireContext().getColor(R.color.success))
|
||||
binding.tvStatus.setBackgroundResource(R.drawable.bg_pill_green)
|
||||
}
|
||||
else -> {
|
||||
binding.tvStatus.text = "已完成"
|
||||
binding.tvStatus.setTextColor(requireContext().getColor(R.color.text_secondary))
|
||||
binding.tvStatus.background = null
|
||||
}
|
||||
}
|
||||
|
||||
// 任务名(带类型前缀)
|
||||
// 任务名(最大最醒目)
|
||||
binding.tvTaskName.text = detail.displayName
|
||||
|
||||
// 地点(taskPositions 数组拼接)
|
||||
// 地点
|
||||
if (detail.hasPosition) {
|
||||
binding.tvPosition.text = detail.positionText
|
||||
binding.tvPosition.visibility = View.VISIBLE
|
||||
@@ -225,47 +244,42 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
||||
binding.tvPosition.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 派单号
|
||||
binding.tvNo.text = detail.no
|
||||
|
||||
// 积分
|
||||
binding.tvPoints.text = detail.pointText
|
||||
|
||||
// 状态标签
|
||||
when (detail.status) {
|
||||
2 -> { binding.tvStatus.text = "待抢单"; binding.tvStatus.setTextColor(requireContext().getColor(R.color.error)) }
|
||||
3 -> { binding.tvStatus.text = "待打卡"; binding.tvStatus.setTextColor(requireContext().getColor(R.color.warning)) }
|
||||
4 -> { binding.tvStatus.text = "进行中"; binding.tvStatus.setTextColor(requireContext().getColor(R.color.warning)) }
|
||||
5, 6 -> { binding.tvStatus.text = "已完成"; binding.tvStatus.setTextColor(requireContext().getColor(R.color.success)) }
|
||||
else -> { binding.tvStatus.text = "已结束"; binding.tvStatus.setTextColor(requireContext().getColor(R.color.text_secondary)) }
|
||||
}
|
||||
|
||||
// 截止时间
|
||||
// 时间信息(派单时间 + 截止时间合并显示)
|
||||
val timeInfo = StringBuilder()
|
||||
if (detail.sendTime.isNotEmpty()) timeInfo.append("${detail.sendTime} 派单")
|
||||
if (!detail.expireTime.isNullOrEmpty()) {
|
||||
binding.tvExpireTime.text = detail.expireTime
|
||||
binding.rowExpire.visibility = View.VISIBLE
|
||||
if (timeInfo.isNotEmpty()) timeInfo.append("\n")
|
||||
timeInfo.append("截止 ${detail.expireTime}")
|
||||
}
|
||||
if (!detail.preFinishTime.isNullOrEmpty()) {
|
||||
if (timeInfo.isNotEmpty()) timeInfo.append("\n")
|
||||
timeInfo.append("要求 ${detail.preFinishTime} 完成")
|
||||
}
|
||||
if (timeInfo.isNotEmpty()) {
|
||||
binding.tvTimeInfo.text = timeInfo
|
||||
binding.tvTimeInfo.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.rowExpire.visibility = View.GONE
|
||||
binding.tvTimeInfo.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 预计完成时间(指派任务 type=2)
|
||||
if (!detail.preFinishTime.isNullOrEmpty()) {
|
||||
binding.tvPreFinishTime.text = detail.preFinishTime
|
||||
binding.rowPreFinish.visibility = View.VISIBLE
|
||||
// 积分(大于0才显示)
|
||||
if (detail.point > 0) {
|
||||
binding.tvPoints.text = "积分 ${detail.pointText}"
|
||||
binding.tvPoints.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.rowPreFinish.visibility = View.GONE
|
||||
binding.tvPoints.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 上报人(type 3/4)
|
||||
if (detail.createName.isNotEmpty() && detail.taskType in listOf(3, 4)) {
|
||||
binding.tvCreatorName.text = "上报人:${detail.createName}"
|
||||
binding.tvCreatorName.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvCreatorName.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 协作人
|
||||
binding.rowWorkers.visibility = View.GONE // TODO: workTogether 结构待确认
|
||||
|
||||
// 上报人(用户上报 type=3/4 时显示)
|
||||
if (detail.createName.isNotEmpty() && detail.taskType in listOf(3, 4)) {
|
||||
binding.tvCreatorName.text = detail.createName
|
||||
binding.rowCreator.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.rowCreator.visibility = View.GONE
|
||||
}
|
||||
binding.tvWorkers.visibility = View.GONE // TODO: workTogether 结构待确认
|
||||
|
||||
// 描述
|
||||
if (detail.content.isNotEmpty()) {
|
||||
@@ -275,12 +289,11 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
||||
binding.tvDescription.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 任务要求(黄色提示)
|
||||
// 提示条(任务要求 或 打卡提示)
|
||||
if (!detail.taskRequire.isNullOrEmpty()) {
|
||||
binding.tvHint.text = detail.taskRequire
|
||||
binding.tvHint.visibility = View.VISIBLE
|
||||
} else if (detail.status == 3 && detail.hasPosition) {
|
||||
// 待打卡+有场景 → 默认提示
|
||||
binding.tvHint.text = "请将手表贴近打卡信标"
|
||||
binding.tvHint.visibility = View.VISIBLE
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user