[m1]
[1.1.2] [根据不同状态展示不同页面]
This commit is contained in:
@@ -65,6 +65,10 @@ object CharterPassengerModel {
|
||||
// 轨迹信息 用来启动自动驾驶
|
||||
private var locusInfo: LocusResponse.LocusInfo? = null
|
||||
|
||||
private var orderStatus:OrderStatusEnum = OrderStatusEnum.NoOrderUnuse
|
||||
|
||||
private var orderStatusChangeListener:IOrderStatusChangeListener?=null
|
||||
|
||||
fun init() {
|
||||
initListeners()
|
||||
queryLoginStatus()
|
||||
@@ -72,7 +76,6 @@ object CharterPassengerModel {
|
||||
|
||||
fun release() {
|
||||
releaseListeners()
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
}
|
||||
|
||||
private fun releaseListeners() {
|
||||
@@ -189,6 +192,12 @@ object CharterPassengerModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
fun setStatusChangeListener(orderStatusChangeListener:IOrderStatusChangeListener?){
|
||||
this.orderStatusChangeListener = orderStatusChangeListener
|
||||
}
|
||||
fun getCurrentOrderStatus():OrderStatusEnum{
|
||||
return this.orderStatus
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region 登录状态逻辑
|
||||
@@ -257,12 +266,14 @@ object CharterPassengerModel {
|
||||
*/
|
||||
fun ordrLagic(orderData: OrderInfoResponse.OrderInfo) {
|
||||
if (orderData.orderNo == null) {
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUnuse)
|
||||
return
|
||||
}
|
||||
// 有订单有线路后结束轮训
|
||||
orderData.let { order ->
|
||||
if (order.lineId == null || order.lineId == 0L || order.siteId == null || order.siteId == 0L) {
|
||||
// 去选线路和站点
|
||||
setOrderStatus(OrderStatusEnum.OrderNoLine)
|
||||
} else {
|
||||
this.orderInfo = orderData
|
||||
// 有订单取消轮训
|
||||
@@ -270,6 +281,7 @@ object CharterPassengerModel {
|
||||
// 已经选择线路和终点、恢复现场数据
|
||||
// 启动车辆服务状态
|
||||
startCarStatusLoop()
|
||||
setOrderStatus(OrderStatusEnum.OrdersWithLine)
|
||||
// 启动时间校准
|
||||
startCalibrationLoop()
|
||||
// 查询自动驾驶轨迹
|
||||
@@ -344,10 +356,12 @@ object CharterPassengerModel {
|
||||
locusInfo = null
|
||||
if (data.businessStatus == 2) {// 订单结束 没有还车
|
||||
// todo 还车中 需要显示 @com.mogo.och.bus.passenger.ui.view.EndOrderView 页面
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUse)
|
||||
} else {
|
||||
// 车辆空闲 订单结束已经还车
|
||||
// 结束车态轮训
|
||||
endCarStatusLoop()
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUnuse)
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
@@ -424,16 +438,12 @@ object CharterPassengerModel {
|
||||
}
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 开始轮询计算剩余里程和时间
|
||||
* @param isStart
|
||||
*/
|
||||
private fun startOrStopCalculateRouteInfo(isStart: Boolean) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "startOrStopCalculateRouteInfo() $isStart")
|
||||
if (isStart) {
|
||||
// BusPassengerModelLoopManager.startCalculateRouteInfoLoop()
|
||||
} else {
|
||||
// BusPassengerModelLoopManager.stopCalculateRouteInfLoop()
|
||||
|
||||
private fun setOrderStatus(orderStatus: OrderStatusEnum) {
|
||||
if(this.orderStatus!=orderStatus) {
|
||||
this.orderStatus = orderStatus
|
||||
orderStatusChangeListener?.onStatusChange(this.orderStatus)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ enum class OrderStatusEnum(val code: Int) {
|
||||
OrdersWithLine( 20), //有订单有线路 m1_order_lineside 选择线路页面隐藏掉确定取消
|
||||
NoOrderUse( 30),; //无订单车不闲置 m1_order_end.xml 开门关门页面
|
||||
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOf(code: Int): OrderStatusEnum? {
|
||||
@@ -25,4 +26,8 @@ enum class OrderStatusEnum(val code: Int) {
|
||||
return NoOrderUnuse
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface IOrderStatusChangeListener {
|
||||
fun onStatusChange(currentStatus:OrderStatusEnum)
|
||||
}
|
||||
@@ -1,6 +1,30 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.bus.passenger.model.IOrderStatusChangeListener
|
||||
import com.mogo.och.bus.passenger.model.OrderStatusEnum
|
||||
import com.mogo.och.bus.passenger.ui.M1OrderFragment
|
||||
|
||||
class BusPassengerFunctionOrderPresenter(view: M1OrderFragment?) :
|
||||
BusBasePassengerFunctionDevicePresenter<M1OrderFragment?>(view)
|
||||
BusBasePassengerFunctionDevicePresenter<M1OrderFragment?>(view), IOrderStatusChangeListener {
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
CharterPassengerModel.setStatusChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onResume(owner: LifecycleOwner) {
|
||||
super.onResume(owner)
|
||||
mView?.setViewByOrderStatus(CharterPassengerModel.getCurrentOrderStatus())
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
CharterPassengerModel.setStatusChangeListener(null)
|
||||
}
|
||||
override fun onStatusChange(currentStatus: OrderStatusEnum) {
|
||||
mView?.setViewByOrderStatus(currentStatus)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.TaxiPassengerVideoPlay
|
||||
import com.mogo.och.bus.passenger.model.OrderStatusEnum
|
||||
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionOrderPresenter
|
||||
import kotlinx.android.synthetic.m1.m1_order_fragment.*
|
||||
|
||||
/**
|
||||
* @author: yangyakun
|
||||
@@ -27,6 +30,39 @@ class M1OrderFragment :
|
||||
|
||||
}
|
||||
|
||||
fun setViewByOrderStatus(currentStatus: OrderStatusEnum){
|
||||
when (currentStatus) {
|
||||
OrderStatusEnum.NoOrderUnuse -> {
|
||||
// 无订单页面
|
||||
m1_order_noorder.visibility = View.VISIBLE
|
||||
m1_order_early_end.visibility = View.GONE
|
||||
eov_end_order.visibility = View.GONE
|
||||
lsv_line_site.visibility = View.GONE
|
||||
}
|
||||
OrderStatusEnum.OrderNoLine -> {
|
||||
// 选择线路页面
|
||||
m1_order_noorder.visibility = View.GONE
|
||||
m1_order_early_end.visibility = View.GONE
|
||||
eov_end_order.visibility = View.GONE
|
||||
lsv_line_site.visibility = View.VISIBLE
|
||||
}
|
||||
OrderStatusEnum.OrdersWithLine -> {
|
||||
// 选择线路页面
|
||||
m1_order_noorder.visibility = View.GONE
|
||||
m1_order_early_end.visibility = View.GONE
|
||||
eov_end_order.visibility = View.GONE
|
||||
lsv_line_site.visibility = View.VISIBLE
|
||||
}
|
||||
OrderStatusEnum.NoOrderUse -> {
|
||||
// 开门关门页面
|
||||
m1_order_noorder.visibility = View.GONE
|
||||
m1_order_early_end.visibility = View.VISIBLE
|
||||
eov_end_order.visibility = View.GONE
|
||||
lsv_line_site.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun createPresenter(): BusPassengerFunctionOrderPresenter {
|
||||
return BusPassengerFunctionOrderPresenter(this)
|
||||
}
|
||||
|
||||
@@ -18,17 +18,24 @@
|
||||
app:layout_constraintWidth_percent="0.53698">
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.view.LineSiteView
|
||||
android:id="@+id/lsv_line_site"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.view.EndOrderView
|
||||
android:id="@+id/eov_end_order"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/m1_order_early_end"
|
||||
android:visibility="gone"
|
||||
layout="@layout/m1_order_early_end"/>
|
||||
<include
|
||||
android:id="@+id/m1_order_noorder"
|
||||
android:visibility="gone"
|
||||
layout="@layout/m1_order_noorder"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user