[6.0.0] opt
This commit is contained in:
@@ -26,11 +26,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.initBadCase
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showToolsView
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
|
||||
import com.mogo.eagle.core.function.smp.view.SmallMapView
|
||||
import com.mogo.eagle.core.function.view.MapBizView
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
|
||||
@@ -43,42 +40,38 @@ import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.ui.TaxiAmapNaviFragment
|
||||
import com.mogo.och.taxi.ui.TaxiRottingNaviFragment
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.anim_flow_iv
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.groupTestPanel
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.mapBizView
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_autopilot_status
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_navi_panel_container
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_operation_status
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_speed_tv
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_station_panel_container
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_autopilot_iv
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_autopilot_tv
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_taxi_badcase_ll
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_taxi_setting_layout
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_taxi_swich_map_layout
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.smallMapView
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.taxi_close_navi_icon
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.taxi_switch_icon
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.viewDriverMsgBoxBubble
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.viewDriverMsgBoxButton
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.viewDriverMsgBoxList
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/
|
||||
abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P>(),
|
||||
IMogoMapListener,IMoGoAutopilotRecordListener {
|
||||
abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V, P>(),
|
||||
IMogoMapListener, IMoGoAutopilotRecordListener {
|
||||
|
||||
private val TAG = "BaseOchFragment"
|
||||
private var ctvAutopilotStatusRL: RelativeLayout? = null
|
||||
private var mAnimFlowIv: ImageView? = null
|
||||
protected var tvOperationStatus: TextView? = null
|
||||
protected var mDriverRole: TextView? = null
|
||||
private var flStationPanelContainer: FrameLayout? = null
|
||||
private var flNaviPanelContainer: FrameLayout? = null
|
||||
private var mapBizView: MapBizView? = null
|
||||
private var groupTestPanel: Group? = null
|
||||
private var mSpeedView: TextView? = null
|
||||
private var mAutopilotImage: ImageView? = null
|
||||
private var mAutopilotTv: TextView? = null
|
||||
private var mMapswitchBtn: LinearLayout? = null
|
||||
private var mSwitchBtnIcon: ImageView? = null
|
||||
private var mCloseNaviIcon: ImageView? = null
|
||||
private var mSettingBtn: RelativeLayout? = null
|
||||
private var mBadcaseBtn: LinearLayout? = null
|
||||
|
||||
//消息盒子
|
||||
private var driverMsgBoxButtonView: DriverMsgBoxButtonView? = null
|
||||
protected var viewDriverMsgBoxList: DriverMsgBoxListView? = null
|
||||
protected var viewDriverMsgBoxBubble: DriverMsgBoxBubbleView? = null
|
||||
|
||||
private var ochAmapNaviFragment: TaxiAmapNaviFragment? = null
|
||||
private var taxiRottingNaviFragment: TaxiRottingNaviFragment? = null
|
||||
// protected TaxiTrafficLightView mTrafficLightView;
|
||||
|
||||
// protected TaxiTrafficLightView mTrafficLightView;
|
||||
private var smallMapView: SmallMapView? = null
|
||||
|
||||
private val mHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
@@ -146,30 +139,13 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
override fun initViews() {
|
||||
mapBizView = findViewById(R.id.mapBizView)
|
||||
groupTestPanel = findViewById(R.id.groupTestPanel)
|
||||
ctvAutopilotStatusRL = findViewById(R.id.module_mogo_och_autopilot_status)
|
||||
ctvAutopilotStatusRL!!.background =
|
||||
resources.getDrawable(R.drawable.taxi_autopilot_bg_selector,null)
|
||||
module_mogo_och_autopilot_status.background =
|
||||
resources.getDrawable(R.drawable.taxi_autopilot_bg_selector, null)
|
||||
updateCtvAutopilotStatusTag(false)
|
||||
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv)
|
||||
mAnimFlowIv = findViewById(R.id.anim_flow_iv)
|
||||
mAutopilotTv = findViewById(R.id.module_och_autopilot_tv)
|
||||
flStationPanelContainer =
|
||||
findViewById(R.id.module_mogo_och_station_panel_container)
|
||||
driverMsgBoxButtonView = findViewById(R.id.viewDriverMsgBoxButton)
|
||||
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList)
|
||||
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble)
|
||||
mSpeedView = findViewById(R.id.module_mogo_och_speed_tv)
|
||||
mCloseNaviIcon = findViewById(R.id.taxi_close_navi_icon)
|
||||
flNaviPanelContainer = findViewById(R.id.module_mogo_och_navi_panel_container)
|
||||
mSpeedView!!.isLongClickable = true //调试按钮任意模式下都开
|
||||
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status)
|
||||
mDriverRole = findViewById(R.id.taxi_driver_role_tv)
|
||||
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_layout)
|
||||
mSwitchBtnIcon = findViewById(R.id.taxi_switch_icon)
|
||||
|
||||
module_mogo_och_speed_tv.isLongClickable = true //调试按钮任意模式下都开
|
||||
updateSwitchMapIcon()
|
||||
mMapswitchBtn!!.setOnClickListener {
|
||||
module_och_taxi_swich_map_layout.setOnClickListener {
|
||||
//视角切换
|
||||
val start = SystemClock.elapsedRealtime()
|
||||
try {
|
||||
@@ -179,13 +155,13 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
if (controller.currentMapVisualAngle.isLongSight) {
|
||||
getMapUIController()?.setLockMode(true)
|
||||
controller.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mSwitchBtnIcon!!.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
taxi_switch_icon.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
} else if (controller.currentMapVisualAngle.isMediumSight) {
|
||||
getMapUIController()?.setLockMode(false)
|
||||
controller.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
|
||||
mSwitchBtnIcon!!.setImageResource(R.drawable.taxi_switch_map_long)
|
||||
taxi_switch_icon.setImageResource(R.drawable.taxi_switch_map_long)
|
||||
} else {
|
||||
mSwitchBtnIcon!!.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
taxi_switch_icon.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -195,27 +171,25 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
)
|
||||
}
|
||||
}
|
||||
mSettingBtn = findViewById(R.id.module_och_taxi_setting_layout)
|
||||
mSettingBtn!!.setOnClickListener {
|
||||
module_och_taxi_setting_layout.setOnClickListener {
|
||||
showToolsView()
|
||||
}
|
||||
|
||||
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
|
||||
mBadcaseBtn = findViewById(R.id.module_och_taxi_badcase_ll)
|
||||
if (mBadcaseBtn != null) {
|
||||
initBadCase(mBadcaseBtn!!)
|
||||
// mBadCaseBtn的visible显示逻辑在showBadcaseEntrance内处理
|
||||
if (module_och_taxi_badcase_ll != null) {
|
||||
initBadCase(module_och_taxi_badcase_ll)
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
}
|
||||
panelView = LayoutInflater.from(context)
|
||||
.inflate(getStationPanelViewId(), flStationPanelContainer)
|
||||
ctvAutopilotStatusRL!!.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
.inflate(getStationPanelViewId(), module_mogo_och_station_panel_container)
|
||||
module_mogo_och_autopilot_status.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
override fun onClickImpl(v: View) {
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
if (getState() ==
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
|
||||
) {
|
||||
return //远程代驾状态下不可开启自动驾驶,只能等远程代驾主动退出
|
||||
} else if (!(ctvAutopilotStatusRL!!.tag as Boolean)) {
|
||||
} else if (!(module_mogo_och_autopilot_status.tag as Boolean)) {
|
||||
ToastUtils.showShort(resources.getString(R.string.module_och_taxi_auto_disable_tip1))
|
||||
} else {
|
||||
startAutopilot()
|
||||
@@ -225,11 +199,11 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
|
||||
// debug下调用测试面板 长按速度值 任意模式下调试都打开
|
||||
// if (DebugConfig.isDebug()) {
|
||||
mSpeedView!!.setOnLongClickListener {
|
||||
if (groupTestPanel!!.visibility == View.VISIBLE) {
|
||||
groupTestPanel!!.visibility = View.GONE
|
||||
module_mogo_och_speed_tv.setOnLongClickListener {
|
||||
if (groupTestPanel.visibility == View.VISIBLE) {
|
||||
groupTestPanel.visibility = View.GONE
|
||||
} else {
|
||||
groupTestPanel!!.visibility = View.VISIBLE
|
||||
groupTestPanel.visibility = View.VISIBLE
|
||||
}
|
||||
false
|
||||
}
|
||||
@@ -261,44 +235,43 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
|
||||
)
|
||||
}
|
||||
tvOperationStatus!!.setOnClickListener { onChangeOperationStatus() }
|
||||
mCloseNaviIcon!!.setOnClickListener {
|
||||
module_mogo_och_operation_status.setOnClickListener { onChangeOperationStatus() }
|
||||
taxi_close_navi_icon.setOnClickListener {
|
||||
showAmapNaviToStationFragment(false)
|
||||
showRottingToStationFragment(false)
|
||||
}
|
||||
driverMsgBoxButtonView!!.setClickListener(object : DriverMsgBoxButtonView.ClickListener {
|
||||
viewDriverMsgBoxButton.setClickListener(object : DriverMsgBoxButtonView.ClickListener {
|
||||
override fun showMsgBoxList(show: Boolean) {
|
||||
if (show) {
|
||||
viewDriverMsgBoxList!!.visibility = View.VISIBLE
|
||||
viewDriverMsgBoxList!!.notifyData()
|
||||
viewDriverMsgBoxBubble!!.visibility = View.GONE
|
||||
viewDriverMsgBoxBubble!!.isShowData(false)
|
||||
viewDriverMsgBoxList.visibility = View.VISIBLE
|
||||
viewDriverMsgBoxList.notifyData()
|
||||
viewDriverMsgBoxBubble.visibility = View.GONE
|
||||
viewDriverMsgBoxBubble.isShowData(false)
|
||||
} else {
|
||||
viewDriverMsgBoxList!!.visibility = View.GONE
|
||||
viewDriverMsgBoxBubble!!.visibility = View.VISIBLE
|
||||
viewDriverMsgBoxBubble!!.isShowData(true)
|
||||
viewDriverMsgBoxList.visibility = View.GONE
|
||||
viewDriverMsgBoxBubble.visibility = View.VISIBLE
|
||||
viewDriverMsgBoxBubble.isShowData(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
smallMapView = findViewById(R.id.smallMapView)
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView!!.onCreate(savedInstanceState)
|
||||
smallMapView!!.onCreateView(savedInstanceState)
|
||||
mapBizView.onCreate(savedInstanceState)
|
||||
smallMapView.onCreateView(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
mapBizView!!.onResume()
|
||||
smallMapView!!.onResume()
|
||||
mapBizView.onResume()
|
||||
smallMapView.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mapBizView!!.onPause()
|
||||
smallMapView!!.onPause()
|
||||
mapBizView.onPause()
|
||||
smallMapView.onPause()
|
||||
}
|
||||
|
||||
protected open fun onChangeOperationStatus() {}
|
||||
@@ -307,34 +280,34 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
val controller = getMapUIController()
|
||||
if (controller != null) {
|
||||
if (controller.currentMapVisualAngle.isLongSight) {
|
||||
mSwitchBtnIcon!!.setImageResource(R.drawable.taxi_switch_map_long)
|
||||
taxi_switch_icon.setImageResource(R.drawable.taxi_switch_map_long)
|
||||
} else if (controller.currentMapVisualAngle.isMediumSight) {
|
||||
mSwitchBtnIcon!!.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
taxi_switch_icon.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
} else {
|
||||
mSwitchBtnIcon!!.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
taxi_switch_icon.setImageResource(R.drawable.taxi_switch_map_medium)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
super.onLowMemory()
|
||||
mapBizView!!.onLowMemory()
|
||||
mapBizView.onLowMemory()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapBizView!!.onSaveInstanceState(outState)
|
||||
mapBizView.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
mapBizView!!.onDestroy()
|
||||
mapBizView.onDestroy()
|
||||
super.onDestroyView()
|
||||
CallerAutopilotRecordListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
smallMapView!!.onDestroy()
|
||||
smallMapView.onDestroy()
|
||||
}
|
||||
|
||||
private var mPrevAPStatus = -1
|
||||
@@ -376,49 +349,69 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
}
|
||||
|
||||
fun updateCtvAutopilotStatusTag(tag: Boolean) {
|
||||
ctvAutopilotStatusRL!!.tag = tag
|
||||
module_mogo_och_autopilot_status.tag = tag
|
||||
}
|
||||
|
||||
private var animatorDrawableUtil: AnimatorDrawableUtil? = null
|
||||
|
||||
private fun autopilotStatusAnimchanged(status: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
mAutopilotTv!!.text = "自动驾驶"
|
||||
mAutopilotTv!!.setTextColor(resources.getColor(R.color.taxi_autopilot_text_color_normal,null))
|
||||
mAutopilotImage!!.setImageResource(R.drawable.taxi_ic_autopilot)
|
||||
module_och_autopilot_tv.text = "自动驾驶"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot)
|
||||
if (animatorDrawableUtil == null) {
|
||||
animatorDrawableUtil = AnimatorDrawableUtil()
|
||||
}
|
||||
animatorDrawableUtil!!.setAnimation(
|
||||
mAnimFlowIv,
|
||||
anim_flow_iv,
|
||||
listOf(*startAutopilotDrawableIds)
|
||||
)
|
||||
animatorDrawableUtil!!.start(true, 100, null)
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status) {
|
||||
mAutopilotTv!!.text = "自动驾驶"
|
||||
mAutopilotTv!!.setTextColor(resources.getColor(R.color.taxi_autopilot_text_color_normal,null))
|
||||
mAutopilotImage!!.setImageResource(R.drawable.taxi_ic_autopilot)
|
||||
module_och_autopilot_tv.text = "自动驾驶"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot)
|
||||
if (animatorDrawableUtil != null) {
|
||||
animatorDrawableUtil!!.stop()
|
||||
mAnimFlowIv!!.setImageResource(0)
|
||||
anim_flow_iv.setImageResource(0)
|
||||
}
|
||||
animatorDrawableUtil = null
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING == status) {
|
||||
mAutopilotTv!!.text = "远程代驾"
|
||||
mAutopilotTv!!.setTextColor(resources.getColor(R.color.taxi_autopilot_text_color_normal,null))
|
||||
mAutopilotImage!!.setImageResource(R.drawable.taxi_ic_autopilot)
|
||||
module_och_autopilot_tv.text = "远程代驾"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot)
|
||||
if (animatorDrawableUtil == null) {
|
||||
animatorDrawableUtil = AnimatorDrawableUtil()
|
||||
}
|
||||
animatorDrawableUtil!!.setAnimation(mAnimFlowIv, listOf(*startManCODrawableIds))
|
||||
animatorDrawableUtil!!.setAnimation(anim_flow_iv, listOf(*startManCODrawableIds))
|
||||
animatorDrawableUtil!!.start(true, 100, null)
|
||||
} else {
|
||||
mAutopilotTv!!.text = "自动驾驶"
|
||||
mAutopilotTv!!.setTextColor(resources.getColor(R.color.taxi_autopilot_text_color_disable,null))
|
||||
mAutopilotImage!!.setImageResource(R.drawable.taxi_ic_autopilot_disable)
|
||||
module_och_autopilot_tv.text = "自动驾驶"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_disable,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_disable)
|
||||
if (animatorDrawableUtil != null) {
|
||||
animatorDrawableUtil!!.stop()
|
||||
mAnimFlowIv!!.setImageResource(0)
|
||||
anim_flow_iv.setImageResource(0)
|
||||
}
|
||||
|
||||
animatorDrawableUtil = null
|
||||
@@ -428,17 +421,27 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
private fun startAutopilotDone(success: Boolean) {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
mAutopilotImage!!.clearAnimation()
|
||||
module_och_autopilot_iv.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
}
|
||||
if (success) {
|
||||
mAutopilotTv!!.text = "成功"
|
||||
mAutopilotTv!!.setTextColor(resources.getColor(R.color.taxi_autopilot_text_color_normal,null))
|
||||
mAutopilotImage!!.setImageResource(R.drawable.taxi_ic_autopilot_success)
|
||||
module_och_autopilot_tv.text = "成功"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_success)
|
||||
} else {
|
||||
mAutopilotTv!!.text = "失败"
|
||||
mAutopilotTv!!.setTextColor(resources.getColor(R.color.taxi_autopilot_text_color_normal,null))
|
||||
mAutopilotImage!!.setImageResource(R.drawable.taxi_ic_autopilot_failed)
|
||||
module_och_autopilot_tv.text = "失败"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_failed)
|
||||
}
|
||||
mHandler.postDelayed({
|
||||
startOrStopLoadingAnim(false)
|
||||
@@ -453,12 +456,17 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
fun startOrStopLoadingAnim(start: Boolean) {
|
||||
if (start) {
|
||||
isStarting = true
|
||||
mAutopilotTv!!.text = "启动中"
|
||||
mAutopilotTv!!.setTextColor(resources.getColor(R.color.taxi_autopilot_text_color_normal,null))
|
||||
mAutopilotImage!!.setImageResource(R.drawable.taxi_ic_autopilot_loading)
|
||||
module_och_autopilot_tv.text = "启动中"
|
||||
module_och_autopilot_tv.setTextColor(
|
||||
resources.getColor(
|
||||
R.color.taxi_autopilot_text_color_normal,
|
||||
null
|
||||
)
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_loading)
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator = ObjectAnimator.ofFloat(
|
||||
mAutopilotImage,
|
||||
module_och_autopilot_iv,
|
||||
"rotation", 0f, 360f
|
||||
)
|
||||
}
|
||||
@@ -472,7 +480,7 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
isStarting = false
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
mAutopilotImage!!.clearAnimation()
|
||||
module_och_autopilot_iv.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
}
|
||||
}
|
||||
@@ -495,12 +503,12 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
}
|
||||
|
||||
fun hidPanel() {
|
||||
activity?.runOnUiThread { flStationPanelContainer!!.visibility = View.GONE }
|
||||
activity?.runOnUiThread { module_mogo_och_station_panel_container.visibility = View.GONE }
|
||||
}
|
||||
|
||||
fun showPanel() {
|
||||
activity?.runOnUiThread {
|
||||
flStationPanelContainer!!.visibility = View.VISIBLE
|
||||
module_mogo_och_station_panel_container.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,16 +531,16 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
|
||||
fun changeOperationViewVisible(visible: Int) {
|
||||
activity?.runOnUiThread(Runnable runOnUiThread@{
|
||||
if (tvOperationStatus == null) {
|
||||
if (module_mogo_och_operation_status == null) {
|
||||
return@runOnUiThread
|
||||
}
|
||||
tvOperationStatus!!.visibility = visible
|
||||
module_mogo_och_operation_status.visibility = visible
|
||||
})
|
||||
}
|
||||
|
||||
fun updateSpeedView(newSpeed: Float) {
|
||||
val speed = (Math.abs(newSpeed) * 3.6f).toInt() // 倒车时工控机反馈定位信息中speed为负值
|
||||
mSpeedView!!.text = speed.toString()
|
||||
val speed = (abs(newSpeed) * 3.6f).toInt() // 倒车时工控机反馈定位信息中speed为负值
|
||||
module_mogo_och_speed_tv.text = speed.toString()
|
||||
}
|
||||
|
||||
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode?) {
|
||||
@@ -553,13 +561,13 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochAmapNaviFragment!!)
|
||||
.show(ochAmapNaviFragment!!)
|
||||
transaction.commitAllowingStateLoss()
|
||||
mCloseNaviIcon!!.visibility = View.VISIBLE
|
||||
flNaviPanelContainer!!.visibility = View.VISIBLE
|
||||
smallMapView!!.visibility = View.GONE
|
||||
taxi_close_navi_icon.visibility = View.VISIBLE
|
||||
module_mogo_och_navi_panel_container.visibility = View.VISIBLE
|
||||
smallMapView.visibility = View.GONE
|
||||
} else {
|
||||
mCloseNaviIcon!!.visibility = View.GONE
|
||||
flNaviPanelContainer!!.visibility = View.GONE
|
||||
smallMapView!!.visibility = View.VISIBLE
|
||||
taxi_close_navi_icon.visibility = View.GONE
|
||||
module_mogo_och_navi_panel_container.visibility = View.GONE
|
||||
smallMapView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,17 +604,16 @@ abstract class BaseTaxiTabFragment<V: IView, P: Presenter<V>> : MvpFragment<V, P
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, taxiRottingNaviFragment!!)
|
||||
.show(taxiRottingNaviFragment!!)
|
||||
transaction.commitAllowingStateLoss()
|
||||
mCloseNaviIcon!!.visibility = View.VISIBLE
|
||||
flNaviPanelContainer!!.visibility = View.VISIBLE
|
||||
smallMapView!!.visibility = View.GONE
|
||||
taxi_close_navi_icon.visibility = View.VISIBLE
|
||||
module_mogo_och_navi_panel_container.visibility = View.VISIBLE
|
||||
smallMapView.visibility = View.GONE
|
||||
} else {
|
||||
closeRouteViewIFHadeAdd()
|
||||
mCloseNaviIcon!!.visibility = View.GONE
|
||||
flNaviPanelContainer!!.visibility = View.GONE
|
||||
smallMapView!!.visibility = View.VISIBLE
|
||||
taxi_close_navi_icon.visibility = View.GONE
|
||||
module_mogo_och_navi_panel_container.visibility = View.GONE
|
||||
smallMapView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
abstract fun startNaviToEndStation(isShow: Boolean)
|
||||
}
|
||||
@@ -59,7 +59,7 @@ data class QueryCurrentTaskRespBean(var data: Result?)
|
||||
:BaseData(){
|
||||
data class Result(var sn: String, var lineId: Int, var servingStatus: Int,
|
||||
var currentStatus: Int, var taskType: Int,
|
||||
var startSite: Site, var endSite: Site,
|
||||
var startSite: Site?, var endSite: Site?,
|
||||
var order: OrderDetail?){
|
||||
// servingStatus = 0 //暂停接单 = 1 //开始接单
|
||||
//taskType = 1 //虚拟任务 = 2 //接驾任务 = 3 //送驾任务
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
/**
|
||||
package com.mogo.och.taxi.constant/**
|
||||
* Created on 2023/8/7
|
||||
* taskType = 1 虚拟任务, = 2 接驾任务(演练), = 3 //送驾任务(运营)
|
||||
* taskType = 1 虚拟任务(演练), = 2 接驾任务(运营), = 3 //送驾任务(运营)
|
||||
*/
|
||||
enum class TaskTypeEnum(val code: Int) {
|
||||
None(0),
|
||||
VirtualTask( 1),
|
||||
ExerciseTask( 2),
|
||||
OrderTask( 3);
|
||||
ToOrderStartTask( 2),
|
||||
ToOrderEndTask( 3);
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.taxi.model
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.text.TextUtils
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.elegant.network.utils.GsonUtil
|
||||
@@ -15,8 +14,6 @@ import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
@@ -27,7 +24,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.cancelAutoPilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIPCDemoMode
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
|
||||
@@ -63,21 +59,18 @@ import com.mogo.och.common.module.manager.distancemamager.ITrajectoryListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.addDistanceListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.addTrajectoryListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.setStationPoint
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjLocations
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
import com.mogo.och.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.Site
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiADASStatusCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiCarOperationalCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiOrderStatusCallback
|
||||
import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum.Companion.valueOf
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
@@ -85,9 +78,7 @@ import com.mogo.och.taxi.constant.TaxtServingStatusManager.isOpeningOrderStatus
|
||||
import com.mogo.och.taxi.network.CarServiceManager.arriveSite
|
||||
import com.mogo.och.taxi.network.CarServiceManager.endService
|
||||
import com.mogo.och.taxi.network.CarServiceManager.prepareTask
|
||||
import com.mogo.och.taxi.network.CarServiceManager.queryCurrentTask
|
||||
import com.mogo.och.taxi.network.CarServiceManager.startService
|
||||
import com.mogo.och.taxi.network.CarServiceManager.startTask
|
||||
import com.mogo.och.taxi.utils.TaxiAnalyticsManager
|
||||
import com.mogo.och.taxi.utils.TaxiTrajectoryManager
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
@@ -205,7 +196,7 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
fun release() {
|
||||
startOrStopOrderLoop(false)
|
||||
// startOrStopOrderLoop(false)
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
releaseListeners()
|
||||
loginService = null
|
||||
@@ -274,44 +265,6 @@ object TaxiModel {
|
||||
stopLoopAbnormalFactors()
|
||||
}
|
||||
|
||||
fun startOrStopOrderLoop(start: Boolean) {
|
||||
d(SceneConstant.M_TAXI + TAG, "startOrStopOrderLoop() $start")
|
||||
if (start) {
|
||||
TaxiModelLoopManager.getInstance().startInAndWaitCurrentTaskLoop()
|
||||
} else {
|
||||
TaxiModelLoopManager.getInstance().stopInAndWaitCurrentTaskLoop()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前任务订单
|
||||
*/
|
||||
fun queryCurrentTaskOnce(){
|
||||
queryCurrentTask(mContext!!, object : OchCommonServiceCallback<QueryCurrentTaskRespBean>{
|
||||
override fun onSuccess(data: QueryCurrentTaskRespBean?) {
|
||||
if (data === null) return
|
||||
if (data.data === null) return
|
||||
if (data.code != 0) return
|
||||
|
||||
val result = data.data
|
||||
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!! === result) return
|
||||
|
||||
mCurrentTaskAndOrder = result
|
||||
|
||||
// TODO: 去更新当前任务和订单
|
||||
TaxiUnmannedViewModel.updateCurrentTaskAndOrder(mCurrentTaskAndOrder)
|
||||
|
||||
updateNativeCurrentOrder(result)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(TAG,"queryCurrentTaskOnce = $code, $msg")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
//更新接单状态
|
||||
fun updateCarStatus() {
|
||||
if (!isLogin()) {
|
||||
@@ -370,6 +323,7 @@ object TaxiModel {
|
||||
|
||||
private fun updateVirtualTask(result: StartServiceRespBean.Result?) {
|
||||
mVirtualTask = result
|
||||
if (result == null) return
|
||||
}
|
||||
|
||||
private fun startVirtualTask() {
|
||||
@@ -384,7 +338,7 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
//更新本地currentOrder信息,并保存订单到本地避免车机重启丢失数据
|
||||
private fun updateNativeCurrentOrder(data: QueryCurrentTaskRespBean.Result?) {
|
||||
public fun updateNativeCurrentOrder(data: QueryCurrentTaskRespBean.Result?) {
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
@@ -397,17 +351,25 @@ object TaxiModel {
|
||||
|
||||
val currentOrder = mCurrentTaskAndOrder!!.order
|
||||
|
||||
if (currentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
setIgnoreConditionDraw(true)
|
||||
setIPCDemoMode(true)
|
||||
d(SceneConstant.M_TAXI + TAG, "美化模式-ignore:置为true(更新本地order信息)")
|
||||
if (currentOrder != null){
|
||||
if (currentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
setIgnoreConditionDraw(true)
|
||||
setIPCDemoMode(true)
|
||||
d(SceneConstant.M_TAXI + TAG, "美化模式-ignore:置为true(更新本地order信息)")
|
||||
}
|
||||
updateAutopilotControlParameters()
|
||||
}
|
||||
updateAutopilotControlParameters()
|
||||
}
|
||||
if (currentOrder!!.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code) {
|
||||
if (currentOrder!!.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
d(SceneConstant.M_TAXI + TAG, "setIPCDemoMode:false")
|
||||
setIPCDemoMode(false)
|
||||
}
|
||||
clearAutopilotControlParameters()
|
||||
}
|
||||
}else{
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
d(SceneConstant.M_TAXI + TAG, "setIPCDemoMode:false")
|
||||
setIPCDemoMode(false)
|
||||
@@ -434,6 +396,10 @@ object TaxiModel {
|
||||
updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
public fun updateCurrentTaskAndOrder(result: QueryCurrentTaskRespBean.Result?){
|
||||
mCurrentTaskAndOrder = result
|
||||
}
|
||||
|
||||
//清除任务订单信息
|
||||
fun clearCurrentOCHOrder() {
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
@@ -452,10 +418,14 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
//检测当前订单
|
||||
fun checkCurrentTask(): Boolean {
|
||||
return mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.endSite != null
|
||||
&& mCurrentTaskAndOrder!!.taskType != TaskTypeEnum.VirtualTask.code
|
||||
}
|
||||
|
||||
fun checkCurrentOrder(): Boolean {
|
||||
// return mCurrentOrder != null && mCurrentOrder!!.orderStartSite != null
|
||||
// && mCurrentOrder!!.orderStartSite != null
|
||||
return false
|
||||
return mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.order != null
|
||||
&& mCurrentTaskAndOrder!!.taskType == TaskTypeEnum.ToOrderEndTask.code
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -468,7 +438,7 @@ object TaxiModel {
|
||||
paramIndexes = [-1]
|
||||
)
|
||||
fun startAutoPilot() {
|
||||
if (!checkCurrentOrder()) {
|
||||
if (!checkCurrentTask()) {
|
||||
e(SceneConstant.M_TAXI + TAG, "no order or order is empty.")
|
||||
ToastUtils.showShort("当前订单不存在或异常!")
|
||||
return
|
||||
@@ -539,7 +509,7 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(): AutopilotControlParameters? {
|
||||
if (!checkCurrentOrder()) {
|
||||
if (!checkCurrentTask()) {
|
||||
e(SceneConstant.M_TAXI + TAG, "no order or order is empty.")
|
||||
return null
|
||||
}
|
||||
@@ -584,22 +554,19 @@ object TaxiModel {
|
||||
|
||||
//根据围栏判断,是否到达起点
|
||||
private fun judgeStartStation(location: MogoLocation) {
|
||||
// TODO: 重新去构造
|
||||
// if ((mCurrentTaskAndOrder == null) || (mCurrentTaskAndOrder!!.startSiteGcjPoint == null
|
||||
// ) || (mCurrentTaskAndOrder!!.startSiteGcjPoint.size < 2)
|
||||
// ) {
|
||||
// return
|
||||
// }
|
||||
// val startLon = mCurrentTaskAndOrder!!.startSiteGcjPoint[0]
|
||||
// val startLat = mCurrentTaskAndOrder!!.startSiteGcjPoint[1]
|
||||
// val distance = CoordinateUtils.calculateLineDistance(
|
||||
// startLon, startLat,
|
||||
// location.longitude, location.latitude
|
||||
// ).toDouble()
|
||||
// i(SceneConstant.M_TAXI + TAG, "judgeStartStation() distance = $distance")
|
||||
// if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
// // TODO: 调用到达上车点 arrivedStartPoint()
|
||||
// }
|
||||
if (checkCurrentOrder()) {
|
||||
val startSite = mCurrentTaskAndOrder!!.order!!.orderStartSite ?: return
|
||||
val startLon = startSite.gcjLon
|
||||
val startLat = startSite.gcjLat
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
startLon, startLat,
|
||||
location.longitude, location.latitude
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeStartStation() distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
arriveSite(startSite.siteId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
@@ -608,7 +575,7 @@ object TaxiModel {
|
||||
d(SceneConstant.M_TAXI + TAG, "onIntentReceived = %s", intentStr)
|
||||
if ((ConnectivityManager.CONNECTIVITY_ACTION == intentStr)) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
startOrStopOrderLoop(isLogin() && isOpeningOrderStatus())
|
||||
// startOrStopOrderLoop(isLogin() && isOpeningOrderStatus())
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
}
|
||||
}
|
||||
@@ -664,6 +631,7 @@ object TaxiModel {
|
||||
judgeEndStation(mogoLocation)
|
||||
}
|
||||
}
|
||||
|
||||
mLongitude = mogoLocation.longitude
|
||||
mLatitude = mogoLocation.latitude
|
||||
mLocation = mogoLocation
|
||||
@@ -681,11 +649,11 @@ object TaxiModel {
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() ${virtualTask.siteName} distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { // 15米内到站
|
||||
arriveVirtualSite(virtualTask.siteId)
|
||||
arriveSite(virtualTask.siteId)
|
||||
}
|
||||
}
|
||||
|
||||
private fun arriveVirtualSite(siteId: Int) {
|
||||
private fun arriveSite(siteId: Int) {
|
||||
arriveSite(mContext!!,siteId,object : OchCommonServiceCallback<BaseData>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (data == null || data.code != 0) return
|
||||
@@ -714,51 +682,50 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
private fun judgeEndStation(currentLocation: MogoLocation) {
|
||||
// TODO: 重新去构造
|
||||
// if ((mCurrentTaskAndOrder == null) || (mCurrentTaskAndOrder!!.endSiteGcjPoint == null
|
||||
// ) || (mCurrentTaskAndOrder!!.endSiteGcjPoint.size < 2)
|
||||
// ) {
|
||||
// return
|
||||
// }
|
||||
// val endLon = mCurrentTaskAndOrder!!.endSiteGcjPoint[0]
|
||||
// val endLat = mCurrentTaskAndOrder!!.endSiteGcjPoint[1]
|
||||
// val distance = CoordinateUtils.calculateLineDistance(
|
||||
// endLon, endLat,
|
||||
// currentLocation.longitude, currentLocation.latitude
|
||||
// ).toDouble()
|
||||
// i(SceneConstant.M_TAXI + TAG, "judgeEndStation() distance = $distance")
|
||||
// if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { //1、当前位置和站点围栏15m内
|
||||
// if ((!checkCurrentOrder()
|
||||
// || (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
// ) {
|
||||
// i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// //2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过
|
||||
// val stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
// currentLocation.longitude,
|
||||
// currentLocation.latitude,
|
||||
// endLon,
|
||||
// endLat, currentLocation.heading.toInt()
|
||||
// ).toDouble()
|
||||
// i(
|
||||
// SceneConstant.M_TAXI + TAG,
|
||||
// "judgeEndStation() stationAngle = $stationAngle"
|
||||
// )
|
||||
//
|
||||
// //3、刚过站且过站距离在15m内, 提交到站
|
||||
// if (stationAngle > 90 && distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
// if ((!checkCurrentOrder()
|
||||
// || (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
// ) {
|
||||
// i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
// return
|
||||
// }
|
||||
// i(SceneConstant.M_TAXI + TAG, "judgeEndStation() = 刚过站且在15m内")
|
||||
// // TODO: 调用到达目的地 arriveTerminal()
|
||||
// }
|
||||
// }
|
||||
if (!checkCurrentOrder()) {
|
||||
return
|
||||
}
|
||||
val endSite = mCurrentTaskAndOrder!!.order!!.orderEndSite ?: return
|
||||
|
||||
val endLon = endSite.gcjLon
|
||||
val endLat = endSite.gcjLat
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
endLon, endLat,
|
||||
currentLocation.longitude, currentLocation.latitude
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { //1、当前位置和站点围栏15m内
|
||||
if ((!checkCurrentOrder()
|
||||
|| (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) {
|
||||
i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
return
|
||||
}
|
||||
|
||||
//2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过
|
||||
val stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.longitude,
|
||||
currentLocation.latitude,
|
||||
endLon,
|
||||
endLat, currentLocation.heading.toInt()
|
||||
).toDouble()
|
||||
i(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"judgeEndStation() stationAngle = $stationAngle"
|
||||
)
|
||||
|
||||
//3、刚过站且过站距离在15m内, 提交到站
|
||||
if (stationAngle > 90 && distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
if ((!checkCurrentOrder()
|
||||
|| (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) {
|
||||
i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
return
|
||||
}
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() = 刚过站且在15m内")
|
||||
arriveSite(endSite.siteId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -775,13 +742,11 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
fun setArriveAtEndStation() {
|
||||
// if ((mCurrentOrder == null
|
||||
// || mCurrentOrder!!.orderStatus != TaxiOrderStatusEnum.OnTheWayToEnd.code)
|
||||
// ) {
|
||||
// ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
// return
|
||||
// }
|
||||
// TODO: 调用到达目的地 arriveTerminal()
|
||||
if (checkCurrentOrder()) {
|
||||
ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
return
|
||||
}
|
||||
// TODO: arriveSite()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -835,7 +800,7 @@ object TaxiModel {
|
||||
// }
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if ((FunctionBuildConfig.isDemoMode
|
||||
&& checkCurrentOrder()
|
||||
&& checkCurrentTask()
|
||||
&& ((getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToEnd
|
||||
|| getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd)))
|
||||
) {
|
||||
@@ -847,7 +812,7 @@ object TaxiModel {
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if ((FunctionBuildConfig.isDemoMode
|
||||
&& checkCurrentOrder()
|
||||
&& checkCurrentTask()
|
||||
&& ((getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToEnd
|
||||
|| getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd)))
|
||||
) {
|
||||
@@ -859,7 +824,7 @@ object TaxiModel {
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
if ((checkCurrentOrder()
|
||||
if ((checkCurrentTask()
|
||||
&& (getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToEnd
|
||||
|| getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) { //订单中
|
||||
@@ -880,12 +845,12 @@ object TaxiModel {
|
||||
override fun onAutopilotSNRequest() {}
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivalNotification?) {
|
||||
i(SceneConstant.M_TAXI + TAG, "onAutopilotArriveAtStation = " + arrivalNotification.toString())
|
||||
if (((arrivalNotification == null) || !checkCurrentOrder()
|
||||
if (((arrivalNotification == null) || !checkCurrentTask()
|
||||
|| (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) {
|
||||
return
|
||||
}
|
||||
// TODO: 到站调用 arriveTerminal()
|
||||
arriveTerminal()
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 到达目的地,置false
|
||||
// 2022.10.08 到达目的地时候取消自动起自驾, 服务完成取消引导线和自动驾驶按钮状态
|
||||
@@ -899,6 +864,14 @@ object TaxiModel {
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
|
||||
}
|
||||
|
||||
private fun arriveTerminal() {
|
||||
if (!checkCurrentOrder()) return
|
||||
val endSite = mCurrentTaskAndOrder!!.order!!.orderEndSite
|
||||
if (endSite != null){
|
||||
arriveSite(endSite.siteId)
|
||||
}
|
||||
}
|
||||
|
||||
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
|
||||
object : IMoGoPlanningRottingListener {
|
||||
override fun onAutopilotRotting(globalPathResp: GlobalPathResp?) {
|
||||
|
||||
@@ -33,35 +33,8 @@ public class TaxiModelLoopManager {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Disposable mInAndWaitServiceDisposable; //进行中、待服务订单列表轮询
|
||||
private Disposable mNewBookingOrderDisposable; //新到待抢预约单轮询
|
||||
private Disposable mGrabResultDisposable; //抢单结果轮询
|
||||
private Disposable mHeartbeatDisposable; //心跳轮询
|
||||
private CompositeDisposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
|
||||
|
||||
public void startInAndWaitCurrentTaskLoop() {
|
||||
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startInAndWaitOrdersLoop()");
|
||||
mInAndWaitServiceDisposable = Observable.interval(TaxiUnmannedConst.LOOP_DELAY,
|
||||
TaxiUnmannedConst.LOOP_PERIOD_2S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {
|
||||
TaxiModel.INSTANCE.queryCurrentTaskOnce();
|
||||
});
|
||||
}
|
||||
|
||||
public void stopInAndWaitCurrentTaskLoop() {
|
||||
if (mInAndWaitServiceDisposable != null) {
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "stopInAndWaitOrdersLoop()");
|
||||
mInAndWaitServiceDisposable.dispose();
|
||||
mInAndWaitServiceDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void startCalculateRouteInfoLoop() {
|
||||
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startCalculateRouteInfoLoop()");
|
||||
|
||||
@@ -2,25 +2,40 @@ package com.mogo.och.taxi.model
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.taxi.base.BaseViewModel
|
||||
import com.mogo.och.taxi.base.IUiIntent
|
||||
import com.mogo.och.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager.isOpeningOrderStatus
|
||||
import com.mogo.och.taxi.network.CarServiceManager
|
||||
import com.mogo.och.taxi.ui.unmanned.OrderUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskAndOrderUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedIntent
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedState
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/26
|
||||
*/
|
||||
object TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
|
||||
private var mInAndWaitServiceDisposable: Disposable? = null //进行中、待服务订单列表轮询
|
||||
private var mCurrentTaskAndOrder: QueryCurrentTaskRespBean.Result? = null
|
||||
private val TAG = "TaxiUnmannedViewModel"
|
||||
|
||||
init {
|
||||
startOrStopOrderLoop(true)
|
||||
}
|
||||
|
||||
override fun initUiState(): UnmannedState {
|
||||
return UnmannedState(TaskAndOrderUiState.INIT)
|
||||
@@ -62,7 +77,7 @@ object TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
private fun getNextTask() {
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.endSite != null){
|
||||
CarServiceManager.prepareTask(AbsMogoApplication.getApp().applicationContext,
|
||||
mCurrentTaskAndOrder!!.endSite.siteId, object : OchCommonServiceCallback<PrepareTaskRespBean>{
|
||||
mCurrentTaskAndOrder!!.endSite!!.siteId, object : OchCommonServiceCallback<PrepareTaskRespBean>{
|
||||
override fun onSuccess(data: PrepareTaskRespBean?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
@@ -78,7 +93,7 @@ object TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
private fun arrivedSite() {
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.endSite != null){
|
||||
CarServiceManager.arriveSite(AbsMogoApplication.getApp().applicationContext,
|
||||
mCurrentTaskAndOrder!!.endSite.siteId,
|
||||
mCurrentTaskAndOrder!!.endSite!!.siteId,
|
||||
object : OchCommonServiceCallback<BaseData>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
TODO("Not yet implemented")
|
||||
@@ -138,11 +153,6 @@ object TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
}
|
||||
}
|
||||
|
||||
fun updateCurrentTaskAndOrder(currentTaskAndOrder: QueryCurrentTaskRespBean.Result?){
|
||||
mCurrentTaskAndOrder = currentTaskAndOrder
|
||||
updateTaskAndOrderUi()
|
||||
}
|
||||
|
||||
private fun updateTaskAndOrderUi() {
|
||||
sendUiState {
|
||||
copy(
|
||||
@@ -150,4 +160,93 @@ object TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNoTaskAndOrderUi() {
|
||||
sendUiState {
|
||||
copy(
|
||||
taskAndOrderUiState = TaskAndOrderUiState.SUCCESS(null)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun startOrStopOrderLoop(start: Boolean) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI + TAG, "startOrStopOrderLoop() $start")
|
||||
if (start) {
|
||||
startInAndWaitCurrentTaskLoop()
|
||||
} else {
|
||||
stopInAndWaitCurrentTaskLoop()
|
||||
}
|
||||
}
|
||||
|
||||
private fun queryCurrentTaskOnce(){
|
||||
CarServiceManager.queryCurrentTask(AbsMogoApplication.getApp().applicationContext,
|
||||
object : OchCommonServiceCallback<QueryCurrentTaskRespBean> {
|
||||
override fun onSuccess(data: QueryCurrentTaskRespBean?) {
|
||||
if (data === null) return
|
||||
if (data.data === null) return
|
||||
if (data.code != 0) return
|
||||
|
||||
val result = data.data
|
||||
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.equals(result)) return
|
||||
|
||||
if (result!!.endSite == null && result.order == null){
|
||||
updateNoTaskAndOrderUi()
|
||||
}
|
||||
|
||||
if ((mCurrentTaskAndOrder !== null && mCurrentTaskAndOrder!!.order !== null
|
||||
&& result!!.order === null)
|
||||
|| (mCurrentTaskAndOrder !== null && mCurrentTaskAndOrder!!.order !== null
|
||||
&& result!!.order !== null && mCurrentTaskAndOrder!!.order!!.orderNo !=
|
||||
result!!.order!!.orderNo)
|
||||
) {
|
||||
//本地根据订单 orderNo 去查询下(乘客取消订单)
|
||||
queryCurrentOrderStatusById(mCurrentTaskAndOrder!!.order!!.orderNo)
|
||||
return
|
||||
}
|
||||
|
||||
mCurrentTaskAndOrder = result
|
||||
|
||||
TaxiModel.updateCurrentTaskAndOrder(result)
|
||||
|
||||
TaxiModel.updateNativeCurrentOrder(result)
|
||||
|
||||
updateTaskAndOrderUi()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
CallerLogger.d(TAG, "queryCurrentTaskOnce = $code, $msg")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
private fun queryCurrentOrderStatusById(orderNo: String) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
|
||||
private fun startInAndWaitCurrentTaskLoop() {
|
||||
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable!!.isDisposed) {
|
||||
return
|
||||
}
|
||||
i(SceneConstant.M_TAXI + TAG, "startInAndWaitOrdersLoop()")
|
||||
mInAndWaitServiceDisposable = Observable.interval(
|
||||
TaxiUnmannedConst.LOOP_DELAY,
|
||||
TaxiUnmannedConst.LOOP_PERIOD_2S, TimeUnit.MILLISECONDS
|
||||
)
|
||||
.map<Long> { aLong: Long -> aLong + 1 }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { queryCurrentTaskOnce() }
|
||||
}
|
||||
|
||||
private fun stopInAndWaitCurrentTaskLoop() {
|
||||
if (mInAndWaitServiceDisposable != null) {
|
||||
i(SceneConstant.M_TAXI + TAG, "stopInAndWaitOrdersLoop()")
|
||||
mInAndWaitServiceDisposable!!.dispose()
|
||||
mInAndWaitServiceDisposable = null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,13 +4,10 @@ import android.os.Looper;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.callback.ITaxiCarOperationalCallback;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiPersonalDialogFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
@@ -45,11 +42,6 @@ public class TaxiOperationalPresenter extends Presenter<TaxiPersonalDialogFragme
|
||||
runOnUIThread(() -> mView.onServiceDataUpdate(dailyTimeDuration,dailyOrderNum));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdersListPageRefresh(List<OrderQueryRespBean.Result> ordersList) {
|
||||
runOnUIThread(() -> mView.onOrdersListPageRefresh(ordersList));
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
|
||||
@@ -196,7 +196,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
//设置 接单状态
|
||||
TaxtServingStatusManager.setOpenOrderStatus(data.data.servingStatus);
|
||||
//设置 是否启动订单轮训
|
||||
TaxiModel.INSTANCE.startOrStopOrderLoop(LoginStatusManager.isLogin()&&TaxtServingStatusManager.isOpeningOrderStatus());
|
||||
// TaxiModel.INSTANCE.startOrStopOrderLoop();
|
||||
|
||||
// 设置当前用户角色
|
||||
String role = "";
|
||||
|
||||
@@ -9,7 +9,7 @@ import android.os.Bundle
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.amap.api.navi.model.NaviLatLng
|
||||
import com.elegant.utils.DateTimeUtils
|
||||
@@ -22,7 +22,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getOverla
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.overlay.core.Level
|
||||
import com.mogo.map.overlay.point.Point
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
@@ -70,7 +69,8 @@ import kotlin.math.roundToInt
|
||||
class TaxiBeingTaskFragment : BaseFragment(),
|
||||
View.OnClickListener, ICommonNaviChangedCallback {
|
||||
|
||||
private val mViewModel by viewModels<TaxiUnmannedViewModel>()
|
||||
// private val mViewModel by viewModels<TaxiUnmannedViewModel>()
|
||||
private lateinit var mViewModel : TaxiUnmannedViewModel
|
||||
|
||||
@Volatile
|
||||
private var mTtsLessThan200Tip = 0 //离终点200米提示播报
|
||||
@@ -86,7 +86,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
d("viewmodel ==", "TaxiBeingTaskFragment onCreate")
|
||||
mViewModel = ViewModelProvider(this, ViewModelProvider.NewInstanceFactory()).get(TaxiUnmannedViewModel::class.java)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
@@ -111,6 +112,11 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
}
|
||||
|
||||
is TaskAndOrderUiState.SUCCESS -> {
|
||||
if (state.model == null){
|
||||
isHaveBeingOrder(true)
|
||||
return@collect
|
||||
}
|
||||
isHaveBeingOrder(true)
|
||||
updateCurrentOrderStatusChanged(state.model)
|
||||
}
|
||||
}
|
||||
@@ -134,6 +140,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
@SuppressLint("SetTextI18n", "UseCompatLoadingForDrawables")
|
||||
fun updateCurrentOrderStatusChanged(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
||||
if (taskAndOrder == null) return
|
||||
if (taskAndOrder.endSite == null && taskAndOrder.order == null) return
|
||||
/**
|
||||
* 根据任务类型判断任务显示,
|
||||
* 虚拟单, 显示在进行中 前往上车点
|
||||
@@ -149,13 +156,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
updateUIShowStatus(taskType,currentStatus,order)
|
||||
|
||||
when (taskType) {
|
||||
TaskTypeEnum.VirtualTask.code -> { //虚拟单
|
||||
taskStatus.text = resources.getString(R.string.task_start_to_virtual_site)
|
||||
startStationName.text = resources.getString(R.string.task_current_loc)
|
||||
endStationName.text = endSite.siteName
|
||||
TODO("剩余历程和时间导航去更新taskOtherInfo")
|
||||
}
|
||||
TaskTypeEnum.ExerciseTask.code -> {// 演练单
|
||||
TaskTypeEnum.VirtualTask.code -> {// 送驾驶任务
|
||||
if (startSite == null || endSite == null) return
|
||||
taskStatus.text = resources.getString(R.string.task_start_end_site)
|
||||
taskTypeTv.background = resources.getDrawable(R.drawable.task_unreal_type_btn_bg,null)
|
||||
taskTypeTv.text = resources.getString(R.string.task_exercise)
|
||||
@@ -163,7 +165,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
endStationName.text = endSite.siteName
|
||||
TODO("剩余历程和时间导航去更新taskOtherInfo")
|
||||
}
|
||||
TaskTypeEnum.OrderTask.code -> {// 运营单
|
||||
TaskTypeEnum.ToOrderEndTask.code,TaskTypeEnum.ToOrderStartTask.code -> {// 送驾/接驾任务任务
|
||||
if (order == null) return
|
||||
taskTypeTv.text = resources.getString(R.string.task_order)
|
||||
taskTypeTv.background = resources.getDrawable(R.drawable.task_order_type_btn_bg,null)
|
||||
@@ -377,7 +379,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
private fun updateUIShowStatus(taskType: Int, currentStatus: Int, order: OrderDetail?) {
|
||||
if (order == null) return
|
||||
when (taskType) {
|
||||
TaskTypeEnum.VirtualTask.code,TaskTypeEnum.ExerciseTask.code -> { //虚拟单、演练单
|
||||
TaskTypeEnum.VirtualTask.code,TaskTypeEnum.ToOrderStartTask.code -> { //虚拟单、演练单
|
||||
taskStatus.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.GONE
|
||||
@@ -389,7 +391,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
naviToEnd.visibility = if (currentStatus == 2) View.VISIBLE else View.GONE
|
||||
taskOtherInfo.visibility = if (currentStatus == 0) View.GONE else View.VISIBLE
|
||||
}
|
||||
TaskTypeEnum.OrderTask.code -> {// 运营单
|
||||
TaskTypeEnum.ToOrderEndTask.code -> {// 运营单
|
||||
taskStatus.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.VISIBLE
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
@@ -20,12 +21,13 @@ import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.LoginService
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.base.BaseTaxiTabFragment
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.model.TaxiModel
|
||||
import com.mogo.och.taxi.network.LoginBusImpl
|
||||
import com.mogo.och.taxi.presenter.TaxiPresenter
|
||||
import com.mogo.och.taxi.utils.TPRouteDataTestUtils
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_operation_status
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.taxi_driver_role_tv
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -35,17 +37,18 @@ import java.lang.ref.WeakReference
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/
|
||||
public class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
ITaxiView {
|
||||
private var serverOrdersFragmentWR: WeakReference<TaxiServerOrdersFragment>? = null
|
||||
private var personalDialogFragment: WeakReference<TaxiPersonalDialogFragment>? = null
|
||||
private var loginService: LoginService? = null
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
loginService =
|
||||
ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation() as LoginService
|
||||
if (loginService != null) {
|
||||
loginService!!.registerFragment(this, getPresenter(), LoginBusImpl())
|
||||
loginService!!.registerFragment(this, presenter, LoginBusImpl())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +89,7 @@ public class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
initFragment()
|
||||
hidPanel()
|
||||
switchVRFlatMode(MogoStatusManager.getInstance().isVrMode)
|
||||
tvOperationStatus?.visibility = View.VISIBLE
|
||||
module_mogo_och_operation_status.visibility = View.VISIBLE
|
||||
initOrderTestBar()
|
||||
}
|
||||
|
||||
@@ -136,13 +139,13 @@ public class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
)
|
||||
if (inOperation) {
|
||||
if (!TextUtils.isEmpty(role)) {
|
||||
mDriverRole?.visibility = View.VISIBLE
|
||||
mDriverRole?.text = role
|
||||
taxi_driver_role_tv.visibility = View.VISIBLE
|
||||
taxi_driver_role_tv.text = role
|
||||
} else {
|
||||
mDriverRole?.visibility = View.GONE
|
||||
taxi_driver_role_tv.visibility = View.GONE
|
||||
}
|
||||
tvOperationStatus?.text = "暂停接单"
|
||||
tvOperationStatus?.setCompoundDrawablesWithIntrinsicBounds(
|
||||
module_mogo_och_operation_status.text = "暂停接单"
|
||||
module_mogo_och_operation_status.setCompoundDrawablesWithIntrinsicBounds(
|
||||
resources.getDrawable(R.drawable.shape_size_operation_back),
|
||||
null,
|
||||
null,
|
||||
@@ -150,9 +153,9 @@ public class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
)
|
||||
showPanel()
|
||||
} else {
|
||||
mDriverRole?.visibility = View.GONE
|
||||
tvOperationStatus?.text = "接单"
|
||||
tvOperationStatus?.setCompoundDrawablesWithIntrinsicBounds(
|
||||
taxi_driver_role_tv.visibility = View.GONE
|
||||
module_mogo_och_operation_status.text = "接单"
|
||||
module_mogo_och_operation_status.setCompoundDrawablesWithIntrinsicBounds(
|
||||
resources.getDrawable(R.drawable.shape_size_operation_out),
|
||||
null,
|
||||
null,
|
||||
|
||||
@@ -75,7 +75,7 @@ class TaxiReserveOrderFragment : BaseFragment() {
|
||||
|
||||
private fun updateOrderChanged(model: QueryCurrentTaskRespBean.Result?) {
|
||||
if (model == null) return
|
||||
if (model.order == null || model.taskType != TaskTypeEnum.ExerciseTask.code){
|
||||
if (model.order == null || model.taskType != TaskTypeEnum.ToOrderStartTask.code){
|
||||
showNoOrderView()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3,12 +3,10 @@ package com.mogo.och.taxi.ui
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
@@ -18,7 +16,6 @@ import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_tab
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_view_pager
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/11
|
||||
@@ -11,12 +8,12 @@ import java.util.List;
|
||||
public class OrderUtil {
|
||||
|
||||
// 判断两个list中的订单是否相同:依据orderId
|
||||
public static boolean haveSameOrders(List<OrderQueryRespBean.Result> list1,
|
||||
List<OrderQueryRespBean.Result> list2) {
|
||||
OrderQueryRespBean.Result[] arr1 = list1.toArray(new OrderQueryRespBean.Result[]{});
|
||||
OrderQueryRespBean.Result[] arr2 = list2.toArray(new OrderQueryRespBean.Result[]{});
|
||||
Arrays.sort(arr1);
|
||||
Arrays.sort(arr1);
|
||||
return Arrays.equals(arr1,arr2);
|
||||
}
|
||||
// public static boolean haveSameOrders(List<OrderQueryRespBean.Result> list1,
|
||||
// List<OrderQueryRespBean.Result> list2) {
|
||||
// OrderQueryRespBean.Result[] arr1 = list1.toArray(new OrderQueryRespBean.Result[]{});
|
||||
// OrderQueryRespBean.Result[] arr2 = list2.toArray(new OrderQueryRespBean.Result[]{});
|
||||
// Arrays.sort(arr1);
|
||||
// Arrays.sort(arr1);
|
||||
// return Arrays.equals(arr1,arr2);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:radius="@dimen/dp_8"/>
|
||||
<solid android:color="#3BC593"/>
|
||||
<solid android:color="#93A2C2"/>
|
||||
</shape>
|
||||
@@ -58,6 +58,8 @@
|
||||
app:layout_constraintLeft_toLeftOf="@+id/taskStatus"
|
||||
app:layout_constraintTop_toBottomOf="@+id/taskStatus"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:text="183XXXX5400 | -人"/>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.v_video_righ
|
||||
* 评价View
|
||||
* Created on 2022/5/16
|
||||
*/
|
||||
class ArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
|
||||
class mViewModelArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user