From c66c4739a9f085efbea6b70df7ba06d68d7327c7 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Fri, 11 Jul 2025 18:49:18 +0800 Subject: [PATCH] =?UTF-8?q?[8.1.0]=20[routing]=20[fix]=20[=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E8=AE=BE=E7=BD=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/runing/other/TaskRunningAdapter.kt | 14 +++--- .../ui/runing/other/TaskRunningModel.kt | 46 ++++++++++++------- .../ui/runing/other/TaskRunningView.kt | 4 +- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningAdapter.kt b/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningAdapter.kt index f62e9aa90a..56b396d427 100644 --- a/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningAdapter.kt +++ b/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningAdapter.kt @@ -54,8 +54,8 @@ class TaskRunningAdapter( val line = mData[currentPosition] holder.actvStationName.text = line.name val startStationIndex = TaskRunningModel.currentIndex - if (startStationIndex > 0) { - CallerLogger.d(TAG, "位置:$currentPosition 当前站${mData[startStationIndex]} ") + if (startStationIndex >= 0) { + CallerLogger.d(TAG, "位置:$currentPosition ${TaskRunningModel.currentIndex} 当前站${mData[startStationIndex]} ") } if (currentPosition < startStationIndex) { @@ -122,7 +122,7 @@ class TaskRunningAdapter( holder.middleStationBg.visibility = View.GONE holder.startStationBg.visibility = View.GONE holder.endStationBg.visibility = View.VISIBLE - if (startStationIndex == itemCount - 1) { + if (startStationIndex == itemCount - 2) { if (line.isLeaving) { holder.endStationBg.setBackgroundResource(R.color.common_4DFFFFFF) holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg) @@ -198,10 +198,10 @@ class TaskRunningAdapter( val index = (currentPosition - startStationIndex - 1) * 100 val startFraction = (dex + index) / totalHeight val endFraction = (dex + index + 100) / totalHeight - CallerLogger.d( - TAG, - "位置:$currentPosition 当前站${startStationIndex} 开始百分比:${startFraction} 结束百分比:${endFraction}" - ) +// CallerLogger.d( +// TAG, +// "位置:$currentPosition 当前站${startStationIndex} 开始百分比:${startFraction} 结束百分比:${endFraction}" +// ) val startColorTemp = argbEvaluator.evaluate(startFraction, startColor, endColor) as Int val endColorTemp = diff --git a/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningModel.kt b/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningModel.kt index 20fbbc96b6..334127c472 100644 --- a/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningModel.kt +++ b/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningModel.kt @@ -75,6 +75,12 @@ class TaskRunningModel : ViewModel() { this.currentGrayId = data.taskId this.stationList = data.stationList currentIndex = 0 + this.stationList?.let { + val startStationNext = it[currentIndex] + val endStation = it[currentIndex + 1] + CallerLogger.d(TAG,"setNewData index:${currentIndex} ${startStationNext.name} -- ${endStation.name}") + LineManager.setStartAndEndStation(startStationNext, endStation) + } MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true) //添加到站监听 OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener) @@ -128,7 +134,7 @@ class TaskRunningModel : ViewModel() { startStation.isLeaving = true arrivedStation = true startStation.drivingStatus = 2 - LineManager.setStartAndEndStation(startStation, endStation) + CallerLogger.d(TAG,"setNewData index:${currentIndex} ${startStation.name}---${endStation.name}") this.viewCallback?.notifyItemChange(currentIndex) this.viewCallback?.showArriverStationAndCompleteTask() if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING @@ -141,6 +147,29 @@ class TaskRunningModel : ViewModel() { } + fun arriveStation() { + stationList?.let { + val startStation = it[currentIndex] + startStation.isLeaving = false + arrivedStation = false + startStation.drivingStatus = 1 + + if (currentIndex + 2 >= it.size) { + this.viewCallback?.showCompleteTask() + }else { + currentIndex += 1 + val startStationNext = it[currentIndex] + val endStation = it[currentIndex + 1] + CallerLogger.d(TAG, "setNewData index:${currentIndex} ${startStationNext.name}----${endStation.name}") + LineManager.setStartAndEndStation(startStationNext, endStation) + } + } + + BizLoopManager.runInMainThread{ + this.viewCallback?.onArrivedStation() + } + } + interface SwtichLineViewCallback { // 到站 fun onArrivedStation() @@ -161,21 +190,6 @@ class TaskRunningModel : ViewModel() { fun clearData() } - - fun arriveStation() { - stationList?.let { - val startStation = it[currentIndex] - startStation.isLeaving = false - arrivedStation = false - startStation.drivingStatus = 1 - } - currentIndex += 1 - LineManager.setStartAndEndStation(null,null) - BizLoopManager.runInMainThread{ - this.viewCallback?.onArrivedStation() - } - } - /** * 结束灰度任务 */ diff --git a/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningView.kt b/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningView.kt index 977b50fc80..82e2654da4 100644 --- a/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningView.kt +++ b/OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/other/TaskRunningView.kt @@ -81,7 +81,7 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac // 滑动出发 aciv_task_leave_station_slide_bg.setSlideListener(object : CommonSlideView.SlideListener { override fun slideEnd() { - if (TaskRunningModel.currentIndex == mAdapter.mData.size-1) { + if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) { aciv_task_leave_station_slide_bg.setTextValue("单程结束") aciv_task_leave_station_slide_bg.reset() viewModel?.data?.taskId?.let { @@ -195,7 +195,7 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac showLeaveStationView() loading_arrive_station.visibility = GONE notifyItemChange(0) - if (TaskRunningModel.currentIndex == mAdapter.mData.size-1) { + if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) { aciv_task_leave_station_slide_bg.setTextValue("单程结束") } else { aciv_task_leave_station_slide_bg.setTextValue("滑动出发")