[m1]
[1.1.2] [页面逻辑]
This commit is contained in:
@@ -187,7 +187,6 @@ object CharterPassengerModel {
|
||||
"onAutopilotRotting = ${GsonUtil.jsonFromObject(globalPathResp)}"
|
||||
)
|
||||
globalPathResp?.wayPointsList?.let {
|
||||
// todo 启动路距计算
|
||||
startCalculateDistanceLoop()
|
||||
}
|
||||
}
|
||||
@@ -355,7 +354,6 @@ object CharterPassengerModel {
|
||||
orderInfo = null
|
||||
locusInfo = null
|
||||
if (data.businessStatus == 2) {// 订单结束 没有还车
|
||||
// todo 还车中 需要显示 @com.mogo.och.bus.passenger.ui.view.EndOrderView 页面
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUse)
|
||||
} else {
|
||||
// 车辆空闲 订单结束已经还车
|
||||
@@ -434,7 +432,7 @@ object CharterPassengerModel {
|
||||
* 查询车辆状态 判断订单是否结束、是否显示结束业务
|
||||
*/
|
||||
private fun calculateDistance() {
|
||||
|
||||
// TODO: 启动轨迹计算
|
||||
}
|
||||
// endregion
|
||||
|
||||
|
||||
@@ -27,16 +27,11 @@ class BusPassengerFunctionDevicePresenter(view: M1DeviceFragment?) :
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
OCHM1LightAirconditionDoorStatusManager.addListener(TAG, this)
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG,object :
|
||||
IBusPassengerControllerStatusCallback{
|
||||
|
||||
override fun onCarLocationChanged(location: MogoLocation?) {
|
||||
location?.let {
|
||||
gnssSpeed = it.gnssInfo.vehicleSpeed
|
||||
}
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG) { location ->
|
||||
location?.let {
|
||||
gnssSpeed = it.gnssInfo.vehicleSpeed
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
|
||||
@@ -16,11 +16,14 @@ import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.LoopInfo
|
||||
import com.mogo.och.bus.passenger.bean.response.LineInfoListResponse
|
||||
import com.mogo.och.bus.passenger.bean.response.LineInfoResponse
|
||||
import com.mogo.och.bus.passenger.bean.response.SiteInfoResponse
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.bus.passenger.net.BusPassengerModelLoopManager
|
||||
import com.mogo.och.bus.passenger.net.BusPassengerServiceManager
|
||||
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionDevicePresenter
|
||||
import com.mogo.och.bus.passenger.ui.adapter.OrderLineItemAdapter
|
||||
import com.mogo.och.bus.passenger.ui.adapter.OrderSiteItemAdapter
|
||||
import com.mogo.och.bus.passenger.view.BottomDecoration
|
||||
@@ -38,6 +41,8 @@ class LineSiteView @JvmOverloads constructor(
|
||||
|
||||
companion object{
|
||||
const val TAG = "LineSiteView"
|
||||
const val TAGLINELOOP = "LineSiteViewLineLoop"
|
||||
const val TAGSITELOOP = "LineSiteViewSiteLoop"
|
||||
}
|
||||
|
||||
private var checkLine: LineInfoResponse.LineInfo?=null
|
||||
@@ -54,6 +59,8 @@ class LineSiteView @JvmOverloads constructor(
|
||||
private var lineAdapter: OrderLineItemAdapter
|
||||
private var siteAdapter: OrderSiteItemAdapter
|
||||
|
||||
private var gnssSpeed =0.0
|
||||
|
||||
private val loadingAni = ObjectAnimator.ofFloat(iv_loading_wait_driver, "rotation", 0f, 90f ,180f, 270f, 360f).apply {
|
||||
repeatCount = -1
|
||||
interpolator = LinearInterpolator()
|
||||
@@ -86,14 +93,27 @@ class LineSiteView @JvmOverloads constructor(
|
||||
checkLine?.let {
|
||||
querySitesByLineId(it.lineId.toString())
|
||||
}
|
||||
setViewOrdeWithLine(true)
|
||||
}else{
|
||||
queryLineList()
|
||||
setViewOrdeWithLine(false)
|
||||
}
|
||||
|
||||
initListener()
|
||||
|
||||
}
|
||||
|
||||
private fun setViewOrdeWithLine(enable:Boolean) {
|
||||
tv_switch_line.isEnabled = enable
|
||||
if(enable) {
|
||||
gl_line_cancle_submit_guide.visibility = View.GONE
|
||||
g_side_cancle_submit_group.visibility = View.GONE
|
||||
}else{
|
||||
gl_line_cancle_submit_guide.visibility = View.VISIBLE
|
||||
g_side_cancle_submit_group.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
lineAdapter.checkChangeListener = object :OrderLineItemAdapter.CheckListener{
|
||||
override fun onCheckListener(lineInfo: LineInfoResponse.LineInfo) {
|
||||
@@ -118,6 +138,10 @@ class LineSiteView @JvmOverloads constructor(
|
||||
ToastUtils.showLong("请选择线路")
|
||||
return@onClick
|
||||
}
|
||||
if(!CallerTelematicManager.getClientConnStatus()){
|
||||
ToastUtils.showLong("乘客屏无法连接司机屏请联系安全员")
|
||||
return@onClick
|
||||
}
|
||||
tempCheckLine?.let {
|
||||
val msg = ChangeDestMsg(
|
||||
it.lineId!!.toInt(),
|
||||
@@ -132,8 +156,10 @@ class LineSiteView @JvmOverloads constructor(
|
||||
TelematicConstant.BUSINESS_STRING,
|
||||
GsonUtils.toJson(msg).toByteArray()
|
||||
)
|
||||
startAni()
|
||||
// 启动查看和司机端链接
|
||||
BusPassengerModelLoopManager.setLoopFunction(TAGLINELOOP, LoopInfo(3,::checkServerStatus))
|
||||
}
|
||||
startAni()
|
||||
}
|
||||
tv_site_cancle.onClick {
|
||||
ToastUtils.showLong("取消切换")
|
||||
@@ -143,6 +169,10 @@ class LineSiteView @JvmOverloads constructor(
|
||||
ToastUtils.showLong("请选择站点")
|
||||
return@onClick
|
||||
}
|
||||
if(!CallerTelematicManager.getClientConnStatus()){
|
||||
ToastUtils.showLong("乘客屏无法连接司机屏请联系安全员")
|
||||
return@onClick
|
||||
}
|
||||
checkLine?.let {lineInfo->
|
||||
tempCheckSite?.let {siteInfo->
|
||||
val msg = ChangeDestMsg(
|
||||
@@ -159,8 +189,10 @@ class LineSiteView @JvmOverloads constructor(
|
||||
GsonUtils.toJson(msg).toByteArray()
|
||||
)
|
||||
}
|
||||
startAni()
|
||||
// 启动查看和司机端链接
|
||||
BusPassengerModelLoopManager.setLoopFunction(TAGLINELOOP, LoopInfo(3,::checkServerStatus))
|
||||
}
|
||||
startAni()
|
||||
}
|
||||
tv_switch_line.onClick {
|
||||
ToastUtils.showLong("判断速度是否为0,开始查询线路信息")
|
||||
@@ -169,24 +201,52 @@ class LineSiteView @JvmOverloads constructor(
|
||||
endAni()
|
||||
}
|
||||
|
||||
CallerTelematicListenerManager.addListener(TAG,object : IReceivedMsgListener{
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
if(type==TelematicConstant.BUSINESS_STRING){
|
||||
val msg = GsonUtils.fromJson(String(byteArray),
|
||||
ChangeDestMsg::class.java) as ChangeDestMsg
|
||||
if(msg.type==DPMsgType.TYPE_CHANGE_DEST.type){
|
||||
if(msg.destSiteId==0){
|
||||
// TODO: 选择线路结束
|
||||
ToastUtils.showShort("线路确定")
|
||||
}else{
|
||||
// TODO: 选择站点结束
|
||||
ToastUtils.showShort("站点确定")
|
||||
CallerTelematicListenerManager.addListener(TAG,msgReceived)
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG) { location ->
|
||||
location?.let {
|
||||
gnssSpeed = it.gnssInfo.vehicleSpeed
|
||||
}
|
||||
}
|
||||
tv_switch_line.onClick {
|
||||
if(gnssSpeed<0.01){
|
||||
// 可以切换路径
|
||||
gl_line_cancle_submit_guide.visibility = View.VISIBLE
|
||||
}else{
|
||||
ToastUtils.showShort("请停车后再修改目的地~")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收司机屏反馈信息
|
||||
*/
|
||||
val msgReceived = object : IReceivedMsgListener{
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
if(type==TelematicConstant.BUSINESS_STRING){
|
||||
val msg = GsonUtils.fromJson(String(byteArray),
|
||||
ChangeDestMsg::class.java) as ChangeDestMsg
|
||||
if(msg.type==DPMsgType.TYPE_CHANGE_DEST.type){
|
||||
if(msg.destSiteId==0){
|
||||
// TODO: 选择线路结束
|
||||
ToastUtils.showShort("线路确定")
|
||||
gl_line_cancle_submit_guide.visibility = View.GONE
|
||||
g_side_cancle_submit_group.visibility = View.VISIBLE
|
||||
if(checkLine!=null) {
|
||||
lineList.clear()
|
||||
lineList.add(checkLine!!)
|
||||
lineAdapter.notifyDataSetChanged()
|
||||
}
|
||||
endAni()
|
||||
BusPassengerModelLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
}else{
|
||||
// TODO: 选择站点结束
|
||||
ToastUtils.showShort("站点确定")
|
||||
g_side_cancle_submit_group.visibility = View.GONE
|
||||
gl_line_cancle_submit_guide.visibility = View.GONE
|
||||
}
|
||||
endAni()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun startAni(){
|
||||
@@ -205,6 +265,10 @@ class LineSiteView @JvmOverloads constructor(
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
loadingAni.cancel()
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
BusPassengerModelLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG,null)
|
||||
|
||||
}
|
||||
|
||||
private fun queryLineList() {
|
||||
@@ -221,6 +285,14 @@ class LineSiteView @JvmOverloads constructor(
|
||||
})
|
||||
}
|
||||
|
||||
private fun checkServerStatus(){
|
||||
if (!CallerTelematicManager.getClientConnStatus()) {
|
||||
ToastUtils.showShort("断开和司机端连接、请联系安全员")
|
||||
BusPassengerModelLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
endAni()
|
||||
}
|
||||
}
|
||||
|
||||
private fun querySitesByLineId(lineId:String) {
|
||||
BusPassengerServiceManager.queryLineSiteList(context,lineId,object :OchCommonServiceCallback<SiteInfoResponse>{
|
||||
override fun onSuccess(data: SiteInfoResponse?) {
|
||||
|
||||
Reference in New Issue
Block a user