fix: 去掉任务详情页中的分段控件tab,腾出更多内容空间
标题栏直接显示状态名+任务进度(如"接单池 第1/50个") Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,6 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.xiaoqu.watch.R
|
||||
@@ -52,8 +51,6 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
||||
/** 当前状态筛选 */
|
||||
private var currentStatus = 2
|
||||
|
||||
/** 分段控件 Tab */
|
||||
private lateinit var segTabs: List<TextView>
|
||||
|
||||
/** 提示弹窗 */
|
||||
private lateinit var tipDialog: QuTipDialog
|
||||
@@ -81,12 +78,6 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
||||
findNavController().popBackStack()
|
||||
}
|
||||
|
||||
// 分段控件
|
||||
segTabs = listOf(binding.segPool, binding.segPunch, binding.segComplete)
|
||||
binding.segPool.setOnClickListener { switchStatus(2) }
|
||||
binding.segPunch.setOnClickListener { switchStatus(3) }
|
||||
binding.segComplete.setOnClickListener { switchStatus(4) }
|
||||
|
||||
// 上下滑手势(切换任务)
|
||||
gestureDetector = GestureDetector(requireContext(), object : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
|
||||
@@ -114,34 +105,10 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
||||
false // 不拦截,让 ScrollView 继续处理滚动
|
||||
}
|
||||
|
||||
// 初始化
|
||||
switchStatus(currentStatus)
|
||||
}
|
||||
|
||||
// ===== 状态切换 =====
|
||||
|
||||
/** 切换状态 Tab */
|
||||
private fun switchStatus(status: Int) {
|
||||
currentStatus = status
|
||||
taskIndex = 0
|
||||
updateSegmentUI()
|
||||
// 加载任务列表
|
||||
fetchTaskIds()
|
||||
}
|
||||
|
||||
/** 更新分段控件高亮 */
|
||||
private fun updateSegmentUI() {
|
||||
val statusList = listOf(2, 3, 4)
|
||||
for (i in segTabs.indices) {
|
||||
if (statusList[i] == currentStatus) {
|
||||
segTabs[i].setBackgroundResource(R.drawable.bg_seg_active)
|
||||
segTabs[i].setTextColor(requireContext().getColor(R.color.text_primary))
|
||||
} else {
|
||||
segTabs[i].background = null
|
||||
segTabs[i].setTextColor(requireContext().getColor(R.color.text_secondary))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 数据获取 =====
|
||||
|
||||
/** 第一步:获取任务 ID 列表 */
|
||||
|
||||
@@ -54,49 +54,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 分段控件:接单池 / 待打卡 / 待完成 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_seg_ctrl"
|
||||
android:padding="3dp"
|
||||
android:layout_marginBottom="13dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/segPool"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="接单池"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/segPunch"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="待打卡"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/segComplete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="待完成"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 任务详情区域(lookTaskDetail 数据) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/taskContent"
|
||||
|
||||
Reference in New Issue
Block a user