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 {
|
||||
|
||||
@@ -1,45 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 任务列表页(单任务展示,上下滑切换)
|
||||
顶部:返回 + "第X/Y个任务" + 分段控件
|
||||
中间:当前任务详情(lookTaskDetail)
|
||||
底部:固定操作按钮 -->
|
||||
老年人用户:重点信息大而突出,次要信息精简
|
||||
布局:标题栏 → 任务名(最大) → 地点 → 关键信息 → 操作按钮 -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- 可滑动内容区(底部留出按钮空间) -->
|
||||
<!-- 内容区 -->
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"
|
||||
android:paddingStart="21dp"
|
||||
android:paddingTop="27dp"
|
||||
android:paddingEnd="21dp"
|
||||
android:paddingBottom="72dp"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="21dp"
|
||||
android:paddingTop="27dp"
|
||||
android:paddingEnd="21dp">
|
||||
|
||||
<!-- 页面头部:返回 + 标题(第X/Y个任务) -->
|
||||
<!-- 标题栏:返回 + 第X/Y个 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginBottom="8dp">
|
||||
android:layout_marginBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:text="‹"
|
||||
android:textColor="@color/primary"
|
||||
android:textSize="27sp" />
|
||||
android:textSize="32sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
@@ -47,98 +46,99 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="32dp" />
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginEnd="40dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 任务详情区域(lookTaskDetail 数据) -->
|
||||
<!-- ===== 任务详情区域 ===== -->
|
||||
<LinearLayout
|
||||
android:id="@+id/taskContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<!-- 派单时间 -->
|
||||
<!-- 状态标签(最顶部,彩色醒目) -->
|
||||
<TextView
|
||||
android:id="@+id/tvSendTime"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/tvStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="22sp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="10dp" />
|
||||
|
||||
<!-- 任务名称(大字居中) -->
|
||||
<!-- 任务名称(最大最醒目) -->
|
||||
<TextView
|
||||
android:id="@+id/tvTaskName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="26sp"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<!-- 地点 -->
|
||||
<!-- 地点(蓝色醒目) -->
|
||||
<TextView
|
||||
android:id="@+id/tvPosition"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/primary"
|
||||
android:textSize="20sp"
|
||||
android:textSize="22sp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<!-- 信息行列表 -->
|
||||
<LinearLayout style="@style/ConfigRow">
|
||||
<TextView style="@style/ConfigLabel" android:text="派单号" />
|
||||
<TextView android:id="@+id/tvNo" style="@style/ConfigValue"
|
||||
android:textColor="@color/text_secondary" />
|
||||
</LinearLayout>
|
||||
<!-- 派单时间 + 截止时间(一行显示) -->
|
||||
<TextView
|
||||
android:id="@+id/tvTimeInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<LinearLayout style="@style/ConfigRow">
|
||||
<TextView style="@style/ConfigLabel" android:text="积分" />
|
||||
<TextView android:id="@+id/tvPoints" style="@style/ConfigValue"
|
||||
android:textColor="@color/warning" />
|
||||
</LinearLayout>
|
||||
<!-- 积分(大字橙色) -->
|
||||
<TextView
|
||||
android:id="@+id/tvPoints"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/warning"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- 状态标签 -->
|
||||
<LinearLayout style="@style/ConfigRow">
|
||||
<TextView style="@style/ConfigLabel" android:text="状态" />
|
||||
<TextView android:id="@+id/tvStatus" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 截止时间 -->
|
||||
<LinearLayout android:id="@+id/rowExpire" style="@style/ConfigRow"
|
||||
android:visibility="gone">
|
||||
<TextView style="@style/ConfigLabel" android:text="截止" />
|
||||
<TextView android:id="@+id/tvExpireTime" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 预计完成时间(指派任务) -->
|
||||
<LinearLayout android:id="@+id/rowPreFinish" style="@style/ConfigRow"
|
||||
android:visibility="gone">
|
||||
<TextView style="@style/ConfigLabel" android:text="要求完成" />
|
||||
<TextView android:id="@+id/tvPreFinishTime" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
<!-- 上报人(type 3/4) -->
|
||||
<TextView
|
||||
android:id="@+id/tvCreatorName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- 协作人 -->
|
||||
<LinearLayout android:id="@+id/rowWorkers" style="@style/ConfigRow"
|
||||
android:visibility="gone">
|
||||
<TextView style="@style/ConfigLabel" android:text="协作人" />
|
||||
<TextView android:id="@+id/tvWorkers" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 上报人(用户上报/巡检上报任务) -->
|
||||
<LinearLayout android:id="@+id/rowCreator" style="@style/ConfigRow"
|
||||
android:visibility="gone">
|
||||
<TextView style="@style/ConfigLabel" android:text="上报人" />
|
||||
<TextView android:id="@+id/tvCreatorName" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/tvWorkers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- 任务描述 -->
|
||||
<TextView
|
||||
@@ -146,23 +146,22 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="17sp"
|
||||
android:textSize="18sp"
|
||||
android:lineSpacingMultiplier="1.5"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- 提示条(待打卡+有场景) -->
|
||||
<!-- 提示条(黄色醒目) -->
|
||||
<TextView
|
||||
android:id="@+id/tvHint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="11dp"
|
||||
android:text="请将手表贴近打卡信标"
|
||||
android:padding="13dp"
|
||||
android:textColor="@color/warning"
|
||||
android:textSize="16sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -175,7 +174,7 @@
|
||||
android:gravity="center"
|
||||
android:text="暂无任务"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="20sp"
|
||||
android:textSize="24sp"
|
||||
android:paddingTop="80dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -190,8 +189,8 @@
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:indeterminateTint="@color/text_secondary" />
|
||||
|
||||
<TextView
|
||||
@@ -199,7 +198,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="加载中"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="16sp"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -208,18 +207,18 @@
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<!-- 底部固定操作按钮 -->
|
||||
<!-- 底部固定操作按钮(大字) -->
|
||||
<TextView
|
||||
android:id="@+id/btnAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center"
|
||||
android:padding="19dp"
|
||||
android:padding="21dp"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="21sp"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:letterSpacing="0.05"
|
||||
android:letterSpacing="0.08"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
Reference in New Issue
Block a user