[v6.2.6]恢复原初始化方式,解决IllegalStateException异常
This commit is contained in:
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02
|
||||
import com.mogo.eagle.core.function.main.MainMoGoApplication
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI
|
||||
@@ -68,12 +69,7 @@ import kotlinx.coroutines.flow.map
|
||||
class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
View.OnClickListener, ICommonNaviChangedCallback {
|
||||
|
||||
private val mViewModel: TaxiCurrentTaskViewModel by lazy {
|
||||
ViewModelProvider(
|
||||
this,
|
||||
ViewModelProvider.NewInstanceFactory()
|
||||
)[TaxiCurrentTaskViewModel::class.java]
|
||||
}
|
||||
private lateinit var mViewModel: TaxiCurrentTaskViewModel
|
||||
|
||||
private var mPrepareTasCountDownTimer: CountDownTimer? = null
|
||||
|
||||
@@ -96,6 +92,14 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
return this.javaClass.simpleName
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mViewModel = ViewModelProvider(
|
||||
this,
|
||||
ViewModelProvider.NewInstanceFactory()
|
||||
)[TaxiCurrentTaskViewModel::class.java]
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
initOnClickListener()
|
||||
initContainerView(false)
|
||||
@@ -308,7 +312,11 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
}
|
||||
|
||||
fun onCarTakeOrderStatusChanged() {
|
||||
mViewModel.sendUiIntent(TaskUiIntent.StartOrEndTakeOrder)
|
||||
if (this::mViewModel.isInitialized) {
|
||||
mViewModel.sendUiIntent(TaskUiIntent.StartOrEndTakeOrder)
|
||||
} else {
|
||||
CallerLogger.e(TAG, "onCarTakeOrderStatusChanged: mViewModel is not Initialized")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user