|
|
@@ -3,12 +3,18 @@ package com.grkj.iscs.view.fragment
|
|
|
import android.view.View
|
|
|
import android.widget.ImageView
|
|
|
import android.widget.LinearLayout
|
|
|
+import androidx.lifecycle.Observer
|
|
|
+import com.grkj.iscs.BusinessManager
|
|
|
import com.grkj.iscs.R
|
|
|
import com.grkj.iscs.databinding.FragmentJobProgressBinding
|
|
|
import com.grkj.iscs.extentions.debounce
|
|
|
import com.grkj.iscs.model.bo.PageChangeBO
|
|
|
+import com.grkj.iscs.model.eventmsg.MsgEvent
|
|
|
+import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_UPDATE_TICKET_PROGRESS
|
|
|
+import com.grkj.iscs.model.eventmsg.UpdateTicketProgressMsg
|
|
|
import com.grkj.iscs.model.vo.ticket.TicketDetailMonitorRespVO
|
|
|
import com.grkj.iscs.util.ToastUtils
|
|
|
+import com.grkj.iscs.util.log.LogUtil
|
|
|
import com.grkj.iscs.view.base.BaseMvpFragment
|
|
|
import com.grkj.iscs.view.dialog.TipDialog
|
|
|
import com.grkj.iscs.view.iview.IJobProgressView
|
|
|
@@ -27,6 +33,8 @@ class JobProgressFragment(val goBack: () -> Unit) :
|
|
|
private var mStep = 0
|
|
|
private var mPageChangeBO: PageChangeBO? = null
|
|
|
private var mTipDialog: TipDialog? = null
|
|
|
+ private lateinit var observer: Observer<MsgEvent>
|
|
|
+ private var isVisible: Boolean = false
|
|
|
|
|
|
override val viewBinding: FragmentJobProgressBinding
|
|
|
get() = FragmentJobProgressBinding.inflate(layoutInflater)
|
|
|
@@ -73,6 +81,30 @@ class JobProgressFragment(val goBack: () -> Unit) :
|
|
|
presenter?.handleUnlockProcess(mPageChangeBO?.ticketId!!)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ observer = Observer { newData ->
|
|
|
+ when (newData.code) {
|
|
|
+ MSG_EVENT_UPDATE_TICKET_PROGRESS -> {
|
|
|
+ LogUtil.i("Update progress msg, isVisible : $isVisible")
|
|
|
+ if (isVisible) {
|
|
|
+ val ticketId = (newData.data as UpdateTicketProgressMsg).ticketId
|
|
|
+ LogUtil.i("Update progress msg, ticketId : $ticketId")
|
|
|
+ if (ticketId == mPageChangeBO?.ticketId) {
|
|
|
+ mPageChangeBO?.let {
|
|
|
+ refreshPage(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BusinessManager.mEventBus.observe(viewLifecycleOwner, observer)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onResume() {
|
|
|
+ super.onResume()
|
|
|
+ isVisible = true
|
|
|
}
|
|
|
|
|
|
override fun refreshPage(pageChangeBO: PageChangeBO) {
|
|
|
@@ -163,6 +195,12 @@ class JobProgressFragment(val goBack: () -> Unit) :
|
|
|
super.onPause()
|
|
|
mStep = 0
|
|
|
mTipDialog?.dismiss()
|
|
|
+ isVisible = false
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onDestroy() {
|
|
|
+ super.onDestroy()
|
|
|
+ BusinessManager.mEventBus.removeObserver(observer)
|
|
|
}
|
|
|
|
|
|
override fun initPresenter(): JobProgressPresenter {
|