|
|
|
|
@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
|
|
|
|
import com.mogo.eagle.core.function.hmi.ui.widget.ItinerarySummaryDialog
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
@@ -29,6 +30,7 @@ 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.OchPhoneUtil
|
|
|
|
|
import com.mogo.och.common.module.utils.ResourcesUtils
|
|
|
|
|
import com.mogo.och.common.module.voice.VoiceNotice
|
|
|
|
|
import com.mogo.och.common.module.wigets.CommonSlideView
|
|
|
|
|
@@ -50,28 +52,55 @@ 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.cancleorder.CancleOrderView
|
|
|
|
|
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_order_phone
|
|
|
|
|
// 跳过乘客端验证
|
|
|
|
|
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.cancelTask
|
|
|
|
|
// 开始服务
|
|
|
|
|
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.endStationName
|
|
|
|
|
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.startStationName
|
|
|
|
|
// 用户手机号
|
|
|
|
|
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_order_phone
|
|
|
|
|
// 用户人数
|
|
|
|
|
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.orderPhoneAndNum
|
|
|
|
|
// 运营单标识
|
|
|
|
|
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_order
|
|
|
|
|
// 取消订单
|
|
|
|
|
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelOrder
|
|
|
|
|
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.currentTaskStation
|
|
|
|
|
|
|
|
|
|
// 展示站点信息
|
|
|
|
|
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.endStationName
|
|
|
|
|
// 起始站点名称
|
|
|
|
|
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.startStationName
|
|
|
|
|
// 途径点展示
|
|
|
|
|
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.android.synthetic.main.unmanned_itinerary_current.view.trajectoryType
|
|
|
|
|
|
|
|
|
|
import kotlinx.coroutines.flow.map
|
|
|
|
|
|
|
|
|
|
class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineViewCallback,
|
|
|
|
|
@@ -117,9 +146,6 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
viewModel?.uiStateFlow?.map { it.taskWithOrderUIState }?.collect { taskAndOrderUiState ->
|
|
|
|
|
d(TAG, "uiStateFlow-initViewModelObserver: $taskAndOrderUiState")
|
|
|
|
|
when (taskAndOrderUiState) {
|
|
|
|
|
is TaskWithOrderUIState.Init -> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 开始接单后 需要将车开到最近的一个站点就位,然后才能开启 无人化 流程
|
|
|
|
|
is TaskWithOrderUIState.TaskDriveToNearestStationTask -> {
|
|
|
|
|
if (taskAndOrderUiState.driveToNearestStationTask != null) {
|
|
|
|
|
@@ -163,13 +189,100 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 1、无订单 无任务
|
|
|
|
|
// 2、标定单
|
|
|
|
|
// 3、虚拟单
|
|
|
|
|
// 4、运营单
|
|
|
|
|
// 5、倒计时获取虚拟任务
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onAttachedToWindow() {
|
|
|
|
|
super.onAttachedToWindow()
|
|
|
|
|
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
|
|
|
|
ViewModelProvider(it).get(ItineraryCurrentModel::class.java)
|
|
|
|
|
}
|
|
|
|
|
viewModel?.setDistanceCallback(this)
|
|
|
|
|
initOnClickListener()
|
|
|
|
|
initTaskDebugViewListener()
|
|
|
|
|
initViewModelObserver()
|
|
|
|
|
showEmptyView()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun initOnClickListener() {
|
|
|
|
|
CallerLogger.d(TAG,"initOnClickListener")
|
|
|
|
|
naviToStart.setOnClickListener(this)
|
|
|
|
|
naviToEnd.setOnClickListener(this)
|
|
|
|
|
cancelTask.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()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
context?.let {
|
|
|
|
|
CancleOrderView.showDialog(it)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
naviToStart.id,
|
|
|
|
|
naviToEnd.id -> {
|
|
|
|
|
showNaviToEndStationFragment()
|
|
|
|
|
}
|
|
|
|
|
cancelTask.id -> {
|
|
|
|
|
val builder = CommonDialogStatus.Builder()
|
|
|
|
|
val closeLineConfirmDialog = builder
|
|
|
|
|
.title(ResourcesUtils.getString(R.string.common_dialog_title))
|
|
|
|
|
.tips(ResourcesUtils.getString(R.string.taxi_dialog_cancle_task))
|
|
|
|
|
.confirmStr(ResourcesUtils.getString(R.string.common_dialog_confirm))
|
|
|
|
|
.cancelStr(ResourcesUtils.getString(R.string.common_dialog_cancel))
|
|
|
|
|
.status(CommonDialogStatus.Status.ask)
|
|
|
|
|
.build(context)
|
|
|
|
|
closeLineConfirmDialog.setClickListener(object : CommonDialogStatus.ClickListener {
|
|
|
|
|
override fun confirm() {
|
|
|
|
|
viewModel?.cancleTask()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun cancel() {
|
|
|
|
|
closeLineConfirmDialog.dismiss()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
closeLineConfirmDialog.show()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新拉取任务倒计时
|
|
|
|
|
*/
|
|
|
|
|
private fun updatePrepareTaskDelayUI(millisInFuture: Long, isStart: Boolean) {
|
|
|
|
|
CallerLogger.d(TAG,"updatePrepareTaskDelayUI")
|
|
|
|
|
DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisInFuture / 1000)}")
|
|
|
|
|
if (!isStart) {
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.GONE
|
|
|
|
|
currentTaskStation.visibility = View.GONE
|
|
|
|
|
mPrepareTasCountDownTimer?.cancel()
|
|
|
|
|
mPrepareTasCountDownTimer = null
|
|
|
|
|
return
|
|
|
|
|
@@ -177,31 +290,37 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
|
|
|
|
|
if (mPrepareTasCountDownTimer != null) {
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.GONE
|
|
|
|
|
currentTaskStation.visibility = View.GONE
|
|
|
|
|
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 onTick(millisUntilFinished: Long) {
|
|
|
|
|
DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}")
|
|
|
|
|
// 倒计时
|
|
|
|
|
UiThreadHandler.post {
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.VISIBLE
|
|
|
|
|
prepareTaskCountdownTv.text = "距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}"
|
|
|
|
|
val taskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
|
|
|
|
|
if(taskWithOrder?.currentStatus == TaskStatusEnum.CompleteTask.code){
|
|
|
|
|
currentTaskStation.visibility = View.VISIBLE
|
|
|
|
|
currentTaskStation.text = taskWithOrder.endSite?.siteName?:""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onFinish() {
|
|
|
|
|
//倒计时结束了...
|
|
|
|
|
UiThreadHandler.post {
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.INVISIBLE
|
|
|
|
|
}
|
|
|
|
|
mPrepareTasCountDownTimer?.cancel()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onFinish() {
|
|
|
|
|
//倒计时结束了...
|
|
|
|
|
UiThreadHandler.post {
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.INVISIBLE
|
|
|
|
|
currentTaskStation.visibility = View.INVISIBLE
|
|
|
|
|
}
|
|
|
|
|
mPrepareTasCountDownTimer?.cancel()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mPrepareTasCountDownTimer?.start()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -209,6 +328,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
* 更新当前任务和订单信息
|
|
|
|
|
*/
|
|
|
|
|
private fun updateViewByCurrentTaskWithOrder(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
|
|
|
|
CallerLogger.d(TAG,"updateViewByCurrentTaskWithOrder")
|
|
|
|
|
if (taskAndOrder == null) return
|
|
|
|
|
/**
|
|
|
|
|
* 根据任务类型判断任务显示,
|
|
|
|
|
@@ -263,6 +383,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
|
|
|
|
|
// 第一个特殊任务 也是虚拟任务
|
|
|
|
|
private fun updateViewByDriveToNearestStationTask(driveToNearestStationTask: StartServiceRespBean.Result?) {
|
|
|
|
|
CallerLogger.d(TAG,"updateViewByDriveToNearestStationTask 标定单")
|
|
|
|
|
if (driveToNearestStationTask == null) return
|
|
|
|
|
initContainerView(true)
|
|
|
|
|
// DriverToNearestStationTask 任务更新
|
|
|
|
|
@@ -292,11 +413,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun showEmptyView() {
|
|
|
|
|
CallerLogger.d(TAG,"showEmptyView")
|
|
|
|
|
gourp_order.visibility = GONE
|
|
|
|
|
aciv_task_type_exercise.visibility = GONE
|
|
|
|
|
group_itinerary_info.visibility = GONE
|
|
|
|
|
include_empty.visibility = VISIBLE
|
|
|
|
|
prepareTaskCountdownTv.visibility = GONE
|
|
|
|
|
currentTaskStation.visibility = View.GONE
|
|
|
|
|
cancelTask.visibility = View.GONE
|
|
|
|
|
|
|
|
|
|
actv_end_order.visibility = GONE
|
|
|
|
|
@@ -305,28 +428,8 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun initOnClickListener() {
|
|
|
|
|
naviToStart.setOnClickListener(this)
|
|
|
|
|
naviToEnd.setOnClickListener(this)
|
|
|
|
|
cancelTask.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() {
|
|
|
|
|
CallerLogger.d(TAG,"initTaskDebugViewListener")
|
|
|
|
|
fragment?.let { fr->
|
|
|
|
|
aciv_task_type_exercise.setOnLongClickListener {
|
|
|
|
|
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW)
|
|
|
|
|
@@ -342,6 +445,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun startOrEndService() {
|
|
|
|
|
CallerLogger.d(TAG,"startOrEndService")
|
|
|
|
|
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
|
|
|
|
|
if (currentTaskWithOrder?.order == null) return
|
|
|
|
|
val order = currentTaskWithOrder.order
|
|
|
|
|
@@ -364,6 +468,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun closeOrderDialog() {
|
|
|
|
|
CallerLogger.d(TAG,"closeOrderDialog")
|
|
|
|
|
val builder = CommonDialogStatus.Builder()
|
|
|
|
|
val closeOrderDialog = builder
|
|
|
|
|
.title(ResourcesUtils.getString(R.string.dialog_order_close_title))
|
|
|
|
|
@@ -384,67 +489,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onAttachedToWindow() {
|
|
|
|
|
super.onAttachedToWindow()
|
|
|
|
|
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
|
|
|
|
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) {
|
|
|
|
|
context?.let {
|
|
|
|
|
CancleOrderView.showDialog(it)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
naviToStart.id,
|
|
|
|
|
naviToEnd.id -> {
|
|
|
|
|
showNaviToEndStationFragment()
|
|
|
|
|
}
|
|
|
|
|
cancelTask.id -> {
|
|
|
|
|
val builder = CommonDialogStatus.Builder()
|
|
|
|
|
val closeLineConfirmDialog = builder
|
|
|
|
|
.title(ResourcesUtils.getString(R.string.common_dialog_title))
|
|
|
|
|
.tips(ResourcesUtils.getString(R.string.taxi_dialog_cancle_task))
|
|
|
|
|
.confirmStr(ResourcesUtils.getString(R.string.common_dialog_confirm))
|
|
|
|
|
.cancelStr(ResourcesUtils.getString(R.string.common_dialog_cancel))
|
|
|
|
|
.status(CommonDialogStatus.Status.ask)
|
|
|
|
|
.build(context)
|
|
|
|
|
closeLineConfirmDialog.setClickListener(object : CommonDialogStatus.ClickListener {
|
|
|
|
|
override fun confirm() {
|
|
|
|
|
viewModel?.cancleTask()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun cancel() {
|
|
|
|
|
closeLineConfirmDialog.dismiss()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
closeLineConfirmDialog.show()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 显示/隐藏 前往任务目的地的导航
|
|
|
|
|
*
|
|
|
|
|
* @param isShow
|
|
|
|
|
*/
|
|
|
|
|
private fun showNaviToEndStationFragment() {
|
|
|
|
|
CallerLogger.d(TAG,"showNaviToEndStationFragment")
|
|
|
|
|
fragment?.let {
|
|
|
|
|
TaxiTaskModel.startNaviToEndStation(true);
|
|
|
|
|
}
|
|
|
|
|
@@ -456,6 +507,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
* @param hasCurrentTask
|
|
|
|
|
*/
|
|
|
|
|
private fun initContainerView(hasCurrentTask: Boolean) {
|
|
|
|
|
CallerLogger.d(TAG,"initContainerView")
|
|
|
|
|
d(
|
|
|
|
|
TAG,
|
|
|
|
|
"hasCurrentTask = $hasCurrentTask"
|
|
|
|
|
@@ -463,11 +515,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
if (hasCurrentTask) {
|
|
|
|
|
include_empty.visibility = View.GONE
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.GONE
|
|
|
|
|
currentTaskStation.visibility = View.GONE
|
|
|
|
|
} else {
|
|
|
|
|
// 空页面
|
|
|
|
|
include_empty.visibility = View.VISIBLE
|
|
|
|
|
// 倒计时
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.GONE
|
|
|
|
|
currentTaskStation.visibility = View.GONE
|
|
|
|
|
// 行程信息
|
|
|
|
|
group_itinerary_info.visibility = View.GONE
|
|
|
|
|
// 订单信息
|
|
|
|
|
@@ -489,10 +543,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun removeAllMapMarker() {
|
|
|
|
|
CallerLogger.d(TAG,"removeAllMapMarker")
|
|
|
|
|
MapMakerManager.removeAllMapMarkerByOwner(TYPE_MARKER_TAXI_ORDER)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun updateNextTaskFragment(result: QueryCurrentTaskRespBean.Result?) {
|
|
|
|
|
CallerLogger.d(TAG,"updateNextTaskFragment")
|
|
|
|
|
fragment?.let {
|
|
|
|
|
FlowBus.with<QueryCurrentTaskRespBean.Result?>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED)
|
|
|
|
|
.post(it.lifecycleScope, result)
|
|
|
|
|
@@ -514,6 +570,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun updateOrderUI(order: OrderDetail) {
|
|
|
|
|
CallerLogger.d(TAG,"updateOrderUI")
|
|
|
|
|
gourp_order.visibility = View.VISIBLE
|
|
|
|
|
cancelOrder.visibility = if (order.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code
|
|
|
|
|
) View.GONE else View.VISIBLE
|
|
|
|
|
@@ -538,17 +595,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
order.passengerSize
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
actv_order_phone.text = OchPhoneUtil.getPhoneWithoutMiddle(order.bookingUserPhone)
|
|
|
|
|
orderPhoneAndNum.text = "${ order.passengerSize}人"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -629,7 +676,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
|
|
|
|
|
//展示虚拟订单
|
|
|
|
|
private fun updateVirtualTaskUI(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
|
|
|
|
|
|
|
|
|
CallerLogger.d(TAG,"updateVirtualTaskUI")
|
|
|
|
|
if (taskAndOrder == null) return
|
|
|
|
|
|
|
|
|
|
val startSite = taskAndOrder.startSite // 起点
|
|
|
|
|
@@ -642,6 +689,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
include_empty.visibility = View.GONE
|
|
|
|
|
// 倒计时
|
|
|
|
|
prepareTaskCountdownTv.visibility = View.GONE
|
|
|
|
|
currentTaskStation.visibility = View.GONE
|
|
|
|
|
// 行程信息
|
|
|
|
|
group_itinerary_info.visibility = View.VISIBLE
|
|
|
|
|
// 订单信息
|
|
|
|
|
@@ -676,6 +724,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun updatePathwayPoint(taskType: Int, endSiteName: String?) {
|
|
|
|
|
CallerLogger.d(TAG,"updatePathwayPoint")
|
|
|
|
|
if (TextUtils.isEmpty(endSiteName)) return
|
|
|
|
|
pathwayPoint.visibility = if (taskType == TaskTypeEnum.ToOrderStartTask.code)
|
|
|
|
|
View.VISIBLE else View.GONE
|
|
|
|
|
@@ -683,6 +732,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun updateMapMarkers(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
|
|
|
|
CallerLogger.d(TAG,"updateMapMarkers")
|
|
|
|
|
if (taskAndOrder?.startSite != null
|
|
|
|
|
&& taskAndOrder.endSite != null
|
|
|
|
|
) {
|
|
|
|
|
@@ -755,6 +805,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
isAdd: Boolean, uuid: String,
|
|
|
|
|
lat: Double, lon: Double, resourceId: Int
|
|
|
|
|
) {
|
|
|
|
|
CallerLogger.d(TAG,"setOrRemoveMapMaker")
|
|
|
|
|
if (isAdd) {
|
|
|
|
|
MapMakerManager.addMapMaker(TYPE_MARKER_TAXI_ORDER, uuid, lat, lon, resourceId)
|
|
|
|
|
} else {
|
|
|
|
|
@@ -766,6 +817,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
* 根据任务状态计算剩余历程和时间
|
|
|
|
|
*/
|
|
|
|
|
private fun updateRemainDistanceAndTime(isVoicePlay: Boolean) {
|
|
|
|
|
CallerLogger.d(TAG,"updateRemainDistanceAndTime")
|
|
|
|
|
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
|
|
|
|
|
d(TAG, "updateRemainDistanceAndTime ${currentTaskWithOrder.currentStatus}")
|
|
|
|
|
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) {
|
|
|
|
|
@@ -786,6 +838,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun startNaviToStation(isVoicePlay: Boolean, stationLat: Double, stationLng: Double) {
|
|
|
|
|
CallerLogger.d(TAG,"startNaviToStation")
|
|
|
|
|
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
|
|
|
|
val gcJ02Location = OchLocationManager.getGCJ02Location()
|
|
|
|
|
val mCurLatitude = gcJ02Location.latitude
|
|
|
|
|
@@ -799,6 +852,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun showDialog(){
|
|
|
|
|
CallerLogger.d(TAG,"showDialog")
|
|
|
|
|
if(dialog==null&&context!=null){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -816,6 +870,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun dismissDialog(){
|
|
|
|
|
CallerLogger.d(TAG,"dismissDialog")
|
|
|
|
|
dialog?.let {
|
|
|
|
|
if(it.isShowing){
|
|
|
|
|
it.dismiss()
|
|
|
|
|
@@ -825,6 +880,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun hideNaviBtns() {
|
|
|
|
|
CallerLogger.d(TAG,"hideNaviBtns")
|
|
|
|
|
naviToStart.visibility = View.GONE
|
|
|
|
|
naviToEnd.visibility = View.GONE
|
|
|
|
|
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
|
|
|
|
@@ -838,10 +894,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onCurrentNaviDistAndTimeChanged(meters: Int, timeInSecond: Long) {
|
|
|
|
|
CallerLogger.d(TAG,"onCurrentNaviDistAndTimeChanged")
|
|
|
|
|
actv_distance_end.text = TaskUtils.getCurrentTaskDistance(meters.toLong())+" "+TaskUtils.getCurrentTaskTime(timeInSecond)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun reInitNaviAmap(isPlay: Boolean, isRestart: Boolean) {
|
|
|
|
|
CallerLogger.d(TAG,"reInitNaviAmap")
|
|
|
|
|
d(TAG, "isPlay = $isPlay, isRestart=$isRestart")
|
|
|
|
|
if (!isRestart) {
|
|
|
|
|
fragment?.let {
|
|
|
|
|
@@ -875,6 +933,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun onNaviToEndStationByAMap(isShow: Boolean) {
|
|
|
|
|
CallerLogger.d(TAG,"onNaviToEndStationByAMap")
|
|
|
|
|
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
|
|
|
|
|
fragment?.let {
|
|
|
|
|
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
|
|
|
|
|
@@ -894,6 +953,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onStartTaskFail() {
|
|
|
|
|
CallerLogger.d(TAG,"onStartTaskFail")
|
|
|
|
|
commonSlideViewStartServer.reset()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|