18034727885
2026-06-26 253f680fb9666751e0f9a8e5e8f2f9e3eb1894e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.example.smart.ui.project.inspect
 
import android.R
import android.view.LayoutInflater
import android.view.View
import android.widget.ArrayAdapter
import androidx.core.view.isVisible
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.basecore.util.LogUtils
import com.example.smart.databinding.ProjectIssuePageLayoutBinding
import com.example.smart.ui.project.frag.ProjectBasePage
import com.example.smart.ui.project.provider.ProjectPageFactory.PAGE_INSPECT
 
/**
 * 检查小组
 */
class InspectPageFragment : ProjectBasePage() {
 
    private val viewModel: InspectViewModel by viewModels()
 
    private val mDataList = ArrayList<InspectBean>()
 
    private lateinit var adapter: InspectAdapter
 
    private val binding by lazy {
        ProjectIssuePageLayoutBinding.inflate(LayoutInflater.from(context))
    }
 
    companion object {
        fun newInstance() = InspectPageFragment()
    }
 
    override fun callList() {
        viewModel.callList(param.taskId){
            binding.loadingLayout.isVisible = true
            binding.loadingLayout.loadError()
        }
    }
 
    override fun onBindObserver() {
        super.onBindObserver()
        viewModel.bean.observe(this) {
            if(it.drivers.isEmpty() && it.groupLeaders.isEmpty() && it.groupMembers.isEmpty()) {
                binding.loadingLayout.isVisible = true
                binding.loadingLayout.loadEmpty()
            } else{
                binding.loadingLayout.isVisible = false
                adapter.notifyData(it)
            }
        }
    }
 
    override fun getRootView() = binding.root
 
    override fun initView() {
        binding.recyclerView.layoutManager =
            LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)
        adapter = InspectAdapter(mContext!!, mDataList)
        binding.recyclerView.adapter = adapter
 
        binding.topLayout.isVisible = false
 
        initSpinner()
    }
 
    private fun initSpinner() {
        val creatorOptions = listOf("全部人员", "我创建的")
        val adapter = ArrayAdapter(requireContext(), R.layout.simple_spinner_item, creatorOptions)
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
        binding.creatorSpinner.adapter = adapter
        // 调整字体大小
        binding.creatorSpinner.setPopupBackgroundResource(com.example.smart.R.color.white)
        binding.deviceSpinner.visibility = View.GONE
    }
 
    override fun initData() {}
 
    override fun getPageId() = PAGE_INSPECT
}