[8.3.0][临时不停] 增加首尾站点临时不停功能

This commit is contained in:
xinfengkun
2025-12-12 15:46:41 +08:00
parent c1d84c4aa7
commit a5b7a8b904
5 changed files with 39 additions and 6 deletions

View File

@@ -96,13 +96,23 @@ class BusRoutesResponse : BaseData() {
result.add(temp!!)
// 正在进行中的任务
if (temp!!.drivingStatus == TaskSiteDataBean.drivingStatusCurrent) {
currentStationIndex = index
if (temp!!.tag != 2) {
currentStationIndex = index
}
}
// 线路信息
if (lineInfo == null && taskAndsite.lineId != null && taskAndsite.lineName != null) {
lineInfo = LineInfo(taskAndsite.lineId!!, taskAndsite.lineName!!, orderId = taskAndsite.taskId.toString())
}
}
if (currentStationIndex == -1) {
val pos = result.indexOfFirst { it.tag != 2 }
currentStationIndex = if (pos != -1) {
pos
} else {
0
}
}
lineInfo?.multiMap?.put("taskInfo",LineModel.getTaskTime())
lineInfo?.siteInfos = result
LineManager.setLineInfo(lineInfo)

View File

@@ -205,16 +205,27 @@ object LineModel {
return if (stationList.isNullOrEmpty()) {
null
}else{
startStationIndex == stationList!!.size - 1
// startStationIndex == stationList!!.size - 1
startStationIndex == getLastStationPos(stationList!!)
}
}
private fun getLastStationPos(stationList: MutableList<BusStationBean>): Int {
for (index in stationList.indices.reversed()) {
val item = stationList[index]
if (item.tag != 2) {
return index
}
}
return stationList.lastIndex
}
fun isLastStation(end: BusStationBean):Boolean{
return if (stationList.isNullOrEmpty()) {
false
}else{
val last = stationList?.last()
// val last = stationList?.last()
val last = stationList!!.reversed().firstOrNull { it.tag != 2 } ?: stationList!!.last()
return last==end
}
}

View File

@@ -96,7 +96,9 @@ class NormalRepository: ILineRepository {
result.add(temp!!)
// 正在进行中的任务
if (temp!!.drivingStatus == TaskSiteDataBean.drivingStatusCurrent) {
currentStationIndex = index
if (temp!!.tag != 2) {
currentStationIndex = index
}
}
// 线路信息
if (lineInfo == null && busRoutesResult.name != null) {
@@ -104,6 +106,14 @@ class NormalRepository: ILineRepository {
}
}
if (currentStationIndex == -1) {
val pos = result.indexOfFirst { it.tag != 2 }
currentStationIndex = if (pos != -1) {
pos
} else {
0
}
}
lineInfo?.multiMap?.put("taskInfo", LineModel.getTaskTime())
lineInfo?.siteInfos = result
LineManager.setLineInfo(lineInfo)

View File

@@ -85,7 +85,8 @@ class TaskRunningAdapter(
AutoSizeUtils.dp2px(mContext, 45f).toFloat()
)
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.bus_color_2EACFF))
if (LineModel.startStationIndex == mData.size - 1) {
// if (LineModel.startStationIndex == mData.size - 1) {
if (LineModel.isLastStation() == true) {
holder.actvWriteOffCount.visibility = View.GONE
} else {
holder.actvWriteOffCount.visibility = View.VISIBLE

View File

@@ -134,7 +134,8 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac
} else {
showLeaveStationView()
}
if (LineModel.startStationIndex == it.size - 1) {
// if (LineModel.startStationIndex == it.size - 1) {
if (LineModel.isLastStation() == true) {
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
} else {
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")