| | |
| | | import cn.flightfeather.thirdapp.R |
| | | import cn.flightfeather.thirdapp.activity.UploadMediaFilesActivity |
| | | import cn.flightfeather.thirdapp.adapter.TaskListAdapter |
| | | import cn.flightfeather.thirdapp.bean.Subtask |
| | | import cn.flightfeather.thirdapp.bean.entity.Subtask |
| | | import cn.flightfeather.thirdapp.bean.vo.DayTaskProgressVo |
| | | import cn.flightfeather.thirdapp.module.base.BaseFragment |
| | | import cn.flightfeather.thirdapp.util.DateFormatter |
| | | import cn.flightfeather.thirdapp.util.DialogUtil |
| | | import cn.flightfeather.thirdapp.util.slideswaphelper.PlusItemSlideCallback |
| | | import cn.flightfeather.thirdapp.util.slideswaphelper.WItemTouchHelperPlus |
| | | import cn.flightfeather.thirdapp.util.Domain |
| | | import com.haibin.calendarview.Calendar |
| | | import com.haibin.calendarview.CalendarView |
| | | import kotlinx.android.synthetic.main.fragment_inspection2.* |
| | |
| | | //当前选中的日期 |
| | | private var curDate = Date() |
| | | |
| | | lateinit var subTaskListAdapter: TaskListAdapter |
| | | private lateinit var subTaskListAdapter: TaskListAdapter |
| | | |
| | | private var loadingDialog: Dialog? = null |
| | | |
| | | //日历显示模式(1:展示子任务完成百分比;0:展示整改完成百分比) |
| | | private var calendarMode = 1 |
| | | |
| | | private val handler = Handler() |
| | | private val closeLoadingRunnable = Runnable { closeLoading() } |
| | | |
| | | override fun getLayoutId(): Int = R.layout.fragment_inspection2 |
| | | |
| | |
| | | viewModel.dayTaskList.observe(this, Observer { |
| | | // 2019/7/29 在日历上添加标记点 |
| | | it?.let { |
| | | closeLoading() |
| | | curDayTaskList = it |
| | | addScheme(it) |
| | | refreshText(it) |
| | | // closeLoading() |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | private fun refreshSubTaskList(newSubTaskList: ArrayList<Subtask> = arrayListOf(), taskDate:Date) { |
| | | closeLoading() |
| | | curSubTaskList.clear() |
| | | with(curDayTaskList) breaking@{ |
| | | forEach { |
| | |
| | | extension3 = "0" |
| | | }) |
| | | } |
| | | curSubTaskList.addAll(newSubTaskList) |
| | | curSubTaskList.addAll(newSubTaskList.sortedBy { |
| | | when (it.status) { |
| | | Domain.TASK_STATUS_WAITING -> 1 |
| | | Domain.TASK_STATUS_RUNNING -> 2 |
| | | Domain.TASK_STATUS_FINISHED -> 3 |
| | | else -> -1 |
| | | } |
| | | }) |
| | | subTaskListAdapter.notifyDataSetChanged() |
| | | closeLoading() |
| | | } |
| | | /** |
| | | * 初始化日历控件 |
| | |
| | | } |
| | | } |
| | | |
| | | Handler().postDelayed({ |
| | | closeLoading() |
| | | }, 5000) |
| | | handler.removeCallbacks(closeLoadingRunnable) |
| | | handler.postDelayed(closeLoadingRunnable, 20000) |
| | | } |
| | | |
| | | private fun closeLoading() { |