[routing]
[fea] [bus、接驳、班车 验路模式 UI 流程完成]
This commit is contained in:
@@ -3,6 +3,7 @@ package com.mogo.och.biz.routing.bean
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.ContraiInfo
|
||||
import com.mogo.och.data.bean.LineInfo
|
||||
|
||||
/**
|
||||
* 灰度路线信息
|
||||
@@ -29,7 +30,6 @@ data class RoutingSite(
|
||||
var gcjLon: Double,// 高德坐标
|
||||
var wgs84Lon: Double,//高精坐标
|
||||
var wgs84Lat: Double,//高精坐标
|
||||
var pointType: Int // 1:途径点 2:禁行点 3:站点
|
||||
) {
|
||||
fun toBusStationBean(): BusStationBean {
|
||||
val temp = BusStationBean()
|
||||
@@ -39,7 +39,6 @@ data class RoutingSite(
|
||||
temp.lon = wgs84Lon
|
||||
temp.gcjLat = gcjLat
|
||||
temp.gcjLon = gcjLon
|
||||
temp.pointType = pointType
|
||||
temp.isLeaving = true
|
||||
return temp
|
||||
}
|
||||
@@ -49,36 +48,65 @@ data class RoutingSite(
|
||||
* 轨迹信息
|
||||
*/
|
||||
data class ContrailBean(
|
||||
var businessType:Int=0,
|
||||
var contrailId: Long = -1L,
|
||||
var contrailSaveTime: Long = -1L,
|
||||
var csvFileMd5: String = "",
|
||||
var csvFileUrl: String = "",
|
||||
var lineId: Long = -1L,
|
||||
var lineName: String = "",
|
||||
var contrailId: Long = -1L,
|
||||
var csvFileUrl: String = "",
|
||||
var csvFileMd5: String = "",
|
||||
var txtFileUrl: String = "",
|
||||
var segmentPointList:MutableList<PointInfoGroup> = mutableListOf(),
|
||||
var txtFileMd5: String = "",
|
||||
var contrailSaveTime: Long = -1L,
|
||||
var csvFileUrlDPQP: String = "",
|
||||
var csvFileMd5DPQP: String = "",
|
||||
var txtFileUrlDPQP: String = "",
|
||||
var txtFileMd5DPQP: String = "",
|
||||
var contrailSaveTimeDPQP: Long = -1L,
|
||||
var version: Long = -1L,
|
||||
var passPoints: MutableList<RoutingSite>?, // 用于算路的经停点
|
||||
var blackPoints: MutableList<RoutingSite>?, // 用于算路的黑名單點
|
||||
var txtFileUrl: String = "",
|
||||
) {
|
||||
fun toContraiInfo(): ContraiInfo {
|
||||
val tempPassPoints = mutableListOf<BusStationBean>()
|
||||
passPoints?.forEach {
|
||||
tempPassPoints.add(it.toBusStationBean())
|
||||
}
|
||||
val tempblackPoints = mutableListOf<BusStationBean>()
|
||||
blackPoints?.forEach {
|
||||
tempPassPoints.add(it.toBusStationBean())
|
||||
segmentPointList.forEach {
|
||||
for (pointInfo in it.blackList) {
|
||||
tempblackPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
for (pointInfo in it.pointList) {
|
||||
tempPassPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
}
|
||||
return ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,tempPassPoints,tempblackPoints)
|
||||
return ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,tempPassPoints,tempblackPoints, 2)
|
||||
}
|
||||
|
||||
fun getPassAndBlackPoint(index: Int): Pair<MutableList<BusStationBean>, MutableList<BusStationBean>> {
|
||||
val tempPassPoints = mutableListOf<BusStationBean>()
|
||||
val tempblackPoints = mutableListOf<BusStationBean>()
|
||||
segmentPointList.forEach {
|
||||
if(it.segment==index){
|
||||
for (pointInfo in it.blackList) {
|
||||
tempblackPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
for (pointInfo in it.pointList) {
|
||||
tempPassPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
return Pair(tempPassPoints,tempblackPoints)
|
||||
}
|
||||
}
|
||||
return Pair(tempPassPoints,tempblackPoints)
|
||||
}
|
||||
}
|
||||
|
||||
data class PointInfoGroup(var blackList:MutableList<PointInfo>,//用于算路的黑名單點
|
||||
var pointList:MutableList<PointInfo>,//用于算路的经停点
|
||||
var segment:Int)
|
||||
|
||||
data class PointInfo(var latitude:Double,var longitude:Double,var pointType:Int,var segment:Int) {
|
||||
fun toBusStationBean(): BusStationBean {
|
||||
val temp = BusStationBean()
|
||||
temp.lat = latitude
|
||||
temp.lon = longitude
|
||||
temp.pointType = pointType
|
||||
temp.isLeaving = true
|
||||
return temp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询灰度线路列表
|
||||
*/
|
||||
@@ -114,7 +142,8 @@ data class EndGrayContrailTaskReq(
|
||||
data class StartGrayAndQueryContrailRsp(
|
||||
var taskId: Long?,
|
||||
var contrail: ContrailBean?,
|
||||
var grayLineBean: GrayLineBean
|
||||
var grayLineBean: GrayLineBean,
|
||||
var stationList: MutableList<BusStationBean>
|
||||
) : BaseData()
|
||||
|
||||
data class PointError(var code: String, var name: String, var isCheck: Boolean = false)
|
||||
@@ -144,5 +173,14 @@ enum class EndGrayTaskFeedbackType(var type: Int) {
|
||||
USABLE_NO(2)
|
||||
}
|
||||
|
||||
data class BindLineListResponse(val data: List<Result>?) : BaseData() {
|
||||
|
||||
data class Result(
|
||||
var line: LineInfo?,
|
||||
var siteList: List<BusStationBean>?,//站点名称
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.biz.routing.net
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.biz.routing.bean.BindLineListResponse
|
||||
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
|
||||
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
|
||||
import com.mogo.och.biz.routing.bean.QueryRoutingContrailByIdRsp
|
||||
@@ -84,4 +85,27 @@ interface RoutingServiceApi {
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@Body data: SaveGrayContrailErrorReasons
|
||||
): Observable<BaseData>
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆配置的所有路线
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-vehicle/public/car/queryBindLineListBySn")
|
||||
fun queryBindLineListBySn(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Query("sn") sn: String?
|
||||
): Observable<BindLineListResponse?>?
|
||||
|
||||
@GET("/och-shuttle-cabin/api/business/v1/driver/queryBindLineListBySn")
|
||||
fun daliQueryBindLineListBySn(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Query("sn") sn: String?
|
||||
): Observable<BindLineListResponse?>?
|
||||
|
||||
}
|
||||
@@ -1,22 +1,31 @@
|
||||
package com.mogo.och.biz.routing.net
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
|
||||
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
|
||||
import com.mogo.och.biz.routing.bean.QueryRoutingContrailByIdRsp
|
||||
import com.mogo.och.biz.routing.bean.SaveGrayContrailErrorReasons
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskReq
|
||||
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskRsp
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.network.interceptor.transformTry
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.weaknet.repository.db.exception.NetDataException
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.functions.BiFunction
|
||||
|
||||
object RoutingServiceManager {
|
||||
|
||||
@@ -78,40 +87,103 @@ object RoutingServiceManager {
|
||||
callback: OchCommonServiceCallback<StartGrayAndQueryContrailRsp>
|
||||
) {
|
||||
val data = StartGrayContrailTaskReq(sn, contrailId ,LoginStatusManager.getOchLoginInfo()?.driverId?:0L)
|
||||
var taskId: Long
|
||||
mRoutingServiceApi.startGrayTask(data = data)
|
||||
.flatMap { startGrayRsp ->
|
||||
if (startGrayRsp.data == null) {
|
||||
taskId = -1L
|
||||
val result = StartGrayAndQueryContrailRsp(
|
||||
taskId = taskId,
|
||||
contrail = null,
|
||||
grayLineBean = grayLineBean
|
||||
)
|
||||
result.code = startGrayRsp.code
|
||||
result.msg = startGrayRsp.msg
|
||||
return@flatMap Observable.just(result)
|
||||
}
|
||||
taskId = startGrayRsp.data!!
|
||||
return@flatMap mRoutingServiceApi.queryRoutingContrailById(contrailId = contrailId)
|
||||
.map { queryRoutingContrailRsp ->
|
||||
val result = StartGrayAndQueryContrailRsp(
|
||||
taskId = taskId,
|
||||
contrail = queryRoutingContrailRsp.data,
|
||||
grayLineBean = grayLineBean
|
||||
)
|
||||
result.code = queryRoutingContrailRsp.code
|
||||
result.msg = queryRoutingContrailRsp.msg
|
||||
result
|
||||
}
|
||||
}
|
||||
.transformTry()
|
||||
.subscribe(
|
||||
OchCommonSubscribeImpl(
|
||||
context,
|
||||
callback,
|
||||
"startGrayTaskAndQueryRoutingContrail"
|
||||
|
||||
val requestContral = mRoutingServiceApi.queryRoutingContrailById(contrailId = contrailId)
|
||||
val startRouting = mRoutingServiceApi.startGrayTask(data = data)
|
||||
|
||||
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
||AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|
||||
||AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
val querySites = if(ProjectUtils.isSaas()) {
|
||||
mRoutingServiceApi.queryBindLineListBySn(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
)
|
||||
}else if(ProjectUtils.isDali()){
|
||||
mRoutingServiceApi.queryBindLineListBySn(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
}else{
|
||||
null
|
||||
}
|
||||
querySites?.let { querysites->
|
||||
Observable.zip(requestContral,startRouting,querysites) { t1, t2, t3 ->
|
||||
if ((t1.code != 0 && t1.code != 200) || t1.data == null) {
|
||||
throw NetDataException(t1.code, "${t1.msg}_queryCabinContrailById")
|
||||
}
|
||||
if (t2.code != 0 && t2.code != 200 || t2.data == null) {
|
||||
throw NetDataException(t2.code, "${t2.msg}_saveFeedback")
|
||||
}
|
||||
if (t3.code != 0 && t3.code != 200 || t3.data == null) {
|
||||
throw NetDataException(t3.code, "${t3.msg}_saveFeedback")
|
||||
}
|
||||
val stationList = mutableListOf<BusStationBean>()
|
||||
t3.data.let { lineList->
|
||||
val info = lineList.filter {
|
||||
it.line?.lineId==grayLineBean.lineId
|
||||
}
|
||||
if(info.isNotEmpty()){
|
||||
info.first().siteList?.let { it1 -> stationList.addAll(it1) }
|
||||
}else{
|
||||
throw NetDataException(t3.code, "${t3.msg}_queryBindLineListBySn _ 未找到线路")
|
||||
}
|
||||
}
|
||||
val result = StartGrayAndQueryContrailRsp(
|
||||
taskId = t2.data!!,
|
||||
contrail = t1.data,
|
||||
grayLineBean = grayLineBean,
|
||||
stationList = stationList
|
||||
)
|
||||
result.code = t1.code
|
||||
result.msg = t1.msg
|
||||
result
|
||||
}.transformTry()
|
||||
.subscribe(
|
||||
OchCommonSubscribeImpl(
|
||||
context,
|
||||
callback,
|
||||
"startGrayTaskAndQueryRoutingContrail"
|
||||
)
|
||||
)
|
||||
}
|
||||
}else if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
Observable.zip(requestContral,startRouting) { t1, t2 ->
|
||||
if ((t1.code != 0 && t1.code != 200)||t1.data==null) {
|
||||
throw NetDataException(t1.code,"${t1.msg}_queryCabinContrailById")
|
||||
}
|
||||
if (t2.code != 0 && t2.code != 200||t2.data==null) {
|
||||
throw NetDataException(t2.code,"${t2.msg}_saveFeedback")
|
||||
}
|
||||
val stationList = mutableListOf<BusStationBean>()
|
||||
grayLineBean.startSite?.toBusStationBean()?.let {
|
||||
stationList.add(it)
|
||||
}
|
||||
grayLineBean.endSite?.toBusStationBean()?.let {
|
||||
stationList.add(it)
|
||||
}
|
||||
val result = StartGrayAndQueryContrailRsp(
|
||||
taskId = t2.data!!,
|
||||
contrail = t1.data,
|
||||
grayLineBean = grayLineBean,
|
||||
stationList = stationList
|
||||
)
|
||||
result.code = t1.code
|
||||
result.msg = t1.msg
|
||||
result
|
||||
}.transformTry()
|
||||
.subscribe(
|
||||
OchCommonSubscribeImpl(
|
||||
context,
|
||||
callback,
|
||||
"startGrayTaskAndQueryRoutingContrail"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,16 @@ import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingRunningView
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingOtherRunningView
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingSelectView
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingTaxiRunningView
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.switch_routing_loading
|
||||
|
||||
class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCallback {
|
||||
@@ -63,7 +66,8 @@ class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCall
|
||||
override fun showLoadingView(){
|
||||
startLoading = System.currentTimeMillis()
|
||||
routingSelectView.visibility = GONE
|
||||
routingRunningView.visibility = GONE
|
||||
routingTaxiRunningView.visibility = GONE
|
||||
routingOtherRunningView.visibility = GONE
|
||||
switch_routing_loading.visibility = VISIBLE
|
||||
}
|
||||
|
||||
@@ -73,7 +77,8 @@ class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCall
|
||||
CallerLogger.d(TAG,"展示选择线路 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
routingSelectView.visibility = VISIBLE
|
||||
routingRunningView.visibility = GONE
|
||||
routingTaxiRunningView.visibility = GONE
|
||||
routingOtherRunningView.visibility = GONE
|
||||
switch_routing_loading.visibility = GONE
|
||||
},dex, ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
@@ -84,9 +89,20 @@ class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCall
|
||||
CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
routingSelectView.visibility = GONE
|
||||
routingRunningView.visibility = VISIBLE
|
||||
switch_routing_loading.visibility = GONE
|
||||
routingRunningView.setData(data)
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
|| AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|
||||
|| AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
routingTaxiRunningView.visibility = GONE
|
||||
routingOtherRunningView.visibility = VISIBLE
|
||||
routingOtherRunningView.setData(data)
|
||||
}else if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
routingTaxiRunningView.visibility = VISIBLE
|
||||
routingOtherRunningView.visibility = GONE
|
||||
routingTaxiRunningView.setData(data)
|
||||
}
|
||||
|
||||
},dex, ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
@@ -17,7 +18,7 @@ import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.LineInfo
|
||||
import com.mogo.och.biz.routing.ui.runing.taxi.RoutingRunningModel
|
||||
import com.mogo.och.biz.routing.ui.runing.taxi.TaxiRunningModel
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,7 @@ import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
*/
|
||||
class RoutingSelectModel : ViewModel() {
|
||||
|
||||
private val TAG = RoutingRunningModel::class.java.simpleName
|
||||
private val TAG = M_OCHCOMMON +"RoutingSelectModel"
|
||||
|
||||
private var viewCallback: SwtichRoutingViewCallback? = null
|
||||
|
||||
@@ -146,37 +147,35 @@ class RoutingSelectModel : ViewModel() {
|
||||
val grayLineBean = data.grayLineBean
|
||||
val contrailBean = data.contrail
|
||||
val grayId = data.taskId
|
||||
if (grayLineBean == null || contrailBean == null) {
|
||||
val stationList = data.stationList
|
||||
if (grayLineBean == null || contrailBean == null || stationList.size < 2) {
|
||||
ToastUtils.showShort("灰度线路或轨迹信息异常,请稍后再试")
|
||||
OchChainLogManager.writeChainLogRouting("[开始任务]","[开始任务] 灰度线路或轨迹信息异常,请稍后再试")
|
||||
return
|
||||
}
|
||||
OchChainLogManager.writeChainLogRouting("[启自驾]","[启自驾] 准备启动自驾")
|
||||
|
||||
val startStation = grayLineBean.startSite?.toBusStationBean()
|
||||
val endStation = grayLineBean.endSite?.toBusStationBean()
|
||||
val temp = mutableListOf<BusStationBean>()
|
||||
if(startStation!=null){
|
||||
temp.add(startStation)
|
||||
}
|
||||
if(endStation!=null){
|
||||
temp.add(endStation)
|
||||
stationList.forEachIndexed { index, busStationBean ->
|
||||
if(index>0){
|
||||
val (tempPassPoints, tempblackPoints) = contrailBean.getPassAndBlackPoint(index)
|
||||
busStationBean.passPoints = tempPassPoints
|
||||
busStationBean.blackPoints = tempblackPoints
|
||||
}
|
||||
}
|
||||
|
||||
LineManager.setLineInfo(
|
||||
LineInfo(
|
||||
grayLineBean.lineId?:0L,
|
||||
LineInfo(grayLineBean.lineId?:0L,
|
||||
grayLineBean.lineName?:"",
|
||||
orderId = "${data.taskId}",
|
||||
siteInfos = temp
|
||||
)
|
||||
siteInfos = stationList)
|
||||
)
|
||||
LineManager.setContraiInfo(contrailBean.toContraiInfo())
|
||||
LineManager.setStartAndEndStation(startStation,endStation)
|
||||
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
|
||||
|
||||
viewCallback?.onStartGrayTaskAndQueryContrailSuccess(data)
|
||||
// Routing 从这里解析出经停信息,轨迹信息,并调用下载轨迹接口
|
||||
LineManager.initAutopilotControlParameters()?.let {
|
||||
LineManager.initAutopilotControlParametersFromContrai()?.let {
|
||||
CallerLogger.d(TAG,"下发下载轨迹信息:${it}")
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
package com.mogo.och.biz.routing.ui.runing.other
|
||||
|
||||
import android.animation.ArgbEvaluator
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
* 路线列表adapter
|
||||
*/
|
||||
class TaskRunningAdapter(
|
||||
private val mContext: Context,
|
||||
val mData: MutableList<BusStationBean>
|
||||
) : RecyclerView.Adapter<TaskRunningAdapter.TaskRunningViewHolder>() {
|
||||
|
||||
companion object {
|
||||
const val TAG = "${M_OCHCOMMON}TaskRunningAdapter"
|
||||
}
|
||||
|
||||
private val argbEvaluator: ArgbEvaluator = ArgbEvaluator()
|
||||
private val startColor = ResourcesUtils.getColor(R.color.common_1970FF)
|
||||
private val endColor = ResourcesUtils.getColor(R.color.common_19FF7F)
|
||||
private val heightItem = 100f
|
||||
private val halfHeight = 16.5f
|
||||
private var totalHeight = 0f
|
||||
|
||||
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): TaskRunningViewHolder {
|
||||
val view = LayoutInflater.from(mContext).inflate(
|
||||
R.layout.biz_other_running_item, parent, false
|
||||
)
|
||||
return TaskRunningViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: TaskRunningViewHolder, position: Int) {
|
||||
val currentPosition = holder.bindingAdapterPosition
|
||||
val line = mData[currentPosition]
|
||||
holder.actvStationName.text = line.name
|
||||
val startStationIndex = TaskRunningModel.currentIndex
|
||||
if (startStationIndex > 0) {
|
||||
CallerLogger.d(TAG, "位置:$currentPosition 当前站${mData[startStationIndex]} ")
|
||||
}
|
||||
|
||||
if (currentPosition < startStationIndex) {
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
|
||||
)
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.common_4DFFFFFF))
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_switch_line_adapter_point_pass)
|
||||
} else if (currentPosition == startStationIndex) {
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 45f).toFloat()
|
||||
)
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.common_2EACFF))
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
|
||||
} else {
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.white))
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
|
||||
)
|
||||
holder.itemView.background = null
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
|
||||
}
|
||||
|
||||
when (currentPosition) {
|
||||
0 -> {
|
||||
holder.acivStationHeadBig.visibility = View.VISIBLE
|
||||
holder.acivStationHead.visibility = View.INVISIBLE
|
||||
holder.acivStationHeadBig.setImageResource(R.drawable.bus_runnint_task_start)
|
||||
holder.middleStationBg.visibility = View.GONE
|
||||
holder.startStationBg.visibility = View.VISIBLE
|
||||
holder.endStationBg.visibility = View.GONE
|
||||
if (startStationIndex == 0) {
|
||||
if (line.isLeaving) {
|
||||
// 下端 灰色
|
||||
holder.startStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
} else {
|
||||
// 下端 彩色
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColor,
|
||||
endColor
|
||||
)
|
||||
)
|
||||
holder.startStationBg.background = temp01
|
||||
}
|
||||
} else {
|
||||
// 下端 灰色
|
||||
holder.startStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
}
|
||||
}
|
||||
|
||||
mData.size - 1 -> {
|
||||
holder.acivStationHeadBig.visibility = View.VISIBLE
|
||||
holder.acivStationHead.visibility = View.INVISIBLE
|
||||
holder.acivStationHeadBig.setImageResource(R.drawable.bus_runnint_task_end)
|
||||
holder.middleStationBg.visibility = View.GONE
|
||||
holder.startStationBg.visibility = View.GONE
|
||||
holder.endStationBg.visibility = View.VISIBLE
|
||||
if (startStationIndex == itemCount - 1) {
|
||||
if (line.isLeaving) {
|
||||
holder.endStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
} else {
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
holder.endStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
}
|
||||
} else {
|
||||
// 上端 彩色
|
||||
holder.itemView.background = null
|
||||
val startColorTemp = argbEvaluator.evaluate(
|
||||
((totalHeight - halfHeight) / totalHeight).toFloat(),
|
||||
startColor,
|
||||
endColor
|
||||
) as Int
|
||||
val endColorTemp = argbEvaluator.evaluate(1f, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.endStationBg.background = temp01
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
holder.acivStationHeadBig.visibility = View.GONE
|
||||
holder.acivStationHead.visibility = View.VISIBLE
|
||||
holder.middleStationBg.visibility = View.VISIBLE
|
||||
holder.startStationBg.visibility = View.GONE
|
||||
holder.endStationBg.visibility = View.GONE
|
||||
if (currentPosition == startStationIndex) {
|
||||
if (line.isLeaving) {
|
||||
// 灰色
|
||||
holder.middleStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
} else {
|
||||
// 彩色
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
val startColorTemp = argbEvaluator.evaluate(0f, startColor, endColor) as Int
|
||||
val endColorTemp =
|
||||
argbEvaluator.evaluate(100f / totalHeight, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.middleStationBg.background = temp01
|
||||
}
|
||||
} else if (currentPosition < startStationIndex) {
|
||||
// 灰色
|
||||
holder.middleStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
} else {
|
||||
var dex = 0f
|
||||
if (startStationIndex == 0) {
|
||||
val firstItemData = mData[0]
|
||||
if (!firstItemData.isLeaving) {
|
||||
dex = halfHeight
|
||||
}
|
||||
} else {
|
||||
val checkIndex = mData.get(startStationIndex)
|
||||
if (!checkIndex.isLeaving) {
|
||||
dex = heightItem
|
||||
}
|
||||
}
|
||||
// 彩色
|
||||
holder.itemView.background = null
|
||||
val index = (currentPosition - startStationIndex - 1) * 100
|
||||
val startFraction = (dex + index) / totalHeight
|
||||
val endFraction = (dex + index + 100) / totalHeight
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"位置:$currentPosition 当前站${startStationIndex} 开始百分比:${startFraction} 结束百分比:${endFraction}"
|
||||
)
|
||||
val startColorTemp =
|
||||
argbEvaluator.evaluate(startFraction, startColor, endColor) as Int
|
||||
val endColorTemp =
|
||||
argbEvaluator.evaluate(endFraction, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.middleStationBg.background = temp01
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentPosition == startStationIndex + 1) {
|
||||
val preLine = mData[currentPosition - 1]
|
||||
if (preLine.isLeaving) {
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
} else {
|
||||
holder.itemView.background = null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return mData.size
|
||||
}
|
||||
|
||||
fun setDataList(dataList: List<BusStationBean>) {
|
||||
this.mData.clear()
|
||||
this.mData.addAll(dataList)
|
||||
totalHeight = 33 + (dataList.size - 2) * heightItem
|
||||
notifyItemRangeChanged(0, dataList.size, true)
|
||||
}
|
||||
|
||||
fun notifyChange(){
|
||||
if (TaskRunningModel.currentIndex == 0) {
|
||||
totalHeight = 33 + (mData.size - 2) * heightItem
|
||||
} else {
|
||||
totalHeight =
|
||||
(halfHeight + (mData.size - 1 - TaskRunningModel.currentIndex) * heightItem).toFloat()
|
||||
}
|
||||
notifyItemRangeChanged(0, mData.size, true)
|
||||
}
|
||||
class TaskRunningViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val actvStationName: AppCompatTextView = itemView.findViewById(R.id.actv_station_name)//站点名称
|
||||
val acivStationHead: AppCompatImageView =
|
||||
itemView.findViewById(R.id.aciv_station_head)//普通站点标识 不是起始和终点坐标
|
||||
val acivStationHeadBig: AppCompatImageView =
|
||||
itemView.findViewById(R.id.aciv_station_head_big)//起始和终点坐标标识
|
||||
val middleStationBg: View = itemView.findViewById(R.id.bg_pass_bg) //贯通背景调
|
||||
val endStationBg: View = itemView.findViewById(R.id.bg_pass_head_bg) //终点的背景
|
||||
val startStationBg: View = itemView.findViewById(R.id.bg_pass_bottom_bg) //起点坐标的背景
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package com.mogo.och.biz.routing.ui.runing.other
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.och.biz.routing.bean.ContrailBean
|
||||
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
|
||||
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.net.RoutingServiceManager
|
||||
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.bridge.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.bridge.autopilot.line.ILineCallback
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class TaskRunningModel : ViewModel() {
|
||||
|
||||
private val TAG = M_OCHCOMMON + TaskRunningModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: SwtichLineViewCallback? = null
|
||||
|
||||
private val content = AbsMogoApplication.getApp()
|
||||
|
||||
private var _data: StartGrayAndQueryContrailRsp? = null
|
||||
val data: StartGrayAndQueryContrailRsp?
|
||||
get() = _data
|
||||
|
||||
private var currentGrayLineBean: GrayLineBean? = null
|
||||
private var currentContrailBean: ContrailBean? = null
|
||||
private var stationList: MutableList<BusStationBean>? = null
|
||||
private var currentGrayId: Long? = null
|
||||
|
||||
companion object {
|
||||
var currentIndex = -1
|
||||
}
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
|
||||
fun setNewData(data: StartGrayAndQueryContrailRsp) {
|
||||
this._data = data
|
||||
this.currentGrayLineBean = data.grayLineBean
|
||||
this.currentContrailBean = data.contrail
|
||||
this.currentGrayId = data.taskId
|
||||
this.stationList = data.stationList
|
||||
currentIndex = 0
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true)
|
||||
//添加到站监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener)
|
||||
LineManager.addListener(TAG, lineCallback)
|
||||
}
|
||||
|
||||
//MAP到站监听
|
||||
private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivedStation?) {
|
||||
CallerLogger.i(
|
||||
TAG,
|
||||
"onAutopilotArriveAtStation = ${arrivalNotification.toString()}"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"MAP到站通知",
|
||||
"[MAP到站通知] 上报到站,location=${arrivalNotification?.endLocation}"
|
||||
)
|
||||
viewCallback?.onArrivedStation()
|
||||
}
|
||||
}
|
||||
|
||||
private val lineCallback: ILineCallback = object : ILineCallback {
|
||||
override fun arrivedStationSuccessBySearch() {
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[自车定位围栏]",
|
||||
"\"[自车定位围栏] 并查询底盘触发到站, endSiteId=${currentGrayLineBean?.endSite?.siteId}, endSiteName=${currentGrayLineBean?.endSite?.siteName}, lineId=${currentGrayLineBean?.lineId},围栏范围:${OchCommonConst.ARRIVE_AT_START_STATION_DISTANCE}米 没有过站、速度基本为零且在15m内\""
|
||||
)
|
||||
viewCallback?.onArrivedStation()
|
||||
}
|
||||
}
|
||||
|
||||
fun leaveStation() {
|
||||
stationList?.let {
|
||||
if (it.isNotEmpty()) {
|
||||
if (currentIndex + 1 >= it.size) {
|
||||
this.viewCallback?.showCompleteTask()
|
||||
return
|
||||
}
|
||||
val startStation = it[currentIndex]
|
||||
val endStation = it[currentIndex + 1]
|
||||
startStation.isLeaving = true
|
||||
startStation.drivingStatus = 2
|
||||
LineManager.setStartAndEndStation(startStation, endStation)
|
||||
this.viewCallback?.notifyItemChange(currentIndex)
|
||||
this.viewCallback?.showArriverStationAndCompleteTask()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface SwtichLineViewCallback {
|
||||
// 到站
|
||||
fun onArrivedStation()
|
||||
|
||||
// 结束服务成功
|
||||
fun onSubmitEndTaskSuccess()
|
||||
|
||||
// 结束服务失败
|
||||
fun onSubmitEndTaskFailed(s: String)
|
||||
|
||||
// 站点到站和结束任务
|
||||
fun showCompleteTask()
|
||||
|
||||
//
|
||||
fun showArriverStationAndCompleteTask()
|
||||
|
||||
fun notifyItemChange(currentIndex: Int)
|
||||
}
|
||||
|
||||
|
||||
fun arriveStation() {
|
||||
stationList?.let {
|
||||
val startStation = it[currentIndex]
|
||||
startStation.isLeaving = false
|
||||
startStation.drivingStatus = 1
|
||||
}
|
||||
currentIndex += 1
|
||||
LineManager.setStartAndEndStation(null,null)
|
||||
this.viewCallback?.onArrivedStation()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束灰度任务
|
||||
*/
|
||||
fun endGrayTask(grayId: Long, type: EndGrayTaskFeedbackType, occurrenceTime: Long) {
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 准备发送请求,grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
val submit = EndGrayContrailTaskReq(grayId, type.type, occurrenceTime)
|
||||
RoutingServiceManager.endGrayTask(
|
||||
content,
|
||||
submit,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"endGrayTask onSuccess: data=${
|
||||
GsonUtils.toJson(
|
||||
data
|
||||
)
|
||||
}"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 请求success,grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
clearData()
|
||||
viewCallback?.onSubmitEndTaskSuccess()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"endGrayTask onFail: code=$code, msg=$msg"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 请求fail, code=$code, msg=$msg, grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
viewCallback?.onSubmitEndTaskFailed(msg ?: "endGrayTask onFail")
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
super.onError()
|
||||
var hintStr = ""
|
||||
if (!NetworkUtils.isConnected(content)) {
|
||||
hintStr = "网络出现异常,请稍后重试"
|
||||
} else {
|
||||
hintStr = "上报结束任务异常, 请稍后重试"
|
||||
}
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"endGrayTask onError, msg=$hintStr"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 请求error, msg=$hintStr, grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
viewCallback?.onSubmitEndTaskFailed(hintStr)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun clearData() {
|
||||
_data = null
|
||||
this.currentGrayLineBean = null
|
||||
this.currentContrailBean = null
|
||||
this.currentGrayId = null
|
||||
LineManager.setLineInfo(null)
|
||||
LineManager.setContraiInfo(null)
|
||||
LineManager.setStartAndEndStation(null, null)
|
||||
|
||||
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
|
||||
|
||||
// 设置灰度路线任务执行状态,切换模式时判断使用
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, false)
|
||||
|
||||
// 移除到站监听
|
||||
OchAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
LineManager.removeListener(TAG)
|
||||
cancelAutopilot()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
* */
|
||||
private fun cancelAutopilot() {
|
||||
try {
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
OchChainLogManager.writeChainLogRouting("[取消自驾]", "[取消自驾] 调用成功")
|
||||
CallerLogger.d(TAG, "结束自动驾驶")
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.mogo.och.biz.routing.ui.runing.other
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
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.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.RoutingServiceManager
|
||||
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.ui.RoutingSwitchModel
|
||||
import com.mogo.och.biz.routing.ui.errorpoint.ReportErrorPointView
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import com.mogo.och.common.module.wigets.CommonSlideView
|
||||
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.aciv_task_leave_station_slide_bg
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_arriver_station
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_complete_task
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_running_task_last_station
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_submit_task
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.bus_task_running_line_name
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.loading_arrive_station
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.rl_running_task_station_list
|
||||
|
||||
|
||||
class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallback {
|
||||
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = M_OCHCOMMON + "TaskRunningView"
|
||||
}
|
||||
|
||||
private var viewModel: TaskRunningModel? = null
|
||||
|
||||
private var swtichViewModel: RoutingSwitchModel?=null
|
||||
|
||||
|
||||
private lateinit var mAdapter: TaskRunningAdapter
|
||||
|
||||
private lateinit var linearLayoutManager: WrapContentLinearLayoutManager
|
||||
|
||||
private var closeRouting: CommonDialogStatus?=null
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.biz_other_running, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
linearLayoutManager = WrapContentLinearLayoutManager(context)
|
||||
rl_running_task_station_list.setLayoutManager(linearLayoutManager)
|
||||
mAdapter = TaskRunningAdapter(context, mutableListOf())
|
||||
rl_running_task_station_list.setAdapter(mAdapter)
|
||||
// 滑动出发
|
||||
aciv_task_leave_station_slide_bg.setSlideListener(object : CommonSlideView.SlideListener {
|
||||
override fun slideEnd() {
|
||||
if (TaskRunningModel.currentIndex == mAdapter.mData.size-1) {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
|
||||
aciv_task_leave_station_slide_bg.reset()
|
||||
viewModel?.data?.taskId?.let {
|
||||
showFeedbackDialog(it)
|
||||
}
|
||||
} else {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
viewModel?.leaveStation()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
// 到站
|
||||
actv_arriver_station.onClick {
|
||||
loading_arrive_station.visibility = VISIBLE
|
||||
viewModel?.arriveStation()
|
||||
}
|
||||
|
||||
// 结束任务
|
||||
actv_complete_task.onClick {
|
||||
viewModel?.data?.taskId?.let {
|
||||
showFeedbackDialog(it)
|
||||
}
|
||||
}
|
||||
|
||||
actv_submit_task.onClick {
|
||||
CallerLogger.d(TAG,"启动自驾参数:${LineManager.initAutopilotControlParameters()}")
|
||||
viewModel?.data?.taskId?.let {
|
||||
ReportErrorPointView.showDialog(context,it)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(TaskRunningModel::class.java)
|
||||
}
|
||||
|
||||
swtichViewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
|
||||
}
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
private fun showFeedbackDialog(grayId: Long) {
|
||||
val occurrenceTime = System.currentTimeMillis()
|
||||
if(closeRouting==null) {
|
||||
closeRouting = CommonDialogStatus
|
||||
.Builder()
|
||||
.title("路线验证结束")
|
||||
.tips("请点击按钮反馈验证结果")
|
||||
.showClose(true)
|
||||
.cancelTextColor(R.color.biz_routing_FF4E41)
|
||||
.cancelStr("线路不可用")
|
||||
.confirmStr("线路可用")
|
||||
.status(CommonDialogStatus.Status.success)
|
||||
.build(context)
|
||||
}else{
|
||||
if(closeRouting?.isShowing==true){
|
||||
return
|
||||
}
|
||||
}
|
||||
closeRouting?.setClickListener(object : CommonDialogStatus.ClickListener {
|
||||
override fun confirm() {
|
||||
swtichViewModel?.showLoading()
|
||||
viewModel?.endGrayTask(grayId, EndGrayTaskFeedbackType.USABLE_YES, occurrenceTime)
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
swtichViewModel?.showLoading()
|
||||
viewModel?.endGrayTask(
|
||||
grayId,
|
||||
EndGrayTaskFeedbackType.USABLE_NO,
|
||||
occurrenceTime
|
||||
)
|
||||
}
|
||||
})
|
||||
closeRouting?.show()
|
||||
}
|
||||
|
||||
fun showLeaveStationView() {
|
||||
aciv_task_leave_station_slide_bg.visibility = VISIBLE
|
||||
actv_arriver_station.visibility = GONE
|
||||
actv_complete_task.visibility = GONE
|
||||
}
|
||||
|
||||
override fun showArriverStationAndCompleteTask() {
|
||||
aciv_task_leave_station_slide_bg.visibility = INVISIBLE
|
||||
actv_arriver_station.visibility = VISIBLE
|
||||
actv_complete_task.visibility = VISIBLE
|
||||
}
|
||||
|
||||
fun setData(data: StartGrayAndQueryContrailRsp) {
|
||||
viewModel?.setNewData(data)
|
||||
bus_task_running_line_name.setText(data.grayLineBean.lineName)
|
||||
actv_running_task_last_station.text = "往${data.stationList.last().name ?: ""}"
|
||||
mAdapter.setDataList(data.stationList)
|
||||
showLeaveStationView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 到达目的地
|
||||
*/
|
||||
override fun onArrivedStation() {
|
||||
//
|
||||
showLeaveStationView()
|
||||
loading_arrive_station.visibility = GONE
|
||||
notifyItemChange(0)
|
||||
if (TaskRunningModel.currentIndex == mAdapter.mData.size-1) {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
|
||||
} else {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务完成
|
||||
*/
|
||||
override fun onSubmitEndTaskSuccess() {
|
||||
ToastUtils.showLong("结束任务成功")
|
||||
RoutingServiceManager.invokeCallback(false)
|
||||
// 移除高德导航计算距离
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
swtichViewModel?.showRoutingSelectView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务完成失败
|
||||
*/
|
||||
override fun onSubmitEndTaskFailed(errorStr: String) {
|
||||
ToastUtils.showShort(errorStr)
|
||||
viewModel?.data?.let {
|
||||
swtichViewModel?.showRoutingRunning(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showCompleteTask() {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
|
||||
}
|
||||
|
||||
override fun notifyItemChange(currentIndex: Int) {
|
||||
mAdapter.notifyChange()
|
||||
}
|
||||
}
|
||||
@@ -31,9 +31,9 @@ import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
class TaxiRunningModel : ViewModel(), IDistanceListener {
|
||||
|
||||
private val TAG = RoutingRunningModel::class.java.simpleName
|
||||
private val TAG = TaxiRunningModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: RoutingRuningCallback? = null
|
||||
|
||||
@@ -98,6 +98,9 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
this.currentGrayLineBean = data.grayLineBean
|
||||
this.currentContrailBean = data.contrail
|
||||
this.currentGrayId = data.taskId
|
||||
if(data.stationList.size>=2) {
|
||||
LineManager.setStartAndEndStation(data.stationList[0], data.stationList[1])
|
||||
}
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true)
|
||||
//添加到站监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener)
|
||||
@@ -26,6 +26,7 @@ import com.mogo.och.common.module.map.MapMakerManager
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import com.mogo.och.biz.routing.ui.errorpoint.ReportErrorPointView
|
||||
import com.mogo.och.biz.routing.ui.utils.TimeDistanceUtils
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_end_routing
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_current_itinerary_end_name
|
||||
@@ -37,7 +38,7 @@ import kotlinx.android.synthetic.main.biz_taxi_running.view.goutp_show_routing_i
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.include_empty
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.naviToStart
|
||||
|
||||
class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCallback,
|
||||
class TaxiRunningView: ConstraintLayout, TaxiRunningModel.RoutingRuningCallback,
|
||||
ICommonNaviChangedCallback {
|
||||
|
||||
|
||||
@@ -54,7 +55,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
const val TAG = "RoutingRunningView"
|
||||
}
|
||||
|
||||
private var viewModel: RoutingRunningModel?=null
|
||||
private var viewModel: TaxiRunningModel?=null
|
||||
private var swtichViewModel: RoutingSwitchModel?=null
|
||||
|
||||
private var closeRouting: CommonDialogStatus?=null
|
||||
@@ -190,7 +191,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(RoutingRunningModel::class.java)
|
||||
ViewModelProvider(it).get(TaxiRunningModel::class.java)
|
||||
}
|
||||
swtichViewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 610 B |
Binary file not shown.
|
After Width: | Height: | Size: 261 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 610 B |
Binary file not shown.
|
After Width: | Height: | Size: 261 B |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:state_checked="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_checked="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:state_checked="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_checked="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/common_color_4D000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:endColor="#CC0043FF"
|
||||
android:startColor="#0028345E" />
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_line_selected"/>
|
||||
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_line_normal"/>
|
||||
<item android:drawable="@drawable/bus_switch_line_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/common_color_4D000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/common_80000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
<solid android:color="@color/common_color_4D000000"/>
|
||||
</shape>
|
||||
122
OCH/common/biz/src/main/res/routing/layout/biz_other_running.xml
Normal file
122
OCH/common/biz/src/main/res/routing/layout/biz_other_running.xml
Normal file
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_880"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_height="@dimen/dp_966"
|
||||
tools:background="@drawable/bus_switch_line_normal"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_task_running_line_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_running_task_time"
|
||||
android:layout_marginEnd="@dimen/dp_140"
|
||||
android:layout_marginTop="@dimen/dp_37"
|
||||
android:textColor="@color/white"
|
||||
tools:text="线路名称"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_running_task_last_station"
|
||||
android:textColor="@color/common_B3FFFFFF"
|
||||
android:textSize="@dimen/dp_36"
|
||||
app:layout_constraintStart_toStartOf="@+id/bus_task_running_line_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_task_running_line_name"
|
||||
android:layout_marginTop="@dimen/dp_11"
|
||||
tools:text="往新街口方向"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actv_running_task_time"
|
||||
android:gravity="center"
|
||||
android:layout_marginEnd="@dimen/dp_54"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
tools:text="往新街口方向"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_100">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_submit_task"
|
||||
android:layout_width="@dimen/dp_200"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
app:pressed_enabled="false"
|
||||
android:gravity="center"
|
||||
android:text="问题打点"
|
||||
android:background="@drawable/biz_button_selector"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_40" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rl_running_task_station_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:layout_marginEnd="@dimen/dp_52"
|
||||
app:layout_constraintTop_toBottomOf="@+id/actv_running_task_last_station"
|
||||
app:layout_constraintBottom_toTopOf="@+id/aciv_task_leave_station_slide_bg"
|
||||
android:layout_marginTop="@dimen/dp_22"
|
||||
android:layout_marginBottom="@dimen/dp_46"/>
|
||||
|
||||
<com.mogo.och.common.module.wigets.CommonSlideView
|
||||
android:id="@+id/aciv_task_leave_station_slide_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:assetsfolder="images"
|
||||
app:slide_title="@string/common_leave_station"
|
||||
android:layout_marginBottom="@dimen/dp_46"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_arriver_station"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
android:background="@drawable/bus_running_task_arrive_station_selector"
|
||||
android:layout_marginBottom="@dimen/dp_46"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:text="@string/common_arrive_station"
|
||||
android:layout_width="@dimen/dp_474"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
|
||||
<com.mogo.och.common.module.wigets.loading.LoadingViewSmall
|
||||
android:id="@+id/loading_arrive_station"
|
||||
android:src="@drawable/common_biz_loading_samll"
|
||||
app:layout_constraintTop_toTopOf="@+id/actv_arriver_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/actv_arriver_station"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_arriver_station"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_complete_task"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
android:background="@drawable/bus_running_task_complete_selector"
|
||||
android:layout_marginBottom="@dimen/dp_46"
|
||||
android:layout_marginEnd="@dimen/dp_54"
|
||||
android:text="@string/common_complete"
|
||||
android:layout_width="@dimen/dp_245"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
tools:background="@drawable/bus_switch_line_selector">
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/bg_pass_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head"
|
||||
android:background="@color/common_4DFFFFFF"
|
||||
android:layout_width="@dimen/dp_7"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bg_pass_head_bg"
|
||||
android:layout_marginBottom="@dimen/dp_11"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head_big"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head_big"
|
||||
tools:background="@color/light_prompt_red"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/aciv_station_head_big"
|
||||
android:layout_width="@dimen/dp_7"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bg_pass_bottom_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head_big"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head_big"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/aciv_station_head_big"
|
||||
android:layout_marginTop="@dimen/dp_11"
|
||||
tools:background="@color/light_prompt_red"
|
||||
android:layout_width="@dimen/dp_7"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_station_head"
|
||||
android:src="@drawable/bus_switch_line_adapter_point"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_33"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_station_head_big"
|
||||
android:src="@drawable/bus_runnint_task_start"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_station_head"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_station_head"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_station_name"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/aciv_station_head"
|
||||
android:layout_marginStart="@dimen/dp_36"
|
||||
android:layout_marginEnd="@dimen/dp_36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:text="天安门天安门天安门…"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:ellipsize="end"
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -15,8 +15,16 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mogo.och.biz.routing.ui.runing.taxi.RoutingRunningView
|
||||
android:id="@+id/routingRunningView"
|
||||
<com.mogo.och.biz.routing.ui.runing.taxi.TaxiRunningView
|
||||
android:id="@+id/routingTaxiRunningView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mogo.och.biz.routing.ui.runing.other.TaskRunningView
|
||||
android:id="@+id/routingOtherRunningView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="biz_bus_dialog_tips">您确认要结束任务吗?</string>
|
||||
</resources>
|
||||
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapGlobalTrajectoryDrawManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
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.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
@@ -387,8 +388,8 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
parameters = AutopilotControlParameters()
|
||||
parameters?.routeID = lineInfo.lineId.toInt()
|
||||
parameters?.routeName = lineInfo.lineName
|
||||
parameters?.startName = start.name
|
||||
parameters?.endName = end.name
|
||||
parameters?.startName = start.name?:""
|
||||
parameters?.endName = end.name?:""
|
||||
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon)
|
||||
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon)
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
@@ -418,85 +419,78 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
)
|
||||
}
|
||||
|
||||
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
|
||||
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
|
||||
if(endStation?.passPoints?.isNotEmpty() == true &&
|
||||
endStation?.blackPoints?.isNotEmpty() == true){
|
||||
val (wayLatLons, blackLatLons) = endStation!!.getWayBlackLatLons()
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
CallerLogger.d(TAG,"从站点获取经停点和禁行点")
|
||||
}else{
|
||||
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
CallerLogger.d(TAG,"从轨迹获取经停点和禁行点")
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG,"${parameters?.wayLatLons}\n${parameters?.blackLatLons}")
|
||||
if (parameters == null) {
|
||||
ToastUtils.showShort("未设置起始或终点站点")
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
|
||||
fun getWayBlackLatLons(
|
||||
passPoints: MutableList<BusStationBean>?,
|
||||
blackPoints: MutableList<BusStationBean>?
|
||||
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
|
||||
val wayLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 途经点
|
||||
if (!passPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in passPoints) {
|
||||
wayLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
fun initAutopilotControlParametersFromContrai(): AutopilotControlParameters? {
|
||||
var parameters: AutopilotControlParameters? = null
|
||||
getStationsWithLine { start, end, lineInfo ->
|
||||
this.autopilotId = "${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
|
||||
this.teleOrderId = lineInfo.genAutopilotId()
|
||||
}
|
||||
getStationsWithLineAndContrai { start, end, lineInfo, contrai ->
|
||||
parameters = AutopilotControlParameters()
|
||||
parameters?.routeID = lineInfo.lineId.toInt()
|
||||
parameters?.routeName = lineInfo.lineName
|
||||
parameters?.startName = start.name?:""
|
||||
parameters?.endName = end.name?:""
|
||||
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon)
|
||||
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon)
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
parameters?.vehicleType = 9
|
||||
}else{
|
||||
parameters?.vehicleType = 10
|
||||
}
|
||||
parameters?.orderId = this.teleOrderId
|
||||
parameters?.firstStationFlag = autopilotFlag
|
||||
parameters?.firstAutopilotFlag = teleIsFirstStartAutopilot
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
if (parameters?.autoPilotLine == null) {
|
||||
parameters?.autoPilotLine = AutoPilotLine(
|
||||
lineInfo.lineId,
|
||||
lineInfo.lineName,
|
||||
contrai.csvFileUrl,
|
||||
contrai.csvFileMd5,
|
||||
contrai.txtFileUrl,
|
||||
contrai.txtFileMd5,
|
||||
contrai.contrailSaveTime,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0L
|
||||
)
|
||||
}
|
||||
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
CallerLogger.d(TAG,"从轨迹获取经停点和禁行点")
|
||||
}
|
||||
val blackLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 黑名单点
|
||||
if (!blackPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in blackPoints) {
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lat,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
if (parameters == null) {
|
||||
ToastUtils.showShort("未设置起始或终点站点")
|
||||
}
|
||||
return Pair(wayLatLons,blackLatLons)
|
||||
return parameters
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 启动自动驾驶
|
||||
fun startAutopilot() {
|
||||
|
||||
@@ -583,7 +577,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
private fun triggerUnableStartAPReasonEvent() {
|
||||
getStationsWithLine { start, end, line ->
|
||||
OchAutopilotAnalytics.triggerUnableStartAPReasonEvent(
|
||||
start.name, end.name,line.lineId.toString() , "",
|
||||
start.name?:"", end.name?:"",line.lineId.toString() , "",
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
)
|
||||
}
|
||||
@@ -599,8 +593,8 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
OchAutopilotAnalytics.triggerStartAutopilotEvent(
|
||||
isFirstStartAutopilot,
|
||||
send,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
lineInfo.lineId.toInt(),
|
||||
"",
|
||||
System.currentTimeMillis(),
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
|
||||
<string name="common_dialog_goback">返回</string>
|
||||
|
||||
<string name="common_leave_station">滑动出发</string>
|
||||
<string name="common_arrive_station">到站</string>
|
||||
<string name="common_complete">结束</string>
|
||||
|
||||
<string name="common_start_task_after_upload_success">请等待升级完成后再选择任务</string>
|
||||
|
||||
|
||||
|
||||
@@ -1,191 +1,84 @@
|
||||
package com.mogo.och.data.bean;
|
||||
package com.mogo.och.data.bean
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import java.util.Objects
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusStationBean {
|
||||
private int siteId;
|
||||
@SerializedName(value = "name",alternate = {"siteName"})
|
||||
private String name;
|
||||
private String nameKr;
|
||||
private int seq;
|
||||
private double gcjLon; //高德
|
||||
private double gcjLat; //高德
|
||||
@SerializedName(value = "lon",alternate = {"wgs84Lon"})
|
||||
private double lon; //高精坐标
|
||||
@SerializedName(value = "lat",alternate = {"wgs84Lat"})
|
||||
private double lat; //高精坐标
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private boolean leaving;// 为出发false 出发true
|
||||
private String introduction;// 站点简介
|
||||
private boolean isPlayTts;
|
||||
private int pointType; // 1:途径点 2:禁行点 3:站点
|
||||
private List<SiteIntroduce> videoList;
|
||||
open class BusStationBean {
|
||||
var siteId: Int = 0
|
||||
|
||||
public String getNameKr() {
|
||||
return nameKr;
|
||||
@JvmField
|
||||
@SerializedName(value = "name", alternate = ["siteName"])
|
||||
var name: String? = null
|
||||
var nameKr: String? = null
|
||||
var seq: Int = 0
|
||||
@JvmField
|
||||
var gcjLon: Double = 0.0 //高德
|
||||
@JvmField
|
||||
var gcjLat: Double = 0.0 //高德
|
||||
|
||||
@SerializedName(value = "lon", alternate = ["wgs84Lon"])
|
||||
var lon: Double = 0.0 //高精坐标
|
||||
|
||||
@SerializedName(value = "lat", alternate = ["wgs84Lat"])
|
||||
var lat: Double = 0.0 //高精坐标
|
||||
@JvmField
|
||||
var drivingStatus: Int = 0 //行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
var isLeaving: Boolean = false // 为出发false 出发true
|
||||
var introduction: String? = null // 站点简介
|
||||
var isPlayTts: Boolean = false
|
||||
var pointType: Int = 0 // 1:途径点 2:禁行点 3:站点
|
||||
var videoList: List<SiteIntroduce>? = null
|
||||
|
||||
var passPoints: List<BusStationBean>? = null // 用于算路的经停点
|
||||
var blackPoints: List<BusStationBean>? = null // 用于算路的黑名單點
|
||||
|
||||
|
||||
override fun equals(o: Any?): Boolean {
|
||||
if (this === o) return true
|
||||
if (o == null || javaClass != o.javaClass) return false
|
||||
|
||||
val that = o as BusStationBean
|
||||
return siteId == that.siteId && seq == that.seq && java.lang.Double.compare(
|
||||
gcjLon,
|
||||
that.gcjLon
|
||||
) == 0 && java.lang.Double.compare(
|
||||
gcjLat,
|
||||
that.gcjLat
|
||||
) == 0 && java.lang.Double.compare(lon, that.lon) == 0 && java.lang.Double.compare(
|
||||
lat,
|
||||
that.lat
|
||||
) == 0 && drivingStatus == that.drivingStatus && isLeaving == that.isLeaving && isPlayTts == that.isPlayTts && pointType == that.pointType && name == that.name
|
||||
&& nameKr == that.nameKr
|
||||
&& introduction == that.introduction
|
||||
&& videoList == that.videoList
|
||||
}
|
||||
|
||||
public void setNameKr(String nameKr) {
|
||||
this.nameKr = nameKr;
|
||||
override fun hashCode(): Int {
|
||||
var result = siteId
|
||||
result = 31 * result + Objects.hashCode(name)
|
||||
result = 31 * result + Objects.hashCode(nameKr)
|
||||
result = 31 * result + seq
|
||||
result = 31 * result + java.lang.Double.hashCode(gcjLon)
|
||||
result = 31 * result + java.lang.Double.hashCode(gcjLat)
|
||||
result = 31 * result + java.lang.Double.hashCode(lon)
|
||||
result = 31 * result + java.lang.Double.hashCode(lat)
|
||||
result = 31 * result + drivingStatus
|
||||
result = 31 * result + java.lang.Boolean.hashCode(isLeaving)
|
||||
result = 31 * result + Objects.hashCode(introduction)
|
||||
result = 31 * result + java.lang.Boolean.hashCode(isPlayTts)
|
||||
result = 31 * result + pointType
|
||||
result = 31 * result + Objects.hashCode(videoList)
|
||||
return result
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setGcjLon(double gcjLon) {
|
||||
this.gcjLon = gcjLon;
|
||||
}
|
||||
|
||||
public void setGcjLat(double gcjLat) {
|
||||
this.gcjLat = gcjLat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
public String getIntroduction() {
|
||||
return introduction;
|
||||
}
|
||||
|
||||
public void setIntroduction(String introduction) {
|
||||
this.introduction = introduction;
|
||||
}
|
||||
|
||||
public boolean isPlayTts() {
|
||||
return isPlayTts;
|
||||
}
|
||||
|
||||
public void setPlayTts(boolean playTts) {
|
||||
isPlayTts = playTts;
|
||||
}
|
||||
|
||||
public List<SiteIntroduce> getVideoList() {
|
||||
return videoList;
|
||||
}
|
||||
|
||||
public void setVideoList(List<SiteIntroduce> videoList) {
|
||||
this.videoList = videoList;
|
||||
}
|
||||
|
||||
public int getPointType() {
|
||||
return pointType;
|
||||
}
|
||||
|
||||
public void setPointType(int pointType) {
|
||||
this.pointType = pointType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
BusStationBean that = (BusStationBean) o;
|
||||
return siteId == that.siteId
|
||||
&& seq == that.seq
|
||||
&& Double.compare(gcjLon, that.gcjLon) == 0
|
||||
&& Double.compare(gcjLat, that.gcjLat) == 0
|
||||
&& Double.compare(lon, that.lon) == 0
|
||||
&& Double.compare(lat, that.lat) == 0
|
||||
&& drivingStatus == that.drivingStatus
|
||||
&& leaving == that.leaving && isPlayTts == that.isPlayTts
|
||||
&& pointType == that.pointType
|
||||
&& Objects.equals(name, that.name)
|
||||
&& Objects.equals(nameKr, that.nameKr)
|
||||
&& Objects.equals(introduction, that.introduction)
|
||||
&& Objects.equals(videoList, that.videoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = siteId;
|
||||
result = 31 * result + Objects.hashCode(name);
|
||||
result = 31 * result + Objects.hashCode(nameKr);
|
||||
result = 31 * result + seq;
|
||||
result = 31 * result + Double.hashCode(gcjLon);
|
||||
result = 31 * result + Double.hashCode(gcjLat);
|
||||
result = 31 * result + Double.hashCode(lon);
|
||||
result = 31 * result + Double.hashCode(lat);
|
||||
result = 31 * result + drivingStatus;
|
||||
result = 31 * result + Boolean.hashCode(leaving);
|
||||
result = 31 * result + Objects.hashCode(introduction);
|
||||
result = 31 * result + Boolean.hashCode(isPlayTts);
|
||||
result = 31 * result + pointType;
|
||||
result = 31 * result + Objects.hashCode(videoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
override fun toString(): String {
|
||||
return "BusStationBean{" +
|
||||
"siteId=" + siteId +
|
||||
", name='" + name + '\'' +
|
||||
@@ -196,19 +89,81 @@ public class BusStationBean {
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", leaving=" + leaving +
|
||||
", leaving=" + isLeaving +
|
||||
", introduction='" + introduction + '\'' +
|
||||
", isPlayTts=" + isPlayTts +
|
||||
", pointType=" + pointType +
|
||||
", videoList=" + videoList +
|
||||
'}';
|
||||
'}'
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public MogoLocation toMogoLocation() {
|
||||
MogoLocation result = new MogoLocation();
|
||||
result.setLatitude(gcjLat);
|
||||
result.setLongitude(gcjLon);
|
||||
return result;
|
||||
fun toMogoLocation(): MogoLocation {
|
||||
val result = MogoLocation()
|
||||
result.latitude = gcjLat
|
||||
result.longitude = gcjLon
|
||||
return result
|
||||
}
|
||||
|
||||
fun getWayBlackLatLons(
|
||||
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
|
||||
val wayLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 途经点
|
||||
if (!passPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in passPoints!!) {
|
||||
wayLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val blackLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 黑名单点
|
||||
if (!blackPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in blackPoints!!) {
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
return Pair(wayLatLons,blackLatLons)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ data class ContraiInfo(
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
|
||||
@@ -82,8 +82,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.LEAVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation() == true
|
||||
)
|
||||
}
|
||||
@@ -100,8 +100,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.ARRIVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation(end)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.LEAVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation() == true
|
||||
)
|
||||
}
|
||||
@@ -109,8 +109,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.ARRIVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation(end)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public class BusPassengerRouteFragment extends
|
||||
* @param isArrived 是否到站并离开,true 到达当前站 currentStationIndex 未离开, false 正在前往此站 currentStationIndex
|
||||
*/
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
updateArrivedStation(stations.get(currentStationIndex).getName(),currentStationIndex,isArrived);
|
||||
updateArrivedStation(stations.get(currentStationIndex).name,currentStationIndex,isArrived);
|
||||
mStationsList.clear();
|
||||
mStationsList.addAll(stations);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
@@ -225,7 +225,7 @@ public class BusPassengerRouteFragment extends
|
||||
private void updateWayPointList(List<BusStationBean> stations,int currentStationIndex) {
|
||||
List<LatLng> mLineStationsList = new ArrayList<>();
|
||||
for (int i = 0; i< stations.size(); i++) {//站点集合
|
||||
LatLng latLng = new LatLng(stations.get(i).getGcjLat(),stations.get(i).getGcjLon());// lat,lon
|
||||
LatLng latLng = new LatLng(stations.get(i).gcjLat, stations.get(i).gcjLon);// lat,lon
|
||||
mLineStationsList.add(latLng);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
BusStationBean station = mStations.get(position);
|
||||
StationViewHolder viewHolder = (StationViewHolder)holder;
|
||||
viewHolder.stationName.setText(station.getName());
|
||||
viewHolder.stationName.setText(station.name);
|
||||
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
|
||||
if (position == 0){ //第一个 起点
|
||||
viewHolder.curArrowBg.setVisibility(View.GONE);
|
||||
viewHolder.curArrowBottomBg.setVisibility(View.VISIBLE);
|
||||
Log.d("onBindViewHolder" , "position0 = "+position);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.shuttle_p_jl_bg_start_tag_bg);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//到达未离开
|
||||
if (station.drivingStatus == STATION_STATUS_STOPPED && !station.isLeaving()){//到达未离开
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.shuttle_p_jl_clock_17417B));
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
||||
@@ -69,15 +69,15 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
viewHolder.curArrowBg.setVisibility(View.VISIBLE);
|
||||
viewHolder.curArrowBottomBg.setVisibility(View.VISIBLE);
|
||||
BusStationBean preStation = mStations.get(position -1);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_LEAVING ||
|
||||
(station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving())){ //过站
|
||||
if (station.drivingStatus == STATION_STATUS_LEAVING ||
|
||||
(station.drivingStatus == STATION_STATUS_STOPPED && station.isLeaving())){ //过站
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.shuttle_p_jl_clock_992D3E5F));
|
||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_A9B6CA));
|
||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_A9B6CA));
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.shuttle_p_jl_point_gray);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.END);
|
||||
Log.d("onBindViewHolder" , "position 1 = "+position);
|
||||
} else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//刚到站未离开的
|
||||
} else if (station.drivingStatus == STATION_STATUS_STOPPED && !station.isLeaving()){//刚到站未离开的
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.shuttle_p_jl_clock_17417B));
|
||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_A9B6CA));
|
||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_1F82FB));
|
||||
@@ -89,7 +89,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
Log.d("onBindViewHolder" , "position2 = "+position);
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING && preStation.isLeaving()){//即将到站
|
||||
}else if (station.drivingStatus == STATION_STATUS_ARRIVING && preStation.isLeaving()){//即将到站
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.shuttle_p_jl_panel_cur_station_tips_color));
|
||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_A9B6CA));
|
||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_1F82FB));
|
||||
@@ -100,9 +100,9 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
viewHolder.curArrowBottomBg.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING &&
|
||||
(preStation.getDrivingStatus() == STATION_STATUS_ARRIVING
|
||||
|| preStation.getDrivingStatus() == STATION_STATUS_STOPPED)){ //未到站的并且前面也是未到站或者刚到站的
|
||||
}else if (station.drivingStatus == STATION_STATUS_ARRIVING &&
|
||||
(preStation.drivingStatus == STATION_STATUS_ARRIVING
|
||||
|| preStation.drivingStatus == STATION_STATUS_STOPPED)){ //未到站的并且前面也是未到站或者刚到站的
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.shuttle_p_jl_panel_cur_station_tips_color));
|
||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_1F82FB));
|
||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.shuttle_p_jl_clock_1F82FB));
|
||||
|
||||
@@ -40,6 +40,6 @@ data class StartServiceRespBeans(var data:List<StartStationBean>):BaseData()
|
||||
|
||||
data class StartStationBean(var distance2Current:Float):BusStationBean() {
|
||||
fun toResult(): StartServiceRespBean.Result {
|
||||
return StartServiceRespBean.Result(siteId.toLong(),name,gcjLat,gcjLon,lon,lat)
|
||||
return StartServiceRespBean.Result(siteId.toLong(),name?:"",gcjLat,gcjLon,lon,lat)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user