Merge remote-tracking branch 'origin/dev_robotaxi-d_240912_6.7.0' into dev_robotaxi-d_240912_6.7.0

This commit is contained in:
xuxinchao
2024-10-12 16:43:51 +08:00
34 changed files with 1763 additions and 157 deletions

View File

@@ -14,19 +14,22 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.SessionWithTime
import com.mogo.och.common.module.manager.autopilot.line.LineManager
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.zhjt.mogo.adas.common.MessageType
import com.zhjt.mogo.adas.data.bean.ReceivedAck
import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status
import fsm.Fsm2024
import java.util.concurrent.atomic.AtomicLong
import java.util.concurrent.atomic.AtomicReference
object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listener {
const val TAG = "OchAutoPilotManager"
private val globalSessionId = AtomicLong(-1)
private val globalSessionId = AtomicReference<SessionWithTime>()
private val fsmBackSessionId = AtomicLong(-1L)
init {
@@ -51,18 +54,27 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen
* 启动自驾中禁止再次启动自驾
*/
@JvmStatic
fun canStartAutopilotBySessionId():Boolean{
return (globalSessionId.get()==-1L).apply {
if(!this) {
fun canStartAutopilotBySessionId(): Boolean {
val sessionInfo = globalSessionId.get()
val currentTimeMillis = System.currentTimeMillis()
if(sessionInfo==null){
return true
}else{
if(currentTimeMillis-sessionInfo.setTime>=OchAutopilotAnalytics.LOOP_PERIOD_16S){
clearGlobalSessionId("检测session 自带的时间 ${currentTimeMillis}_${sessionInfo.setTime}_${sessionInfo.sessionId}")
return true
}else{
ToastUtils.showLong("自驾启动中,请勿重复点击")
OchAutopilotAnalytics.triggerCanStartAutopilotBySessionId(globalSessionId.get())
return false
}
}
}
@JvmStatic
fun canStartAutopilotBySessionIdInner():Boolean{
return (globalSessionId.get()==-1L)
OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId")
return (globalSessionId.get()==null)
}
@JvmStatic
@@ -88,14 +100,15 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen
return true
}
fun clearGlobalSessionId(){
globalSessionId.set(-1)
fun clearGlobalSessionId(log:String){
OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId${globalSessionId}_${fsmBackSessionId}_${log}")
globalSessionId.set(null)
}
@JvmStatic
fun startAutoPilot(controlParameters: AutopilotControlParameters?): Long {
val sessionId = CallerAutoPilotControlManager.startAutoPilot(controlParameters)
globalSessionId.set(sessionId)
globalSessionId.set(SessionWithTime(sessionId,System.currentTimeMillis()))
fsmBackSessionId.set(-1L)
OchAutopilotAnalytics.triggerStartAutopilotParameters(controlParameters, sessionId)
return sessionId
@@ -120,9 +133,14 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen
* 启动自驾失败切 FSM返回的Session和启动SessionId 不同
*/
fun checkStartSessionAndFailSessionId(){
if(globalSessionId.get() != fsmBackSessionId.get()){
OchAutopilotAnalytics.triggerStartAutopilotFailCheckSessionDiff(globalSessionId.get(),
fsmBackSessionId.get())
val sessionInfo = globalSessionId.get()
if(sessionInfo!=null) {
if (sessionInfo.sessionId != fsmBackSessionId.get()) {
OchAutopilotAnalytics.triggerStartAutopilotFailCheckSessionDiff(
sessionInfo,
fsmBackSessionId.get()
)
}
}
}
}

View File

@@ -11,9 +11,11 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
import com.mogo.och.common.module.manager.autopilot.line.LineManager
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.SessionWithTime
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.RxUtils
import io.reactivex.disposables.Disposable
object OchAutopilotAnalytics {
@@ -50,6 +52,7 @@ object OchAutopilotAnalytics {
private const val EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_FSM_RETURN = "cmd_session_id_fsm_return"
private val LOOP_PERIOD_15S = 15 * 1000L
val LOOP_PERIOD_16S = 16 * 1000L
private var mStartAutopilotKey: String? = null
@@ -95,35 +98,36 @@ object OchAutopilotAnalytics {
/**
* 等待底盘返回的间隙 重复启动自驾
*/
fun triggerCanStartAutopilotBySessionId(globalSessionId : Long){
fun triggerCanStartAutopilotBySessionId(globalSessionId : SessionWithTime){
val map = hashMapOf<String, Any>()
map[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP
OchChainLogManager.writeChainLog("启动自驾Session判断","已有globalSessionId:${globalSessionId}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DUPLICATED, patch = map)
OchChainLogManager.writeChainLog("启动自驾Session判断","已有globalSessionId:${globalSessionId.sessionId}_创建时间${globalSessionId.setTime}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DUPLICATED, patch = map)
}
/**
* 启动失败后 对比两个session是否相同
*/
fun triggerStartAutopilotFailCheckSessionDiff(globalSessionId: Long, fsmBackSessionId: Long){
fun triggerStartAutopilotFailCheckSessionDiff(globalSessionId: SessionWithTime, fsmBackSessionId: Long){
val map = hashMapOf<String, Any>()
map[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP
map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_START] = globalSessionId
map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_START] = "${globalSessionId.sessionId}_${globalSessionId.setTime}"
map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_FSM_RETURN] = fsmBackSessionId
OchChainLogManager.writeChainLog("启动自驾失败且SessionId不同","globalSessionId:${globalSessionId}——————fsmBackSessionId:${fsmBackSessionId}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DIFF, patch = map)
}
private val timeOutRunnable = Runnable {
// 15s内未开启上报失败埋点
triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis())
LineManager.invokeStartAutopilotTimeOut()
}
private var timeOutDisposable: Disposable?=null
/**
* 底盘明确告知启动自驾失败
*/
fun triggerStartAutopilotFailureEventByAdas(failCode: String, failMsg: String, startFailDate: Long) {
BizLoopManager.removeCallback(timeOutRunnable)
OchChainLogManager.writeChainLogAutopilot("自驾流程","启动自驾失败回调${failCode}_${failMsg}")
if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){
CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent canStartAutopilotBySessionIdInner == false")
OchChainLogManager.writeChainLogAutopilot("自驾流程","异常情况 启动自驾失败回调${failCode}_${failMsg}_sessiong为空")
return
}
RxUtils.disposeSubscribe(timeOutDisposable)
// 判断Session 是否相同
OchAutoPilotManager.checkStartSessionAndFailSessionId()
triggerStartAutopilotFailureEvent(failCode, failMsg, startFailDate)
@@ -134,12 +138,10 @@ object OchAutopilotAnalytics {
}
private fun triggerStartAutopilotFailureEvent(failCode: String, failMsg: String, startFailDate: Long) {
if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){
CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent canStartAutopilotBySessionIdInner == false")
OchAutoPilotManager.clearGlobalSessionId("$failMsg _ ${failCode}")
if (mStartAutopilotParams.isEmpty()) {
return
}
OchAutoPilotManager.clearGlobalSessionId()
if (mStartAutopilotParams.isEmpty()) return
CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent", failMsg)
if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
mStartAutopilotParams[EVENT_PARAM_START_FAILURE_CODE] = failCode
@@ -172,15 +174,19 @@ object OchAutopilotAnalytics {
triggerDate: Long,
source:Int = 0
) {
OchChainLogManager.writeChainLogAutopilot("自驾流程","send:${send}_${restart}_${startName}_${endName}_${lineId}_${orderId}_${source}_${triggerDate}")
mStartAutopilotKey = if (restart) getEventKeyRestartService() else getEventKeyStartService()
if (send) {
if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){
CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotEvent canStartAutopilotBySessionIdInner == false")
OchChainLogManager.writeChainLogAutopilot("自驾流程","异常情况 启动自驾成功_sessiong为空")
return
}
OchAutoPilotManager.clearGlobalSessionId("启动自驾成功")
RxUtils.disposeSubscribe(timeOutDisposable)
if (mStartAutopilotParams.isEmpty()) {
return
}
OchAutoPilotManager.clearGlobalSessionId()
BizLoopManager.removeCallback(timeOutRunnable)
if (mStartAutopilotParams.isEmpty()) return
// 开启成功,上报埋点
mStartAutopilotParams[EVENT_PARAM_START_FAILURE_CODE] = ""
mStartAutopilotParams[EVENT_PARAM_START_FAILURE_MSG] = ""
@@ -200,8 +206,10 @@ object OchAutopilotAnalytics {
mStartAutopilotParams[EVENT_PARAM_END_NAME] = endName
mStartAutopilotParams[EVENT_PARAM_LINE_ID] = lineId
mStartAutopilotParams[EVENT_PARAM_ORDER_NUMBER] = orderId?:""
BizLoopManager.removeCallback(timeOutRunnable)
BizLoopManager.postDelayed(timeOutRunnable,LOOP_PERIOD_15S)
RxUtils.disposeSubscribe(timeOutDisposable)
timeOutDisposable = RxUtils.createSubscribe(LOOP_PERIOD_15S) {
triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis())
}
}
}

View File

@@ -0,0 +1,3 @@
package com.mogo.och.common.module.manager.autopilot.autopilot.bean
data class SessionWithTime(val sessionId:Long,val setTime:Long)

View File

@@ -130,7 +130,7 @@ class CommonSlideView @JvmOverloads constructor(
if(isVisible){
lottie_bg.setAnimation("slide.json")
lottie_bg.playAnimation()
draggableButton.setTextColor(ResourcesUtils.getColor(R.color.white))
draggableButton.setTextColor(context.getColor(R.color.white))
ObjectAnimator.ofFloat(
draggableButton, "translationX", draggableButton.translationX,
0f

View File

@@ -50,11 +50,11 @@ class AutopilotState @JvmOverloads constructor(
autopilotLoadingAnimator = ObjectAnimator.ofFloat(aciv_autopilot_state, "rotation", 0f, 360f);
autopilotLoadingAnimator.interpolator = LinearInterpolator()
autopilotLoadingAnimator.repeatCount = -1 //无限循环
autopilotLoadingAnimator.duration = 1000 //无限循环
autopilotLoadingAnimator.duration = 2000 //无限循环
autopilotChangeStateAnimator = ObjectAnimator.ofFloat(aciv_autopilot_state, "alpha", 1f, 0f,1f);
autopilotChangeStateAnimator.interpolator = LinearInterpolator()
autopilotChangeStateAnimator.duration = 200
autopilotChangeStateAnimator.duration = 300
onClick {
startAutopilot()
}
@@ -127,7 +127,7 @@ class AutopilotState @JvmOverloads constructor(
override fun inAutopilot() {
CallerLogger.d(TAG,"展示自驾中UI")
updateImageInAnimator(R.drawable.common_autopilot_starting_new)
updateImageInAnimator(R.drawable.common_autopilot_running)
actv_pxjs_state.visibility = GONE
actv_autopilot_head.visibility = VISIBLE
@@ -225,7 +225,7 @@ class AutopilotState @JvmOverloads constructor(
actv_pxjs_state.setTextColor(ResourcesUtils.getColor(R.color.common_19FFCB))
AutopilotState@this.isEnabled = false
aciv_autopilot_running_ani.visibility = VISIBLE
aciv_autopilot_running_ani.visibility = GONE
autopilotStateAnimator?.stop()
autopilotLoadingAnimator.cancel()
autopilotChangeStateAnimator.start()
@@ -234,7 +234,7 @@ class AutopilotState @JvmOverloads constructor(
private fun updateImageInAnimator(@DrawableRes resource:Int){
UiThreadHandler.postDelayed({
aciv_autopilot_state.setImageResource(resource)
},100,UiThreadHandler.MODE.QUEUE)
},150,UiThreadHandler.MODE.QUEUE)
}
}

View File

@@ -12,6 +12,7 @@ import com.mogo.och.common.module.manager.autopilot.line.ILineCallback
import com.mogo.och.common.module.manager.autopilot.line.LineManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.RxUtils
import java.util.concurrent.atomic.AtomicBoolean
/**
@@ -126,6 +127,9 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall
OchChainLogManager.writeChainLog("自驾信息","启动自驾")
if(AutopilotStateDebug.debugStatus){
startAutopilotSuccess()
RxUtils.createSubscribe(5_000) {
startAutopilotFail()
}
}else {
LineManager.startAutopilot()
}
@@ -159,7 +163,7 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall
this.isPalyStartAni.set(false)
UiThreadHandler.postDelayed({
autopilotStateChange()
},1000,UiThreadHandler.MODE.QUEUE)
},3000,UiThreadHandler.MODE.QUEUE)
}
}

View File

@@ -0,0 +1,55 @@
package com.mogo.och.common.module.wigets.commonview
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.map.listener.IMogoMapListener
import com.mogo.och.common.module.R
import com.mogo.och.common.module.utils.ResourcesUtils
import kotlinx.android.synthetic.main.common_empty_view.view.no_order_data_tv
class EmptyView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr),IMogoMapListener {
companion object {
const val TAG = "LoadingMapStatusView"
}
private var emptyTitle:String = ""
init {
LayoutInflater.from(context).inflate(R.layout.common_empty_view, this, true)
try {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.EmptyView)
emptyTitle = typedArray.getString(R.styleable.EmptyView_empty_title)?:ResourcesUtils.getString(R.string.common_empty_data)
typedArray.recycle()
} catch (e: Exception) {
e.printStackTrace()
}
no_order_data_tv.text = emptyTitle
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerLogger.d(TAG,"onAttachedToWindow")
}
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerLogger.d(TAG,"onDetachedFromWindow")
}
}

View File

@@ -54,16 +54,18 @@ class OrderStatusView : RelativeLayout, OrderStatusViewModel.IVisualCallback {
override fun setImageViewResource(name: Int,ordering:Boolean) {
iv_order_status.setImageResource(name)
if (iv_order_status.layoutParams is RelativeLayout.LayoutParams) {
val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams
temp.removeRule(RelativeLayout.ALIGN_PARENT_START)
temp.addRule(ALIGN_PARENT_END)
iv_order_status.layoutParams = temp
}else{
val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams
temp.removeRule(RelativeLayout.ALIGN_PARENT_END)
temp.addRule(ALIGN_PARENT_START)
iv_order_status.layoutParams = temp
if (iv_order_status.layoutParams is LayoutParams) {
if(ordering){
val temp = iv_order_status.layoutParams as LayoutParams
temp.removeRule(ALIGN_PARENT_START)
temp.addRule(ALIGN_PARENT_END)
iv_order_status.layoutParams = temp
}else{
val temp = iv_order_status.layoutParams as LayoutParams
temp.removeRule(ALIGN_PARENT_END)
temp.addRule(ALIGN_PARENT_START)
iv_order_status.layoutParams = temp
}
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.och.common.module.wigets.map.orderstatus
import androidx.annotation.DrawableRes
import androidx.lifecycle.ViewModel
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.R
import com.mogo.och.common.module.biz.login.ILoginCallback
@@ -30,6 +31,7 @@ class OrderStatusViewModel : ViewModel(), ILoginCallback {
}
override fun onOpenOrderStatusEnumChange(businessEnum: OpenOrderStatusEnum?) {
CallerLogger.d(TAG,"新的接单状态${businessEnum}")
UiThreadHandler.post({
if (LoginStatusManager.isOpenOrderType()) {
this.viewCallback?.setImageViewResource(R.drawable.common_order_status,true)

View File

@@ -14,6 +14,10 @@
<attr name="assetsfolder" format="string" />
</declare-styleable>
<declare-styleable name="EmptyView">
<attr name="empty_title" format="string" />
</declare-styleable>
<!--阴影布局 -->
<declare-styleable name="ShadowLayout">

View File

@@ -219,8 +219,8 @@ class ShuttleSaasRepository : IRepository {
EventDb.saveEventTaskArriveSite(
task.taskId!!,
task.lineId!!,
start.siteId.toLong(),
start.seq,
end.siteId.toLong(),
end.seq,
task.taskStartTime,
lineInfo.lineName
)

View File

@@ -40,8 +40,8 @@ import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskTabFragment
import com.mogo.och.unmanned.taxi.utils.TPRouteDataTestUtils
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.unmannedMapCL
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_mogo_och_navi_panel_container
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.orderDebugView
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.taxi_close_navi_icon
import kotlinx.android.synthetic.main.unmanned_taxi_panel.orderDebugView
import java.lang.ref.WeakReference
/**
@@ -64,8 +64,6 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
private val lineView = "LINEVIEW"
private var personalDialogFragment: WeakReference<TaxiOperationalDialogFragment>? = null
private var taskTabFragment: WeakReference<TaxiTaskTabFragment>? = null
private fun updateOperationBtnStatusOnModeChange(isRoutingVerifyMode: Boolean) {
if (MogoStatusManager.getInstance().isTaxiUnmanedDriverTakingOrders) {
@@ -175,11 +173,6 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
unmannedMapCL.onPause()
}
fun onChangeOperationStatus() {
if (null == taskTabFragment || taskTabFragment!!.get() == null) return
taskTabFragment!!.get()!!.onCarTakeOrderStatusChanged()
}
override fun onLowMemory() {
super.onLowMemory()
unmannedMapCL.onLowMemory()
@@ -273,15 +266,6 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
}
/**
* 获取站点面板view在[.initViews]时候添加到container中
*
* @return 站点面板view
*/
fun getStationPanelViewId(): Int {
return R.layout.unmanned_taxi_panel
}
/**
* 重新开启自动驾驶
*/
@@ -419,8 +403,9 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingVerifyMode) {
showAmapNaviToStationFragment(isShow)
} else {
if (null == taskTabFragment || taskTabFragment!!.get() == null) return
taskTabFragment!!.get()!!.onNaviToEndStationByAMap(isShow)
// TODO: 需要复原
// if (null == taskTabFragment || taskTabFragment!!.get() == null) return
// taskTabFragment!!.get()!!.onNaviToEndStationByAMap(isShow)
}
} else if (isShow) { //使用routing数据
showRoutingToStationFragment(true)

View File

@@ -22,6 +22,7 @@ import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.commons.utils.MogoAnalyticUtils
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.util.AppUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
@@ -74,16 +75,19 @@ public class DebugView @JvmOverloads constructor(
private var logHistoryTextView: TextView? = null
fun printInfoMsg(msg: String) {
CallerLogger.i(TAG,msg)
printMsg("Info $msg", MainMoGoApplication.getApp().getColor(R.color.background_info))
trackEvent("Info", msg)
}
fun printWarnMsg(msg: String) {
CallerLogger.w(TAG,msg)
printMsg("Warn $msg", MainMoGoApplication.getApp().getColor(R.color.background_debug))
trackEvent("Warn", msg)
}
fun printErrorMsg(msg: String) {
CallerLogger.e(TAG,msg)
printMsg("Error $msg", MainMoGoApplication.getApp().getColor(R.color.background_error))
trackEvent("Error", msg)
}
@@ -155,7 +159,7 @@ public class DebugView @JvmOverloads constructor(
initBroadcastReceiver()
LayoutInflater.from(context).inflate(R.layout.unmanned_taxi_debug_order, this, true)
debugLogHistoryTextView.movementMethod = ScrollingMovementMethod.getInstance()
visibility = GONE
visibility = VISIBLE
logHistoryTextView = debugLogHistoryTextView
initView()

View File

@@ -26,7 +26,6 @@ import com.mogo.och.unmanned.taxi.bean.QueryServingDurationRespBean
import com.mogo.och.unmanned.taxi.bean.QueryTaskRespBean
import com.mogo.och.unmanned.taxi.constant.StationTypeEnum
import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum
import com.mogo.och.unmanned.taxi.ui.task.TaxiCurrentTaskFragment
import kotlinx.android.synthetic.main.unmanned_taxi_operational_data_view.dayCompletedOrdersView
import kotlinx.android.synthetic.main.unmanned_taxi_operational_data_view.dayTotalOrdersView
import kotlinx.android.synthetic.main.unmanned_taxi_operational_data_view.itemDayTv
@@ -115,7 +114,7 @@ class TaxiOperationalDialogFragment : DialogFragment(),
lifecycleScope.launchWhenStarted {
mViewModel.uiStateFlow.map { it.operationalDataUIState }.collect { operationalDataUIState ->
d(TaxiCurrentTaskFragment.TAG, "uiStateFlow-initViewModelObserver: $operationalDataUIState")
d(TAG, "uiStateFlow-initViewModelObserver: $operationalDataUIState")
when (operationalDataUIState) {
is OperationalDataStateUIState.Init -> {
}

View File

@@ -276,14 +276,14 @@ object TaxiTaskModel {
private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener =
object : IOchAutopilotStatusListener {
override fun onAutopilotIpcConnectStatusChanged(status: AdasConstants.IpcConnectionStatus, reason: String?) {
DebugView.printInfoMsg(
"[域控连接状态变化] status=$status, reason=${
if (TextUtils.isEmpty(
reason
)
) "" else reason
}"
)
// DebugView.printInfoMsg(
// "[域控连接状态变化] status=$status, reason=${
// if (TextUtils.isEmpty(
// reason
// )
// ) "" else reason
// }"
// )
}
override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?, lineId: Long) {

View File

@@ -1,27 +1,505 @@
package com.mogo.och.unmanned.taxi.ui.itinerarycurrent
import androidx.lifecycle.ViewModel
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.unmanned.CallerUnmannedListenerManager
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.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.biz.order.TaxiOrderStatusEnum
import com.mogo.och.common.module.manager.autopilot.line.LineManager
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.common.module.utils.ToastUtilsOch
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.unmanned.taxi.R
import com.mogo.och.unmanned.taxi.base.BaseViewModel
import com.mogo.och.unmanned.taxi.base.IUiIntent
import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean
import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.unmanned.taxi.bean.StartServiceRespBean
import com.mogo.och.unmanned.taxi.bean.TrajectoryListRespBean
import com.mogo.och.unmanned.taxi.callback.ITaxiCarServiceCallback
import com.mogo.och.unmanned.taxi.callback.ITaxiTaskWithOrderCallback
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum
import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst
import com.mogo.och.unmanned.taxi.network.TaxiTaskWithOrderServiceManager
import com.mogo.och.unmanned.taxi.ui.debug.DebugView
import com.mogo.och.unmanned.taxi.ui.task.TaskUiIntent
import com.mogo.och.unmanned.taxi.ui.task.TaskWithOrderUIState
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel
import com.mogo.och.unmanned.taxi.ui.task.UnmannedState
import com.mogo.och.unmanned.taxi.utils.TaxiTrajectoryManager
/**
* @author XuXinChao
* @description BadCase录包管理页面
* @since: 2022/12/15
*/
class ItineraryCurrentModel : ViewModel() {
class ItineraryCurrentModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
ITaxiTaskWithOrderCallback, ITaxiCarServiceCallback {
private val TAG = ItineraryCurrentModel::class.java.simpleName
init {
TaxiTaskModel.addTaskWithOrderListener(TAG, this)
TaxiTaskModel.setCarServiceCallback(this)
}
private var viewCallback: SwtichLineViewCallback? = null
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
this.viewCallback = viewCallback
}
override fun onCleared() {
TaxiTaskModel.removeTaskWithOrderListener(TAG)
TaxiTaskModel.removeCarServiceCallback()
super.onCleared()
}
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
this.viewCallback = viewCallback
override fun initUiState(): UnmannedState {
return UnmannedState(TaskWithOrderUIState.Init)
}
override fun handleIntent(intent: IUiIntent) {
when (intent) {
is TaskUiIntent.StartTaskWithOrderLooper -> { //开始轮询
startOrStopCurrentTaskWithOrderLoop(true)
}
is TaskUiIntent.StartOrEndTakeOrder -> {//开始、暂停接单
TaxiTaskModel.updateCarServingStatus()
}
is TaskUiIntent.JumpPassengerCheck -> { //手动点击跳过乘客验证
jumpPassengerCheck()
}
is TaskUiIntent.JourneyCompleted -> { //点击服务完成
journeyCompleted()
}
is TaskUiIntent.CloseOrderByDriver -> {
closeOrderByDriver()
}
is TaskUiIntent.CancelOrder -> {// 取消订单, 暂未加取消类型和原因
cancelOrder(intent.type)
}
is TaskUiIntent.StartTask -> {
startTask()
}
}
}
fun startOrStopCurrentTaskWithOrderLoop(start: Boolean) {
d(TAG, "startOrStopCurrentTaskWithOrderLoop(): isStart=$start")
if (start) {
DebugView.printInfoMsg("[查询TaskWithOrder信息] start loop")
TaxiTaskModel.startQueryCurrentTaskWithOrderLoop()
} else {
DebugView.printInfoMsg("[查询TaskWithOrder信息] stop loop")
TaxiTaskModel.stopQueryCurrentTaskWithOrderLoop()
}
}
private fun cancelOrder(cancelType: Int) {
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
currentTaskWithOrder?.order?.also {
TaxiTaskModel.cancelOrder(it.orderNo, cancelType)
}
}
private fun jumpPassengerCheck() {
DebugView.printInfoMsg("[跳过乘客验证] 准备发送请求")
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
currentTaskWithOrder?.order?.also {
TaxiTaskWithOrderServiceManager.jumpPassengerCheck(
AbsMogoApplication.getApp().applicationContext,
it.orderNo,
object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
DebugView.printInfoMsg("[跳过乘客验证] 请求success")
d(TAG, "jumpPassengerCheck onSuccess:")
}
override fun onFail(code: Int, msg: String?) {
DebugView.printInfoMsg("[跳过乘客验证] 请求fail, code=$code, msg=$msg")
d(TAG, "jumpPassengerCheck onFail: code=$code, msg=$msg")
}
})
}
}
private fun journeyCompleted() {
DebugView.printInfoMsg("[服务完成] 准备发送请求")
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
currentTaskWithOrder?.order?.also {
TaxiTaskWithOrderServiceManager.orderCompleted(
AbsMogoApplication.getApp().applicationContext,
it.orderNo,
object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
DebugView.printInfoMsg("[服务完成] 请求success")
d(TAG, "journeyCompleted onSuccess")
}
override fun onFail(code: Int, msg: String?) {
DebugView.printInfoMsg("[服务完成] 请求fail, code=$code, msg=$msg")
d(TAG, "journeyCompleted onFail: code=$code, msg=$msg")
}
})
}
}
private fun closeOrderByDriver() {
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
currentTaskWithOrder?.order?.orderEndSite?.also {
TaxiTaskModel.submitArriveSite(it.siteId, true)
}
}
private fun startTask(isStartAutopilot: Boolean = true) {
if (!TaxiTaskModel.checkCurrentTaskCondition()) {
ToastUtils.showShort("无任务!")
return
}
TaxiTaskModel.getCurrentTaskWithOrder()?.let {
TaxiTaskModel.startTask(
if (it.order != null && it.order!!.orderStatus >= TaxiOrderStatusEnum.ArriveAtStart.code)
it.order!!.orderLine //当前若是启动的送驾任务 , 则使用订单信息的lineId
else
it.lineId
,isStartAutopilot)
}
}
private fun updateTaskAndOrderUi(currentTaskWithOrder: QueryCurrentTaskRespBean.Result?) {
d(
TAG, "updateTaskAndOrderUi: currentTaskWithOrder=${
GsonUtil.getGson().toJson(currentTaskWithOrder)
}"
)
sendUiState {
copy(
taskWithOrderUIState = TaskWithOrderUIState.TaskWithOrder(
currentTaskWithOrder
)
)
}
}
private fun updatePrepareTaskDelayUI(delayTime: Long, isStart: Boolean) {
d(TAG, "UpdatePrepareTaskDelay120SUI = $isStart")
sendUiState {
copy(
taskWithOrderUIState = TaskWithOrderUIState.UpdatePrepareTaskDelay(delayTime,
isStart
)
)
}
}
private fun updateDriveToNearestStationTaskUI(driveToNearestStationTask: StartServiceRespBean.Result?) {
d(TAG, "updateDriveToNearestStationTaskUI = ${driveToNearestStationTask?.toString()}")
sendUiState {
copy(
taskWithOrderUIState = TaskWithOrderUIState.TaskDriveToNearestStationTask(
driveToNearestStationTask
)
)
}
}
private fun updateOrderTripInfoUI(mileage: Float, duration: Int) {
d(TAG, "updateOrderTripInfoUI")
OchChainLogManager.writeChainLog("到达目的地计算距离和时间", "距离:${mileage} 时间:${duration}")
sendUiState {
copy(
taskWithOrderUIState = TaskWithOrderUIState.UpdateOrderTripInfo(
mileage, duration
)
)
}
}
private fun updateTaskTripInfoLocalCalculateUI(meters: Long, timeInSecond: Long) {
d(TAG, "UpdateTaskTripInfoLocalCalculateUI")
sendUiState {
copy(
taskWithOrderUIState = TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo(
meters, timeInSecond
)
)
}
}
override fun onTaskWithOrderQuerySuccess(timeMillis: Long) {
}
override fun onTaskWithOrderDataChanged(result: QueryCurrentTaskRespBean.Result?) {
d(TAG, "onTaskWithOrderChanged = result = " + GsonUtil.jsonFromObject(result))
DebugView.printInfoMsg("[查询TaskWithOrder信息] 更新数据, 刷新UI")
updateTaskAndOrderUi(result)
// 设置task执行相关状态切换模式时判断使用
if (result == null || result.taskType == TaskTypeEnum.None.code) {
MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, false)
LineManager.setLineInfo(null);
} else {
MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, true)
}
}
override fun onTaskStarted(result: QueryCurrentTaskRespBean.Result?) {
updateLocalCalculateStation(result)
if (result?.endSite != null){
TaxiTaskModel.setBeautificationMode(true)
updateAutopilotControlParameters()
}else{
clearDemoModeAndACParameters()
}
}
private fun updateLocalCalculateStation(result: QueryCurrentTaskRespBean.Result?) {
if (result?.startSite != null && result.endSite != null
) {
d(TAG, "updateLocalCalculateStation start")
val curTaskAndOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
if (curTaskAndOrder.startSite != null && curTaskAndOrder.endSite != null) {
val startStation = MogoLocation()
startStation.longitude = curTaskAndOrder.startSite!!.gcjLon
startStation.latitude = curTaskAndOrder.startSite!!.gcjLat
val endStation = MogoLocation()
endStation.longitude = curTaskAndOrder.endSite!!.gcjLon
endStation.latitude = curTaskAndOrder.endSite!!.gcjLat
TrajectoryAndDistanceManager.setStationPoint(
startStation,
endStation,
curTaskAndOrder.lineId
)
}
} else {
TaxiTaskModel.clearLocalCalculateStation()
}
}
/**
* 开始倒计时120s或者10s拉取任务
* 演练任务120s拉取
* 接驾任务10s拉取
*/
override fun onTaskCompleted(result: QueryCurrentTaskRespBean.Result?) {
d(TAG, "onTaskCompleted: ${result?.currentStatus}, siteId=${result?.endSite?.siteId}")
if (result?.order != null && result.servingStatus == 1){
if (result.taskType <= TaskTypeEnum.VirtualTask.code
&& result.order!!.orderStatus < TaxiOrderStatusEnum.ArriveAtStart.code) {
VoiceNotice.showNotice("已为您接到订单")
}
if (result.order!!.orderStatus == TaxiOrderStatusEnum.ArriveAtStart.code){
VoiceNotice.showNotice("已到达上车地点,等待乘客上车")
}
}
/**
* 1、有订单下(表示当前有订单或者未来有要执行的订单):
* 接驾任务需要立即拉取, 拉取时机在车辆前往上车点状态
* 送驾任务需要立即拉取, 拉取时机在乘客已上车状态
* 2、在没有订单情况下
* 若当前到站的是前往标定站点, 则45s去拉取任务
* 若当前是演练任务到站, 45s去拉取任务
* 若当前是接驾任务到站, 此情况肯定是有订单的, 则走1
* 若当前到站的是送驾任务, 不去拉取, 需等待司机点击服务完成按钮后拉取
*/
if (result?.order != null){ //接到订单情况下
if (QueryCurrentTaskRespBean.isOrderOnTheWayToStart(result)){ //接驾任务拉取
TaxiTaskModel.startPrepareTaskDelay(
TaxiUnmannedConst.START_PREPARE_TO_START_TASK_INTERVAL,
result?.endSite!!.siteId)
}else if (QueryCurrentTaskRespBean.isOrderUserArriveAtStart(result)) { //送驾任务拉取
TaxiTaskModel.startPrepareTaskDelay(0, result?.endSite!!.siteId)
}else{ // 在已经接到订单的其他情况下, 取消倒计时任务拉取
TaxiTaskModel.removePrepareTaskDelay()
}
}else{ //演练任务拉取 6.2.0使用配置的时间拉取, 默认45s
TaxiTaskModel.startPrepareTaskDelay(
CallerUnmannedListenerManager.getVirtualTaskPullTaskIntervalF() * 1000L, result?.endSite!!.siteId)
}
clearDemoModeAndACParameters()
}
override fun onTaskTrajectoryDataChanged(data: TrajectoryListRespBean?) {
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo() //同步轨迹信息
}
override fun onOrderCancel() {
VoiceNotice.showNotice("已取消行程")
//取消自驾,D档位会溜车 map3.6.0 修改
TaxiTaskModel.cancelAutopilot()
// 设置task执行相关状态切换模式时判断使用
MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, false)
LineManager.setLineInfo(null);
}
override fun onOrderArriveAtEnd(orderNo: String) {
TaxiTaskModel.queryOrderByOrderNo(orderNo)
}
/**
* 更新总全程信息(公里和分钟), 后端返回的数据
*/
override fun onOrderTripInfoChanged(mileage: Float, duration: Int) {
updateOrderTripInfoUI(mileage, duration)
}
override fun onOrderJourneyCompleted() {
updateTaskAndOrderUi(null)
//获取新的任务
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
currentTaskWithOrder?.endSite?.also {//使用配置的时间拉取, 默认是45s
TaxiTaskModel.startPrepareTaskDelay(
CallerUnmannedListenerManager.getVirtualTaskPullTaskIntervalF() * 1000L,
it.siteId)
}
// 设置task执行相关状态切换模式时判断使用
MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, false)
LineManager.setLineInfo(null);
}
override fun onStartAutopilot(postDelayTime: Long) {
UiThreadHandler.postDelayed(startTaskRunnable, postDelayTime) // 5s后或者倒计时结束开启自驾, 状态流转
}
private val startTaskRunnable: Runnable = Runnable {
startTask() //状态流转
VoiceNotice.showNotice("车辆正在自动开启自动驾驶")
}
/**
* 主动请求平行驾驶, 停止启动自驾命令, 任务状态需向下流转
*/
override fun onStopAutopilot() {
UiThreadHandler.removeCallbacks(startTaskRunnable)
if (!TaxiTaskModel.checkCurrentTaskCondition()) {
d(TAG, "onStopAutopilot: 无任务无需流转状态")
return
}
startTask(false)
}
override fun onPauseStartAutopilot() {
UiThreadHandler.removeCallbacks(startTaskRunnable)
}
/**
* 开始倒计时120s或者10s拉取任务
* 演练任务120s拉取
* 接驾任务10s拉取
*/
override fun onStartPrepareTaskUI(delayTime: Long, isStart: Boolean) {
updatePrepareTaskDelayUI(delayTime, isStart)
}
/**
* 更新本次任务行程信息, 本地计算的数据
*/
override fun onTaskTripInfoLocalCalculateChanged(meters: Long, timeInSecond: Long) {
updateTaskTripInfoLocalCalculateUI(meters, timeInSecond)
}
override fun onCarEndServiceSuccess(
driveToNearestStationTask: StartServiceRespBean.Result?,
currentTaskWithOrder: QueryCurrentTaskRespBean.Result?
) {
if (currentTaskWithOrder == null) return
if (currentTaskWithOrder.currentStatus < TaskStatusEnum.CompleteTask.code //任务未完成
&& currentTaskWithOrder.currentStatus > TaskStatusEnum.None.code // 暂停接单后查询到任务状态是0, 代表没任务
|| currentTaskWithOrder.order != null) {// 有订单未完成
VoiceNotice.showNotice("暂停接单啦!要完成当前订单哦")
} else {
VoiceNotice.showNotice("暂停接单啦")
updateDriveToNearestStationTaskUI(driveToNearestStationTask)
}
}
override fun onCarEndServiceFailed(code: Int, msg: String) {
ToastUtilsOch.showWithCodeMessage(code, msg)
}
override fun onCarEndServiceError() {
val context = AbsMogoApplication.getApp().applicationContext
if (!NetworkUtils.isConnected(context)) {
ToastUtils.showShort(context.getString(R.string.network_error_tip))
} else {
ToastUtils.showShort(context.getString(R.string.request_error_tip))
}
}
override fun onCarStartServiceSuccess(
driveToNearestStationTask: StartServiceRespBean.Result?,
currentTaskWithOrder: QueryCurrentTaskRespBean.Result?
) {
VoiceNotice.showNotice("开始接单啦")
updateDriveToNearestStationTaskUI(driveToNearestStationTask)
}
override fun onCarStartServiceFailed(code: Int, msg: String) {
val gcJ02Location = OchLocationManager.getGCJ02Location()
ToastUtilsOch.showWithCodeMessage(
code,
"$msg curLatitude = ${gcJ02Location.latitude}" + " curLongitude = ${gcJ02Location.longitude}"
)
}
override fun onCarStartServiceError() {
val context = AbsMogoApplication.getApp().applicationContext
if (!NetworkUtils.isConnected(context)) {
ToastUtils.showShort(context.getString(R.string.network_error_tip))
} else {
ToastUtils.showShort(context.getString(R.string.request_error_tip))
}
}
private fun clearDemoModeAndACParameters(){
if (FunctionBuildConfig.isDemoMode) {
d(TAG, "setIPCDemoModefalse")
CallerAutoPilotControlManager.setIPCDemoMode(false)
}
TaxiTaskModel.clearAutopilotControlParameters()
}
/**
* 将业务订单信息保存,鹰眼可取用
*/
private fun updateAutopilotControlParameters() {
val parameters = TaxiTaskModel.initAutopilotControlParameters()
if (null == parameters) {
CallerLogger.e(TAG, "AutopilotControlParameters is empty.")
return
}
d(TAG, "AutopilotControlParameters is update.")
DebugView.printInfoMsg("[启自驾] updateAutopilotControlParameters调用成功")
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
}

View File

@@ -1,17 +1,84 @@
package com.mogo.och.unmanned.taxi.ui.task.itinerarycurrent
import android.content.Context
import android.graphics.Color
import android.os.CountDownTimer
import android.text.TextUtils
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.findViewTreeViewModelStoreOwner
import androidx.lifecycle.lifecycleScope
import com.amap.api.navi.model.NaviLatLng
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
import com.mogo.eagle.core.function.hmi.ui.widget.ItinerarySummaryDialog
import com.mogo.eagle.core.function.main.MainMoGoApplication
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.kotlin.onClick
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.util.ClickUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.biz.order.TaxiOrderStatusEnum
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
import com.mogo.och.common.module.map.ICommonNaviChangedCallback
import com.mogo.och.common.module.map.MapMakerManager
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.FlowBus
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.common.module.wigets.CommonSlideView
import com.mogo.och.common.module.wigets.OCHCommitDialog
import com.mogo.och.unmanned.taxi.R
import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider
import com.mogo.och.unmanned.taxi.bean.OrderDetail
import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean
import com.mogo.och.unmanned.taxi.bean.StartServiceRespBean
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum
import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum
import com.mogo.och.unmanned.taxi.constant.TaxiDriverEventConst
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst.Companion.TAXI_END_MAP_MAKER
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst.Companion.TAXI_START_MAP_MAKER
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst.Companion.TYPE_MARKER_TAXI_ORDER
import com.mogo.och.unmanned.taxi.ui.debug.DebugView
import com.mogo.och.unmanned.taxi.ui.itinerarycurrent.ItineraryCurrentModel
import com.mogo.och.unmanned.taxi.ui.task.TaskUiIntent
import com.mogo.och.unmanned.taxi.ui.task.TaskWithOrderUIState
import com.mogo.och.unmanned.taxi.ui.task.TaxiOrderCancelDialog
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel
import com.mogo.och.unmanned.taxi.utils.TaskUtils
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_exercise
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_order
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_distance_end
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_end_order
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_submit_task
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelOrder
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.commonSlideViewStartServer
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.gourp_order
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.group_itinerary_info
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.include_empty
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToEnd
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToStart
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.prepareTaskCountdownTv
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.taskStatus
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_time_end
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.endStationName
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.startStationName
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.orderPhoneAndNum
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.pathwayPoint
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.trajectoryType
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.v_bg_route_point_station_name
import kotlinx.coroutines.flow.map
class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineViewCallback {
class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineViewCallback,
View.OnClickListener, ICommonNaviChangedCallback {
constructor(context: Context) : super(context)
@@ -27,6 +94,10 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
const val TAG = "SwitchBizView"
}
private var mPrepareTasCountDownTimer: CountDownTimer? = null
private var dialog: ItinerarySummaryDialog? = null
private var viewModel: ItineraryCurrentModel?=null
private var fragment: LifecycleOwner?=null
@@ -41,6 +112,272 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
fragment = TaxiUnmannedDriverProvider.getFragmentInfo()
}
private fun initViewModelObserver() {
viewModel?.sendUiIntent(TaskUiIntent.StartTaskWithOrderLooper)
//监听返回的数据状态
fragment?.lifecycleScope?.launchWhenStarted {
viewModel?.uiStateFlow?.map { it.taskWithOrderUIState }?.collect { taskAndOrderUiState ->
d(TAG, "uiStateFlow-initViewModelObserver: $taskAndOrderUiState")
when (taskAndOrderUiState) {
is TaskWithOrderUIState.Init -> {
}
// 开始接单后 需要将车开到最近的一个站点就位,然后才能开启 无人化 流程
is TaskWithOrderUIState.TaskDriveToNearestStationTask -> {
if (taskAndOrderUiState.driveToNearestStationTask != null) {
updateViewByDriveToNearestStationTask(taskAndOrderUiState.driveToNearestStationTask)
} else {
updatePrepareTaskDelayUI(0, false)
initContainerView(false)
removeAllMapMarker()
}
}
is TaskWithOrderUIState.TaskWithOrder -> {
val currentTaskWithOrder = taskAndOrderUiState.taskWithOrder
if (currentTaskWithOrder == null) {
initContainerView(false)
removeAllMapMarker()
} else {
updateViewByCurrentTaskWithOrder(currentTaskWithOrder)
}
updateNextTaskFragment(currentTaskWithOrder)
}
is TaskWithOrderUIState.UpdateOrderTripInfo -> {
dialog?.setOrderMileage(taskAndOrderUiState.mileage*1000)
actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.mileage.toLong())
actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.duration.toLong())
}
is TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo -> {
actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.meters.toLong())
actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.timeInSecond.toLong())
}
is TaskWithOrderUIState.UpdatePrepareTaskDelay -> {
updatePrepareTaskDelayUI(
taskAndOrderUiState.delayTime,
taskAndOrderUiState.isStart
)
}
}
}
}
}
/**
* 更新拉取任务倒计时
*/
private fun updatePrepareTaskDelayUI(millisInFuture: Long, isStart: Boolean) {
DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisInFuture / 1000)}")
if (!isStart) {
prepareTaskCountdownTv.visibility = View.GONE
mPrepareTasCountDownTimer?.cancel()
mPrepareTasCountDownTimer = null
return
}
if (mPrepareTasCountDownTimer != null) {
mPrepareTasCountDownTimer?.cancel()
mPrepareTasCountDownTimer = null
}
mPrepareTasCountDownTimer = object : CountDownTimer(millisInFuture, 1000L) {// 倒计时后开启自驾
override fun onTick(millisUntilFinished: Long) {
DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}")
// 倒计时
UiThreadHandler.post {
prepareTaskCountdownTv.visibility = View.VISIBLE
prepareTaskCountdownTv.text =
"距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}"
}
}
override fun onFinish() {
//倒计时结束了...
UiThreadHandler.post {
prepareTaskCountdownTv.visibility = View.INVISIBLE
}
mPrepareTasCountDownTimer?.cancel()
}
}
mPrepareTasCountDownTimer?.start()
}
/**
* 更新当前任务和订单信息
*/
private fun updateViewByCurrentTaskWithOrder(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
if (taskAndOrder == null) return
/**
* 根据任务类型判断任务显示,
* 虚拟单, 显示在进行中 前往上车点
* 演练任务,显示演练任务, 同时有订单显示在待服务中
* 当前任务是接驾任务,显示订单状态+运营单 订单显示在进行中, 任务不再显示
*/
val taskType = taskAndOrder.taskType // 任务类型
val order = taskAndOrder.order // 订单信息
val endSite = taskAndOrder.endSite // 终点
val currentStatus = taskAndOrder.currentStatus // 任务的状态 0空闲 1:获取任务 2:开始任务 3:到达目的地
if ((endSite == null || currentStatus == TaskStatusEnum.CompleteTask.code) // 无任务或者任务已经完成的时候且无订单的时候
&& taskAndOrder.order == null
) {
initContainerView(false)
removeAllMapMarker()
return
}
initContainerView(true)
when (taskType) {
TaskTypeEnum.None.code -> {
if (order != null && (currentStatus == TaskStatusEnum.CompleteTask.code
|| currentStatus == TaskStatusEnum.None.code)
) { //暂停接单会清空前往上车点任务
updateOrderUI(order)
}
}
TaskTypeEnum.VirtualTask.code -> { //演练任务
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) {
updateOrderUI(order)
} else {
updateVirtualTaskUI(taskAndOrder)
}
}
TaskTypeEnum.ToOrderEndTask.code, TaskTypeEnum.ToOrderStartTask.code -> {// 接驾任务 或 送驾任务
order?.also {
updatePathwayPoint(taskType, endSite?.siteName)
updateOrderUI(it)
}
}
}
updateMapMarkers(taskAndOrder)
updateRemainDistanceAndTime(false)
}
// 第一个特殊任务 也是虚拟任务
private fun updateViewByDriveToNearestStationTask(driveToNearestStationTask: StartServiceRespBean.Result?) {
if (driveToNearestStationTask == null) return
initContainerView(true)
// DriverToNearestStationTask 任务更新
gourp_order.visibility = GONE
group_itinerary_info.visibility = VISIBLE
aciv_task_type_exercise.visibility = VISIBLE
// 更新任务状态,起点,终点
taskStatus.text = resources.getString(R.string.task_start_to_virtual_site)
startStationName.text = resources.getString(R.string.task_current_loc)
endStationName.text = driveToNearestStationTask.siteName
setOrRemoveMapMaker(
true,
TAXI_END_MAP_MAKER,
driveToNearestStationTask.wgs84Lat,
driveToNearestStationTask.wgs84Lon,
R.raw.end_marker
)
// 使用高德获取导航数据
startNaviToStation(
false,
driveToNearestStationTask.gcjLat,
driveToNearestStationTask.gcjLon
)
}
private fun showEmptyView() {
gourp_order.visibility = GONE
aciv_task_type_exercise.visibility = GONE
group_itinerary_info.visibility = GONE
include_empty.visibility = VISIBLE
prepareTaskCountdownTv.visibility = GONE
}
private fun initOnClickListener() {
naviToStart.setOnClickListener(this)
naviToEnd.setOnClickListener(this)
cancelOrder.setOnClickListener(this)
taskStatus.setOnClickListener(this)
commonSlideViewStartServer.setSlideListener(object :CommonSlideView.SlideListener{
override fun slideEnd() {
d(TAG, taskStatus.text.toString())
startOrEndService()
}
})
actv_submit_task.onClick {
startOrEndService()
}
actv_end_order.onClick {
startOrEndService()
}
}
private fun initTaskDebugViewListener() {
fragment?.let { fr->
aciv_task_type_exercise.setOnLongClickListener {
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW)
.post(fr.lifecycleScope, true)
false
}
aciv_task_type_order.setOnLongClickListener {
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW)
.post(fr.lifecycleScope, true)
false
}
}
}
private fun startOrEndService() {
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
if (currentTaskWithOrder?.order == null) return
val order = currentTaskWithOrder.order
if (TaxiOrderStatusEnum.ArriveAtStart.code == order!!.orderStatus) { //到达乘客上车点,司机可跳过乘客屏认证
viewModel?.sendUiIntent(TaskUiIntent.JumpPassengerCheck)
} else if (TaxiOrderStatusEnum.UserArriveAtStart.code == order.orderStatus) {
viewModel?.sendUiIntent(TaskUiIntent.StartTask)
} else if (TaxiOrderStatusEnum.ArriveAtEnd.code == order.orderStatus) { //点击了完成服务,结束订单并更新订单信息
viewModel?.sendUiIntent(TaskUiIntent.JourneyCompleted)
} else if (TaxiOrderStatusEnum.OnTheWayToEnd.code == order.orderStatus) { //前往目的地过程中可提前结束行程
//自驾中提示,接管后才能结束
if (getState()
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
) {
ToastUtils.showLong(R.string.taxi_switch_line_btn_warning1)
} else {
closeOrderDialog()
}
}
}
private fun closeOrderDialog() {
val builder = OCHCommitDialog.Builder()
val closeOrderDialog = builder
.title(ResourcesUtils.getString(R.string.dialog_order_close_title))
.tips(ResourcesUtils.getString(R.string.dialog_order_close_content))
.confirmStr(ResourcesUtils.getString(R.string.dialog_order_close_confirm))
.cancelStr(ResourcesUtils.getString(R.string.dialog_order_close_cancel))
.build(context)
closeOrderDialog!!.setClickListener(object : OCHCommitDialog.ClickListener {
override fun confirm() {
viewModel?.sendUiIntent(TaskUiIntent.CloseOrderByDriver)
}
override fun cancel() {
closeOrderDialog.dismiss()
}
})
closeOrderDialog.show()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
@@ -48,6 +385,434 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
ViewModelProvider(it).get(ItineraryCurrentModel::class.java)
}
viewModel?.setDistanceCallback(this)
initOnClickListener()
showEmptyView()
initTaskDebugViewListener()
initViewModelObserver()
}
override fun onClick(v: View?) {
if (!ClickUtils.isFastClick()) {
i(TAG, "view点击过快")
return
}
when (v?.id) {
cancelOrder.id -> {
val currentWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
if (currentWithOrder?.order != null) {
val order = currentWithOrder.order
TaxiOrderCancelDialog(context, order!!.orderStatus) { type ->
viewModel?.sendUiIntent(TaskUiIntent.CancelOrder(type))
}.show()
}
}
naviToStart.id,
naviToEnd.id -> {
showNaviToEndStationFragment(true)
}
}
}
/**
* 显示/隐藏 前往任务目的地的导航
*
* @param isShow
*/
private fun showNaviToEndStationFragment(isShow: Boolean) {
fragment?.let {
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_START_NAVI_TO_END_STATION)
.post(it.lifecycleScope, isShow)
}
}
/**
* 是否有正在进行的订单进行UI显示
*
* @param hasCurrentTask
*/
private fun initContainerView(hasCurrentTask: Boolean) {
d(
TAG,
"hasCurrentTask = $hasCurrentTask"
)
if (hasCurrentTask) {
include_empty.visibility = View.GONE
prepareTaskCountdownTv.visibility = View.GONE
} else {
// 空页面
include_empty.visibility = View.VISIBLE
// 倒计时
prepareTaskCountdownTv.visibility = View.GONE
// 行程信息
group_itinerary_info.visibility = View.GONE
// 订单信息
gourp_order.visibility = View.GONE
// 途经点信息
pathwayPoint.visibility = View.GONE
// 演练单标识
aciv_task_type_exercise.visibility = View.GONE
// 轨迹标识
trajectoryType.visibility = View.GONE
}
}
private fun removeAllMapMarker() {
MapMakerManager.removeAllMapMarkerByOwner(TYPE_MARKER_TAXI_ORDER)
}
private fun updateNextTaskFragment(result: QueryCurrentTaskRespBean.Result?) {
fragment?.let {
FlowBus.with<QueryCurrentTaskRespBean.Result?>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED)
.post(it.lifecycleScope, result)
if (result != null
&& result.taskType == TaskTypeEnum.VirtualTask.code
&& result.order != null
&& result.currentStatus != TaskStatusEnum.CompleteTask.code
) {
VoiceNotice.showNotice("已为您提前接到下一订单,待完成当前任务后服务")
FlowBus.with<Boolean>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT)
.post(it.lifecycleScope, true)
} else {
FlowBus.with<Boolean>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT)
.post(it.lifecycleScope, false)
}
}
}
private fun updateOrderUI(order: OrderDetail) {
cancelOrder.visibility = if (order.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code
) View.GONE else View.VISIBLE
gourp_order.visibility = View.VISIBLE
group_itinerary_info.visibility = View.VISIBLE
aciv_task_type_exercise.visibility = View.GONE
// orderStatus: 0 订单创建(为派单), 10 已派上司机(司机去往上车点), 20 司机到达上车点,
// 30 乘客到达上车点, 40 服务中(去往目的地), 50 到达目的地, 60 已完成, 70 已取消
naviToStart.visibility = if (order.orderStatus
== TaxiOrderStatusEnum.OnTheWayToStart.code
) View.VISIBLE else View.GONE
naviToEnd.visibility = if (order.orderStatus
== TaxiOrderStatusEnum.OnTheWayToEnd.code
) View.VISIBLE else View.GONE
updatePrepareTaskDelayUI(0, false)
orderPhoneAndNum.text = TaskUtils.getCurrentTaskPhoneNumAndPassengerCountHtml(
order.bookingUserPhone,
order.passengerSize
)
startStationName.text = order.orderStartSite?.siteName
endStationName.text = order.orderEndSite?.siteName
TaxiTaskModel.getCurrentOrderTrajectoryList().also {
val orderTrajectory = it.firstOrNull {order.orderLine == it.lineId}
trajectoryType.visibility = if (orderTrajectory?.source == 2)
View.VISIBLE else View.GONE
}
when (order.orderStatus) {
TaxiOrderStatusEnum.None.code -> { //无
dismissDialog()
initContainerView(false)
removeAllMapMarker()
}
TaxiOrderStatusEnum.ArriveAtEnd.code -> { //到达目的地
taskStatus.text = resources.getString(R.string.task_start_end_site)
actv_end_order.visibility = VISIBLE
actv_end_order.text = ResourcesUtils.getString(R.string.module_och_taxi_order_server_end)
commonSlideViewStartServer.visibility = GONE
actv_submit_task.visibility = GONE
showDialog()
hideNaviBtns()
}
TaxiOrderStatusEnum.OnTheWayToEnd.code -> { //送驾中
dismissDialog()
taskStatus.text = resources.getString(R.string.task_start_end_site)
actv_end_order.visibility = VISIBLE
actv_end_order.text = ResourcesUtils.getString(R.string.module_och_taxi_order_close)
commonSlideViewStartServer.visibility = GONE
actv_submit_task.visibility = GONE
}
TaxiOrderStatusEnum.UserArriveAtStart.code, TaxiOrderStatusEnum.ArriveAtStart.code -> {
//乘客到达上车点, 验证成功 ; 到达乘客上车点
dismissDialog()
taskStatus.text = resources.getString(R.string.arrived_start_site)
actv_end_order.visibility = GONE
commonSlideViewStartServer.visibility = GONE
actv_submit_task.visibility = VISIBLE
if (order.orderStatus == TaxiOrderStatusEnum.UserArriveAtStart.code) {
actv_submit_task.text =
ResourcesUtils.getString(R.string.module_och_taxi_order_server_start)
}
else {
actv_submit_task.text =
ResourcesUtils.getString(R.string.module_och_taxi_order_server_start_wait_check)
}
hideNaviBtns()
actv_time_end.text = TaskUtils.getCurrentTaskWaitTimeHtml()
}
TaxiOrderStatusEnum.OnTheWayToStart.code -> { //前往上车地点
dismissDialog()
taskStatus.text = resources.getString(R.string.task_start_start_site)
actv_end_order.visibility = GONE
commonSlideViewStartServer.visibility = VISIBLE
actv_submit_task.visibility = GONE
}
}
}
//展示虚拟订单
private fun updateVirtualTaskUI(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
if (taskAndOrder == null) return
val startSite = taskAndOrder.startSite // 起点
val endSite = taskAndOrder.endSite // 终点
val currentStatus = taskAndOrder.currentStatus // 任务的状态 0空闲 1:获取任务 2:开始任务 3:到达目的地
// 空页面
include_empty.visibility = View.GONE
// 倒计时
prepareTaskCountdownTv.visibility = View.GONE
// 行程信息
group_itinerary_info.visibility = View.VISIBLE
// 订单信息
gourp_order.visibility = View.GONE
// 途经点信息
pathwayPoint.visibility = View.GONE
// 演练单标识
aciv_task_type_exercise.visibility = View.VISIBLE
naviToStart.visibility = View.GONE
naviToEnd.visibility = if (currentStatus >= TaskStatusEnum.StartTask.code) View.VISIBLE else View.GONE
if (startSite == null || endSite == null) return
taskStatus.text = resources.getString(R.string.task_start_end_site)
startStationName.text = startSite.siteName
endStationName.text = endSite.siteName
TaxiTaskModel.getCurrentOrderTrajectoryList().also {
val taskTrajectory = it.firstOrNull {taskAndOrder.lineId == it.lineId}
trajectoryType.visibility = if (taskTrajectory?.source == 2)
View.VISIBLE else View.GONE
}
updatePrepareTaskDelayUI(0, false)
}
private fun updatePathwayPoint(taskType: Int, endSiteName: String?) {
if (TextUtils.isEmpty(endSiteName)) return
pathwayPoint.visibility = if (taskType == TaskTypeEnum.ToOrderStartTask.code)
View.VISIBLE else View.GONE
v_bg_route_point_station_name.text = "途径: $endSiteName"
}
private fun updateMapMarkers(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
if (taskAndOrder?.startSite != null
&& taskAndOrder.endSite != null
) {
when (taskAndOrder.currentStatus) {
TaskStatusEnum.GetTask.code -> {
setOrRemoveMapMaker(
true,
TAXI_START_MAP_MAKER,
taskAndOrder.startSite!!.wgs84Lat,
taskAndOrder.startSite!!.wgs84Lon,
R.raw.star_marker
)
setOrRemoveMapMaker(
true,
TAXI_END_MAP_MAKER,
taskAndOrder.endSite!!.wgs84Lat,
taskAndOrder.endSite!!.wgs84Lon,
R.raw.end_marker
)
}
TaskStatusEnum.StartTask.code -> {
setOrRemoveMapMaker(
false,
TAXI_START_MAP_MAKER,
taskAndOrder.startSite!!.wgs84Lat,
taskAndOrder.startSite!!.wgs84Lon,
R.raw.star_marker
)
setOrRemoveMapMaker(
true,
TAXI_END_MAP_MAKER,
taskAndOrder.endSite!!.wgs84Lat,
taskAndOrder.endSite!!.wgs84Lon,
R.raw.end_marker
)
}
TaskStatusEnum.CompleteTask.code -> {
setOrRemoveMapMaker(
false,
TAXI_START_MAP_MAKER,
taskAndOrder.startSite!!.wgs84Lat,
taskAndOrder.startSite!!.wgs84Lon,
R.raw.star_marker
)
setOrRemoveMapMaker(
false,
TAXI_END_MAP_MAKER,
taskAndOrder.endSite!!.wgs84Lat,
taskAndOrder.endSite!!.wgs84Lon,
R.raw.end_marker
)
}
}
} else {
d(
TAG,
"CurrentTaskWithOrder == " + GsonUtil.jsonFromObject(taskAndOrder)
)
}
}
/**
* 绘制地图起点终点
* @param isAdd
* @param uuid
*/
private fun setOrRemoveMapMaker(
isAdd: Boolean, uuid: String,
lat: Double, lon: Double, resourceId: Int
) {
if (isAdd) {
MapMakerManager.addMapMaker(TYPE_MARKER_TAXI_ORDER, uuid, lat, lon, resourceId)
} else {
MapMakerManager.removeMapMaker(uuid, lat, lon)
}
}
/**
* 根据任务状态计算剩余历程和时间
*/
private fun updateRemainDistanceAndTime(isVoicePlay: Boolean) {
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
d(TAG, "updateRemainDistanceAndTime ${currentTaskWithOrder.currentStatus}")
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) {
if (currentTaskWithOrder.endSite != null) {
startNaviToStation(
isVoicePlay, currentTaskWithOrder.endSite!!.gcjLat,
currentTaskWithOrder.endSite!!.gcjLon
)
}
} else if (currentTaskWithOrder.currentStatus == TaskStatusEnum.CompleteTask.code &&
currentTaskWithOrder.taskType <= TaskTypeEnum.ToOrderStartTask.code
) {
actv_distance_end.text = "已到达 ${currentTaskWithOrder.endSite?.siteName}"
} else {
actv_distance_end.text = "距离 -- 公里, 用时 -- 分钟"
}
}
private fun startNaviToStation(isVoicePlay: Boolean, stationLat: Double, stationLng: Double) {
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
val gcJ02Location = OchLocationManager.getGCJ02Location()
val mCurLatitude = gcJ02Location.latitude
val mCurLongitude = gcJ02Location.longitude
d(TAG, "currentLatLng=$mCurLatitude $mCurLongitude")
val startNaviLatLng = NaviLatLng(mCurLatitude, mCurLongitude)
val endNaviLatLng = NaviLatLng(stationLat, stationLng)
AmapNaviToDestinationModel.getInstance(context).initAMapNavi(startNaviLatLng, endNaviLatLng)
AmapNaviToDestinationModel.getInstance(context).setVoiceIsMute(isVoicePlay)
AmapNaviToDestinationModel.getInstance(context).setTaxiNaviChangedCallback(this)
}
private fun showDialog(){
if(dialog==null&&context!=null){
}
context?.let {
if(dialog==null) {
dialog = ItinerarySummaryDialog(it, true, R.style.summary_dialog)
}
dialog?.let { dialogInner ->
if(!dialogInner.isShowing){
dialogInner.show()
}
}
}
}
private fun dismissDialog(){
dialog?.let {
if(it.isShowing){
it.dismiss()
}
}
dialog = null
}
private fun hideNaviBtns() {
naviToStart.visibility = View.GONE
naviToEnd.visibility = View.GONE
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
fragment?.let {
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT)
.post(it.lifecycleScope, false)
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_ROUTING_TO_STATION_FRAGMENT)
.post(it.lifecycleScope, false)
}
}
override fun onCurrentNaviDistAndTimeChanged(meters: Int, timeInSecond: Long) {
actv_distance_end.text = TaskUtils.getCurrentTaskDistance(meters.toLong())
actv_time_end.text = TaskUtils.getCurrentTaskTime(timeInSecond)
}
override fun reInitNaviAmap(isPlay: Boolean, isRestart: Boolean) {
d(TAG, "isPlay = $isPlay, isRestart=$isRestart")
if (!isRestart) {
fragment?.let {
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT)
.post(it.lifecycleScope, false)
}
return
}
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
UiThreadHandler.postDelayed({
updateRemainDistanceAndTime(false)
}, 2000)
UiThreadHandler.postDelayed({
if (currentTaskWithOrder?.currentStatus == TaskStatusEnum.GetTask.code
) {
if (naviToStart.visibility == View.GONE) {
naviToStart.visibility = View.VISIBLE
}
}
if ((currentTaskWithOrder?.currentStatus == TaskStatusEnum.StartTask.code
&& currentTaskWithOrder.order == null)
|| (currentTaskWithOrder?.order?.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code)
) {
if (naviToEnd.visibility == View.GONE) {
naviToEnd.visibility = View.VISIBLE
}
}
}, 3000)
}
}

View File

@@ -3,14 +3,30 @@ package com.mogo.och.unmanned.taxi.ui.task.itinerarynext
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.findViewTreeViewModelStoreOwner
import com.mogo.och.common.module.wigets.WindowRelativeLayout
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.och.common.module.utils.FlowBus
import com.mogo.och.unmanned.taxi.R
import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider
import com.mogo.och.unmanned.taxi.bean.OrderDetail
import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum
import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum
import com.mogo.och.unmanned.taxi.constant.TaxiDriverEventConst
import com.mogo.och.unmanned.taxi.ui.itinerarynext.ItineraryNextModel
import com.mogo.och.unmanned.taxi.ui.task.TaxiOrderCancelDialog
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel
import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.aciv_order_close
import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_end_station_name
import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_order_count
import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_order_phone
import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_start_station_name
import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.group_order_next
import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.include_empty
class ItineraryNextView: ConstraintLayout, ItineraryNextModel.SwtichLineViewCallback {
@@ -40,6 +56,17 @@ class ItineraryNextView: ConstraintLayout, ItineraryNextModel.SwtichLineViewCall
private fun initView() {
fragment = TaxiUnmannedDriverProvider.getFragmentInfo()
aciv_order_close.onClick { //取消待服务订单
val currentWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
if (currentWithOrder?.order != null) {
val order = currentWithOrder.order
TaxiOrderCancelDialog(context, order!!.orderStatus) { type ->
TaxiTaskModel.cancelOrder(order.orderNo,type)
}.show()
}
}
showNoNextTaskView()
}
@@ -49,6 +76,69 @@ class ItineraryNextView: ConstraintLayout, ItineraryNextModel.SwtichLineViewCall
ViewModelProvider(it)[ItineraryNextModel::class.java]
}
viewModel?.setDistanceCallback(this)
initTaskDebugViewListener()
}
fun onTaskDataChanged(taskWithOrder: QueryCurrentTaskRespBean.Result?) {
if (taskWithOrder?.order == null) {
showNoNextTaskView()
return
}
if (taskWithOrder.taskType == TaskTypeEnum.VirtualTask.code &&
taskWithOrder.currentStatus != TaskStatusEnum.CompleteTask.code
) {
val order = taskWithOrder.order
updateTaskUI(order!!)
} else {
showNoNextTaskView()
}
}
private fun showNoNextTaskView() {
include_empty.visibility = View.VISIBLE
group_order_next.visibility = View.GONE
}
private fun showNextTaskView() {
include_empty.visibility = View.GONE
group_order_next.visibility = View.VISIBLE
}
private fun updateTaskUI(order: OrderDetail) {
showNextTaskView()
var tempPhone = order.bookingUserPhone
tempPhone.let {
if (it.length > 8) {
//截取电话号码前三位
val phoneNumPre = it.substring(0, 3)
//截取电话号码后四位
val phoneNumFix = it.substring(7)
tempPhone = "$phoneNumPre****$phoneNumFix"
}
}
actv_order_phone.text = tempPhone
order.passengerSize
actv_order_count.text = "${order.passengerSize}"
order.orderStartSite?.let {
actv_start_station_name.text = it.siteName
}
order.orderEndSite?.let {
actv_end_station_name.text = it.siteName
}
}
private fun initTaskDebugViewListener() {
fragment?.let { fr->
FlowBus.with<QueryCurrentTaskRespBean.Result?>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED)
.register(fr) { taskWithOrder ->
onTaskDataChanged(taskWithOrder)
}
}
}
}

View File

@@ -84,10 +84,6 @@ class ItinerarySwitchView: ConstraintLayout, ItinerarySwitchModel.SwtichLineView
.register(it) { show ->
taxiServerSelector.setNextItineraryRedBagVisable( if (show) View.VISIBLE else View.GONE)
}
// FlowBus.with<QueryCurrentTaskRespBean.Result?>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED)
// .register(it) { taskWithOrder ->
// nextTaskFragment?.onTaskDataChanged(taskWithOrder)
// }
}
}

View File

@@ -61,7 +61,7 @@ class TaxiSelectViewGroup @JvmOverloads constructor(
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
if(isVisible){
textCurrentItinerary.setCheck(true)
}else{
}

View File

@@ -8,7 +8,7 @@
xmlns:tools="http://schemas.android.com/tools">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_status"
android:id="@+id/taskStatus"
android:textSize="@dimen/dp_40"
android:textColor="@color/white"
android:text="前往接驾"
@@ -19,9 +19,9 @@
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_order_close"
app:layout_constraintTop_toTopOf="@+id/actv_order_status"
app:layout_constraintBottom_toBottomOf="@+id/actv_order_status"
android:id="@+id/cancelOrder"
app:layout_constraintTop_toTopOf="@+id/taskStatus"
app:layout_constraintBottom_toBottomOf="@+id/taskStatus"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_53"
android:src="@drawable/taxi_task_close"
@@ -30,7 +30,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_phone"
app:layout_constraintTop_toBottomOf="@+id/actv_order_status"
app:layout_constraintTop_toBottomOf="@+id/taskStatus"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_9"
android:layout_marginStart="@dimen/dp_54"
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_count"
android:id="@+id/orderPhoneAndNum"
app:layout_constraintTop_toTopOf="@+id/actv_order_phone"
app:layout_constraintStart_toEndOf="@+id/actv_order_phone"
app:layout_constraintBottom_toBottomOf="@+id/actv_order_phone"
@@ -61,23 +61,27 @@
android:id="@+id/aciv_task_type_order"
app:layout_constraintTop_toTopOf="@+id/actv_order_phone"
app:layout_constraintBottom_toBottomOf="@+id/actv_order_phone"
app:layout_constraintStart_toEndOf="@+id/actv_order_count"
app:layout_constraintStart_toEndOf="@+id/orderPhoneAndNum"
android:src="@drawable/taxi_task_order"
android:layout_marginStart="@dimen/dp_20"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_50"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/group_order_info"
app:constraint_referenced_ids="aciv_task_type_order,actv_order_count,actv_order_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_task_type_exercise"
android:src="@drawable/taxi_task_exercise"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_54"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_50"/>
<View
android:id="@+id/v_bg_itinerary_info"
app:layout_constraintTop_toBottomOf="@+id/aciv_task_type_order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_goneMarginTop="@dimen/dp_97"
android:layout_marginTop="@dimen/dp_27"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginEnd="@dimen/dp_52"
@@ -116,7 +120,7 @@
android:src="@drawable/taxi_task_current_end_station_point" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_current_itinerary_start_name"
android:id="@+id/startStationName"
app:layout_constraintTop_toTopOf="@+id/aciv_current_itinerary_start_point"
app:layout_constraintBottom_toBottomOf="@+id/aciv_current_itinerary_start_point"
app:layout_constraintStart_toEndOf="@+id/aciv_current_itinerary_start_point"
@@ -127,13 +131,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/naviToStart"
app:layout_constraintTop_toTopOf="@+id/startStationName"
app:layout_constraintBottom_toBottomOf="@+id/startStationName"
app:layout_constraintEnd_toEndOf="@+id/v_bg_itinerary_info"
android:src="@drawable/taxi_task_nav"
android:layout_marginEnd="@dimen/dp_36"
android:layout_width="@dimen/dp_46"
android:layout_height="@dimen/dp_46"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_distance_end"
android:text="5.2公里"
android:textSize="@dimen/dp_32"
android:textColor="@color/taxi_color_CCCCCC"
app:layout_constraintTop_toBottomOf="@+id/actv_current_itinerary_start_name"
app:layout_constraintStart_toStartOf="@+id/actv_current_itinerary_start_name"
app:layout_constraintTop_toBottomOf="@+id/startStationName"
app:layout_constraintStart_toStartOf="@+id/startStationName"
app:layout_constraintBottom_toTopOf="@+id/actv_time_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@@ -144,14 +158,14 @@
android:textSize="@dimen/dp_32"
android:textColor="@color/taxi_color_CCCCCC"
app:layout_constraintTop_toBottomOf="@+id/actv_distance_end"
app:layout_constraintStart_toStartOf="@+id/actv_current_itinerary_start_name"
app:layout_constraintBottom_toTopOf="@+id/actv_current_itinerary_end_name"
app:layout_constraintStart_toStartOf="@+id/startStationName"
app:layout_constraintBottom_toTopOf="@+id/endStationName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_current_itinerary_end_name"
android:id="@+id/endStationName"
app:layout_constraintTop_toTopOf="@+id/aciv_current_itinerary_end_point"
app:layout_constraintBottom_toBottomOf="@+id/aciv_current_itinerary_end_point"
app:layout_constraintStart_toEndOf="@+id/aciv_current_itinerary_end_point"
@@ -161,4 +175,157 @@
android:textSize="@dimen/dp_40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/trajectoryType"
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
app:layout_constraintLeft_toRightOf="@id/endStationName"
app:layout_constraintTop_toTopOf="@id/endStationName"
android:src="@drawable/taxi_driver_trajectory_type_auto"
android:visibility="gone"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/naviToEnd"
app:layout_constraintTop_toTopOf="@+id/endStationName"
app:layout_constraintBottom_toBottomOf="@+id/endStationName"
app:layout_constraintEnd_toEndOf="@+id/v_bg_itinerary_info"
android:src="@drawable/taxi_task_nav"
android:layout_marginEnd="@dimen/dp_36"
android:layout_width="@dimen/dp_46"
android:layout_height="@dimen/dp_46"/>
<View
android:id="@+id/v_bg_route_point"
app:layout_constraintTop_toBottomOf="@+id/v_bg_itinerary_info"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_goneMarginTop="@dimen/dp_97"
android:layout_marginTop="@dimen/dp_28"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginEnd="@dimen/dp_52"
android:layout_width="match_parent"
android:background="@drawable/shape_itinerary_bg_default"
android:layout_height="@dimen/dp_100"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/v_bg_route_point_head"
app:layout_constraintTop_toTopOf="@+id/v_bg_route_point"
app:layout_constraintBottom_toBottomOf="@+id/v_bg_route_point"
app:layout_constraintStart_toStartOf="@+id/v_bg_route_point"
android:src="@drawable/taxi_task_start_station_point"
android:layout_marginStart="@dimen/dp_37"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/v_bg_route_point_station_name"
android:text="途经无人化站点A"
app:layout_constraintTop_toTopOf="@+id/v_bg_route_point"
app:layout_constraintBottom_toBottomOf="@+id/v_bg_route_point"
app:layout_constraintStart_toEndOf="@+id/v_bg_route_point_head"
android:layout_marginStart="@dimen/dp_37"
android:textSize="@dimen/dp_36"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_submit_task"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
app:pressed_enabled="false"
android:gravity="center"
android:text="@string/module_och_taxi_order_server_start_wait_check"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="@dimen/dp_56"
android:background="@drawable/taxi_button_selector"
android:textColor="@color/taxi_submit_text_color_selector"
android:textSize="@dimen/dp_40" />
<com.mogo.och.common.module.wigets.CommonSlideView
android:id="@+id/commonSlideViewStartServer"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:assetsfolder="images"
app:slide_title="@string/module_och_taxi_order_server_start"
android:visibility="gone"
android:layout_marginBottom="@dimen/dp_56"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginEnd="@dimen/dp_52"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_120"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_end_order"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
app:pressed_enabled="false"
android:gravity="center"
android:visibility="gone"
android:text="@string/module_och_taxi_order_server_end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginBottom="@dimen/dp_55"
android:background="@drawable/taxi_button_selector"
android:textColor="@color/taxi_button_red_text_color"
android:textSize="@dimen/dp_40" />
<!-- 途经点 -->
<androidx.constraintlayout.widget.Group
android:id="@+id/pathwayPoint"
android:visibility="gone"
app:constraint_referenced_ids="v_bg_route_point,v_bg_route_point_head,v_bg_route_point_station_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/gourp_order"
app:constraint_referenced_ids="taskStatus,actv_order_phone,orderPhoneAndNum,aciv_task_type_order,cancelOrder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/group_itinerary_info"
app:constraint_referenced_ids="v_bg_itinerary_info,aciv_current_itinerary_start_point,v_line_current_start_end,aciv_current_itinerary_end_point,startStationName,naviToStart,actv_distance_end,actv_time_end,endStationName,naviToEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/group_itinerary_actions"
android:visibility="gone"
app:constraint_referenced_ids="actv_submit_task,commonSlideViewStartServer,actv_end_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.mogo.och.common.module.wigets.commonview.EmptyView
android:id="@+id/include_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:empty_title="暂无服务订单"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/prepareTaskCountdownTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/taxi_color_91A1EA"
android:textSize="@dimen/dp_30"
android:layout_marginTop="50dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/include_empty" />
</merge>

View File

@@ -72,17 +72,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_task_type_exercise"
app:layout_constraintTop_toTopOf="@+id/v_next_itinerary_bg"
app:layout_constraintStart_toStartOf="@+id/v_next_itinerary_bg"
android:layout_marginTop="@dimen/dp_29"
android:src="@drawable/taxi_task_exercise"
android:layout_marginStart="@dimen/dp_30"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_50"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_next_start_station_point"
android:src="@drawable/taxi_task_start_station_point"
@@ -94,6 +83,7 @@
android:layout_height="@dimen/dp_30"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_start_station_name"
app:layout_constraintTop_toTopOf="@+id/aciv_next_start_station_point"
app:layout_constraintBottom_toBottomOf="@+id/aciv_next_start_station_point"
app:layout_constraintStart_toEndOf="@+id/aciv_next_start_station_point"
@@ -128,6 +118,7 @@
android:layout_height="@dimen/dp_30"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_end_station_name"
app:layout_constraintTop_toTopOf="@+id/aciv_next_end_station_point"
app:layout_constraintBottom_toBottomOf="@+id/aciv_next_end_station_point"
app:layout_constraintStart_toEndOf="@+id/aciv_next_end_station_point"
@@ -140,4 +131,24 @@
android:lineSpacingMultiplier="1.2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/group_order_next"
android:visibility="gone"
tools:visibility="visible"
app:constraint_referenced_ids="v_next_itinerary_bg,actv_order_phone,actv_order_count,aciv_next_end_station_point,aciv_task_type_order,aciv_order_close,aciv_next_start_station_point,actv_start_station_name,v_line_next_start_end,actv_end_station_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.mogo.och.common.module.wigets.commonview.EmptyView
android:id="@+id/include_empty"
tools:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:empty_title="暂无服务订单"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</merge>

View File

@@ -28,19 +28,21 @@
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_28"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/taxiServerSelector"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="0dp"/>
<com.mogo.och.unmanned.taxi.ui.task.itinerarynext.ItineraryNextView
android:id="@+id/nextItinerary"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_87"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/taxiServerSelector"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="0dp"/>
</merge>

View File

@@ -75,4 +75,13 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.mogo.och.unmanned.taxi.ui.debug.DebugView
android:id="@+id/orderDebugView"
android:layout_width="@dimen/taxi_debug_view_width"
android:visibility="visible"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/unmannedMapCL"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -9,11 +9,4 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.mogo.och.unmanned.taxi.ui.debug.DebugView
android:id="@+id/orderDebugView"
android:layout_width="@dimen/taxi_debug_view_width"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
</LinearLayout>

View File

@@ -43,4 +43,5 @@
<color name="taxi_color_80000000">#80000000</color>
<color name="taxi_color_2EACFF">#2EACFF</color>
<color name="taxi_color_FF4E41">#FF4E41</color>
<color name="taxi_color_91A1EA">#91A1EA</color>
</resources>

View File

@@ -23,6 +23,7 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandl
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT
import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkModel
import com.zhidaoauto.map.data.road.RoadCross
import java.lang.Exception
class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener,
IMoGoMapRoadListener {
@@ -70,15 +71,17 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener,
}
// CallerLogger.i("$M_BIZ$TAG", "红绿灯路口请求 : $stopLineDis")
mLocation?.let { it ->
trafficLightNetWorkModel.requestRoadID(
it.latitude, it.longitude, it.heading,
{
mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD)
roadIDResult = it
},
{
//CallerLogger.w(M_V2X + TAG, "request road id error : $it")
})
try {
trafficLightNetWorkModel.requestRoadID(
it.latitude, it.longitude, it.heading,
{
mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD)
roadIDResult = it
},
{
//CallerLogger.w(M_V2X + TAG, "request road id error : $it")
})
}catch (_: Exception){}
}
}, {
//stop loop search road id

View File

@@ -47,7 +47,7 @@ class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter<Ta
fun notifyRecordItemChanged(info: TakeOverRecordInfo){
val pos = data?.indexOf(info)
pos?.let {
data!![pos] = info
data?.set(pos, info)
notifyItemChanged(pos)
}
}

View File

@@ -15,6 +15,7 @@ import com.mogo.eagle.core.utilcode.util.ClickUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import kotlinx.android.synthetic.main.view_tool_driver_roma.view.ivRomaView
import kotlinx.android.synthetic.main.view_tool_driver_roma.view.toolDriverRomaContainer
class ToolDriverRomaView @JvmOverloads constructor(
context: Context,
@@ -41,7 +42,7 @@ class ToolDriverRomaView @JvmOverloads constructor(
0
)
setOnClickListener {
toolDriverRomaContainer.setOnClickListener {
if (ClickUtils.isClickTooFrequent(this, 2500)) {
ToastUtils.showShort("不要频繁点击哦~")
return@setOnClickListener

View File

@@ -294,17 +294,17 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 28f).toFloat()
)
tvV2XHintContent.setTypeface(null, Typeface.NORMAL)
tvV2XHintContent.setTypeface(null, Typeface.BOLD)
tvV2XHintContent.setPadding(0, 0, 0, AutoSizeUtils.dp2px(context, 28f))
val containerImageAndLiveVideoLayoutParams =
containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams
containerImageAndLiveVideoLayoutParams.width =
AutoSizeUtils.dp2px(context, 350f + 18f * (350f / 480f)) //乘客屏视频加载里面背景切图包含了白边
AutoSizeUtils.dp2px(context, 350f) //乘客屏视频加载里面背景切图包含了白边
containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 197f)
containerImageAndLiveVideoLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 20f),
AutoSizeUtils.dp2px(context, 23f - 14f * (54f / 69f)), //乘客屏icon ivV2XImage带了白边
AutoSizeUtils.dp2px(context, 23.3f - 14f * (54f / 69f)), //乘客屏icon ivV2XImage带了白边
AutoSizeUtils.dp2px(context, 20f),
0
)

View File

@@ -158,10 +158,10 @@
<!-- 前方路况探查 -->
<com.mogo.eagle.core.function.view.RoadCrossRoamView
android:id="@+id/viewRoadCrossRoam"
android:layout_width="@dimen/dp_654"
android:layout_width="@dimen/dp_694"
android:layout_height="@dimen/dp_790"
android:layout_marginTop="@dimen/dp_39"
android:layout_marginEnd="@dimen/dp_19"
android:layout_marginEnd="@dimen/dp_24"
android:visibility="gone"
android:focusable="false"
android:focusableInTouchMode="false"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cl_roma_bg"
android:id="@+id/toolDriverRomaContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@@ -1420,9 +1420,15 @@ class TravelRealityView @JvmOverloads constructor(
if (isSmallMap) {
if (globalPath.wayPointsList.size > 0) {
this.globalPathResp = globalPath
val pointCloneList = ArrayList<Point>()
globalPath.wayPointsList.forEach { loc ->
pointCloneList.add(Point(loc.longitude, loc.latitude))
}
reqData = pointCloneList
drawRotting()
}
} else {
this.globalPathResp = globalPath
val pointList = ArrayList<Point>()
val pointCloneList = ArrayList<Point>()
globalPath.wayPointsList.forEach { loc ->

View File

@@ -64,21 +64,21 @@ bytex.ASM_API=ASM7
LOGLIB_VERSION=1.10.18
######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.7.40
MOGO_NETWORK_VERSION=1.4.7.42
# 鉴权
MOGO_PASSPORT_VERSION=1.4.7.40
MOGO_PASSPORT_VERSION=1.4.7.42
# 长链接
MOGO_SOCKET_VERSION=1.4.7.40
MOGO_SOCKET_VERSION=1.4.7.42
# 数据采集
MOGO_REALTIME_VERSION=1.4.7.40
MOGO_REALTIME_VERSION=1.4.7.42
# 直播推流
MOGO_LIVE_VERSION=1.4.7.40
MOGO_LIVE_VERSION=1.4.7.42
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.7.40
MOGO_TRAFFICLIVE_VERSION=1.4.7.42
# 定位服务
MOGO_LOCATION_VERSION=1.4.7.40
MOGO_LOCATION_VERSION=1.4.7.42
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.7.40
MOGO_TELEMATIC_VERSION=1.4.7.42
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=3.4.1.2
@@ -90,8 +90,8 @@ WEBSOCKET_VERSION=1.1.7
applicationId=com.mogo.launcer
applicationName=IntelligentPilot
# RoboBus司机端2.5.1RoboTaxi司机端2.5.1RoboTaxi乘客端1.0.0
versionCode=6006000
versionName=6.6.0
versionCode=6007000
versionName=6.7.0
################# 新架构模块Maven版本管理 #################
MOGO_CORE_FUNCTION_HMI_VERSION=0.0.58.10