From e27f54aa7e10836e2741dc590559e1039fbade78 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 23 七月 2021 15:06:41 +0800
Subject: [PATCH] 1. 创建子任务时,执行用户默认为当前登录用户或执行组中的第一人 2. 修复部分企业类型问题图标错误 3. 新增场景账户自动生成功能

---
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionFragment.kt |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionFragment.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionFragment.kt
index 918bed6..c367e20 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionFragment.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionFragment.kt
@@ -15,13 +15,12 @@
 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.*
@@ -47,12 +46,15 @@
     //褰撳墠閫変腑鐨勬棩鏈�
     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
 
@@ -84,10 +86,10 @@
         viewModel.dayTaskList.observe(this, Observer {
             // 2019/7/29 鍦ㄦ棩鍘嗕笂娣诲姞鏍囪鐐�
             it?.let {
-                closeLoading()
                 curDayTaskList = it
                 addScheme(it)
                 refreshText(it)
+//                closeLoading()
             }
         })
 
@@ -126,7 +128,6 @@
     }
 
     private fun refreshSubTaskList(newSubTaskList: ArrayList<Subtask> = arrayListOf(), taskDate:Date) {
-        closeLoading()
         curSubTaskList.clear()
         with(curDayTaskList) breaking@{
             forEach {
@@ -153,8 +154,16 @@
                 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()
     }
     /**
      * 鍒濆鍖栨棩鍘嗘帶浠�
@@ -316,9 +325,8 @@
             }
         }
 
-        Handler().postDelayed({
-            closeLoading()
-        }, 5000)
+        handler.removeCallbacks(closeLoadingRunnable)
+        handler.postDelayed(closeLoadingRunnable, 20000)
     }
 
     private fun closeLoading() {

--
Gitblit v1.9.3