[6.0.0] 启动动画效果, 轨迹预加载
This commit is contained in:
@@ -13,8 +13,10 @@ import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper
|
||||
import kotlinx.android.synthetic.main.start_autopilot_animation_view.view.startAutopilotTip
|
||||
import kotlinx.android.synthetic.main.start_autopilot_animation_view.view.startAutopilotTipImg
|
||||
import java.lang.Exception
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
|
||||
@@ -30,6 +32,7 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private var startTimer: CountDownTimer? = null
|
||||
private val mContext: Context
|
||||
|
||||
private val closeWarningTask: Runnable = Runnable {
|
||||
showWarning(DirectionEnum.ALERT_WARNING_NON)
|
||||
@@ -38,9 +41,18 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
private val oldDirection = AtomicReference<DirectionEnum>()
|
||||
|
||||
init {
|
||||
mContext = context
|
||||
LayoutInflater.from(context).inflate(R.layout.start_autopilot_animation_view, this, true)
|
||||
}
|
||||
|
||||
fun playDI(){
|
||||
try {
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(mContext , R.raw.startautopilot)
|
||||
}catch (e: Exception){
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
}
|
||||
@@ -132,7 +144,7 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
1)
|
||||
}
|
||||
|
||||
fun countDownTimer() {
|
||||
private fun countDownTimer() {
|
||||
|
||||
startTimer = object : CountDownTimer(ALL_CLOSE_TIMER, 1000L) {// 5倒计时后开启自驾
|
||||
|
||||
@@ -140,6 +152,7 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
// 倒计时
|
||||
startAutopilotTip.text = "${(millisUntilFinished/1000).toInt()} 车辆即将自动开启自动驾驶"
|
||||
playDI()
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
@@ -150,4 +163,5 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
|
||||
startTimer?.start()
|
||||
}
|
||||
|
||||
}
|
||||
BIN
OCH/mogo-och-common-module/src/main/res/raw/startautopilot.wav
Normal file
BIN
OCH/mogo-och-common-module/src/main/res/raw/startautopilot.wav
Normal file
Binary file not shown.
@@ -16,7 +16,8 @@ data class OrderDetail(
|
||||
var bookingUserPhone: String,
|
||||
var passengerSize: Int,
|
||||
var fullMinutes: Int, //到站后返回的总里程 /公里
|
||||
var fullMileage: Float // 到站后返回的总用时 /分钟
|
||||
var fullMileage: Float, // 到站后返回的总用时 /分钟
|
||||
var orderLine: Long // 订单路线id
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
@@ -91,16 +92,16 @@ data class StartTaskReqBean(var sn: String, var lineId: Long)
|
||||
|
||||
data class ArriveSiteReqBean(var sn: String, var siteId: Long)
|
||||
data class PrepareTaskReqBean(var sn: String, var siteId: Long)
|
||||
data class PrepareTaskRespBean(
|
||||
var lineId: Long, var cityCode: Int, var taskType: Int,
|
||||
var startSite: Site, var endSite: Site
|
||||
) //taskType 1:虚拟任务 2:接驾任务3:送驾任务
|
||||
: BaseData()
|
||||
data class PrepareTaskRespBean(var data: Result): BaseData(){ //taskType 1:虚拟任务 2:接驾任务3:送驾任务
|
||||
data class Result(
|
||||
var lineId: Long, var cityCode: Int, var taskType: Int,
|
||||
var startSite: Site, var endSite: Site
|
||||
)
|
||||
}
|
||||
|
||||
data class JumpPassengerCheckReqBean(var sn: String, var orderNo: String)
|
||||
data class CancelOrderReqBean(var sn: String, var orderNo: String, var cancelType: Int)
|
||||
data class OrderCompletedReqBean(var sn: String, var orderNo: String)
|
||||
data class ContrailListReqBean(var lineIds: Array<Long>)
|
||||
data class QueryCarOrderByNoReqBean(var sn: String, var orderNo: String)
|
||||
data class QueryCarOrderByNoRespBean(
|
||||
var sn: String, var orderNo: String, var orderStatus: Int,
|
||||
|
||||
@@ -292,7 +292,7 @@ object TaxiModel {
|
||||
return
|
||||
}
|
||||
mCurrentTaskAndOrder = data
|
||||
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo()
|
||||
|
||||
SharedPrefsMgr.getInstance(mContext!!).putString(
|
||||
TaxiUnmannedConst.SP_KEY_OCH_TAXI_ORDER,
|
||||
GsonUtil.jsonFromObject(data)
|
||||
@@ -699,12 +699,15 @@ object TaxiModel {
|
||||
CarServiceManager.contrailList(mContext!!, planningLines,
|
||||
object : OchCommonServiceCallback<ContrailListRespBean> {
|
||||
override fun onSuccess(data: ContrailListRespBean?) {
|
||||
d(SceneConstant.M_TAXI + TAG, "queryTaskContrail: ${GsonUtil.jsonFromObject(data?.data)}")
|
||||
if (data == null || data.code != 0) return
|
||||
mCurTaskContrail = data.data?.get(0)
|
||||
|
||||
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(SceneConstant.M_TAXI + TAG, "queryOrderContrails code=$code,msg=$msg")
|
||||
d(SceneConstant.M_TAXI + TAG, "queryTaskContrail code=$code,msg=$msg")
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@@ -284,7 +284,8 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
d(TAG, "queryCurrentTaskOnce = mCurrentTaskAndOrder = " + GsonUtil.jsonFromObject(mCurrentTaskAndOrder))
|
||||
|
||||
|
||||
if (result!!.endSite == null && mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.order!= null) {
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.order!= null &&
|
||||
result != null && result.order == null) {
|
||||
//本地根据订单 orderNo 去查询下(乘客取消订单)
|
||||
queryCurrentOrderStatusByNo(mCurrentTaskAndOrder!!.order!!.orderNo)
|
||||
return
|
||||
@@ -293,6 +294,8 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
//订单或者伪任务更新, 都去刷新下界面
|
||||
if (mCurrentTaskAndOrder == null || !mCurrentTaskAndOrder!!.equals(result)){
|
||||
|
||||
if (result == null) return
|
||||
|
||||
if (result.endSite == null && result.order == null){
|
||||
mCurrentTaskAndOrder = null
|
||||
updateNoTaskAndOrderUi()
|
||||
@@ -313,8 +316,14 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
}
|
||||
|
||||
//根据lineId集合去查轨迹集合, 返回的只是接驾任务的line集合,没有送驾任务
|
||||
if (result.order != null && result.order!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code){
|
||||
queryOrderPickUpConertrail(result.order!!.planningLines)
|
||||
if (result.order != null && result.order!!.orderStatus <= TaxiOrderStatusEnum.OnTheWayToEnd.code){
|
||||
var lines = result.order!!.planningLines
|
||||
lines[lines.size] = result.order!!.orderLine
|
||||
queryOrderPickUpContrails(lines)
|
||||
}
|
||||
|
||||
if (result.currentStatus <= TaskStatusEnum.StartTask.code){//任务执行中, 去加载下轨迹
|
||||
TaxiModel.queryTaskContrail(Array(1) {result.lineId})
|
||||
}
|
||||
|
||||
if (result.taskType <= TaskTypeEnum.ToOrderStartTask.code
|
||||
@@ -335,7 +344,7 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
* 查询送驾任务轨迹集合
|
||||
* 注: 运营单刚来的时候, 有可能还在运行一个演练任务, 要先跑完演练任务才跑运营单
|
||||
*/
|
||||
private fun queryOrderPickUpConertrail(planningLines: Array<Long>?) {
|
||||
private fun queryOrderPickUpContrails(planningLines: Array<Long>?) {
|
||||
if (planningLines == null) return
|
||||
contrailList(mContext,planningLines,
|
||||
object : OchCommonServiceCallback<ContrailListRespBean>{
|
||||
@@ -344,12 +353,11 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
val contrails = data.data
|
||||
if (mCurrentTaskAndOrder != null){
|
||||
TaxiModel.updateOrderContrails(contrails)
|
||||
TaxiModel.queryTaskContrail(Array(1) {mCurrentTaskAndOrder!!.lineId})
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(SceneConstant.M_TAXI + TAG, "queryOrderContrails code=$code,msg=$msg")
|
||||
d(SceneConstant.M_TAXI + TAG, "queryOrderContrail code=$code,msg=$msg")
|
||||
}
|
||||
|
||||
})
|
||||
@@ -362,7 +370,6 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
if (data != null && data.code != 0) return
|
||||
if (data!!.orderStatus == TaxiOrderStatusEnum.Cancel.code){
|
||||
VoiceNotice.showNotice("乘客已经取消")
|
||||
// mCurrentTaskAndOrder?.order?.orderStatus = TaxiOrderStatusEnum.Cancel.code
|
||||
mCurrentTaskAndOrder = null
|
||||
updateTaskAndOrderUi()
|
||||
return
|
||||
@@ -410,7 +417,7 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
d(SceneConstant.M_TAXI + TAG, "prepareTask = " + GsonUtil.jsonFromObject(data))
|
||||
if (data == null || data.code != 0) return
|
||||
//去下载轨迹, 下发给工控机下载
|
||||
queryOrderPickUpConertrail(Array(1) { data.lineId })
|
||||
TaxiModel.queryTaskContrail(Array(1) {data.data.lineId})
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
|
||||
@@ -167,8 +167,7 @@ object CarServiceManager {
|
||||
context: Context, linIds: Array<Long>,
|
||||
callback: OchCommonServiceCallback<ContrailListRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.contrailList(
|
||||
data = ContrailListReqBean(linIds)
|
||||
mOCHTaxiServiceApi.contrailList(data = linIds
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "contrailList"))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.taxi.bean.ArriveSiteReqBean
|
||||
import com.mogo.och.taxi.bean.CancelOrderReqBean
|
||||
import com.mogo.och.taxi.bean.ContrailListReqBean
|
||||
import com.mogo.och.taxi.bean.ContrailListRespBean
|
||||
import com.mogo.och.taxi.bean.JumpPassengerCheckReqBean
|
||||
import com.mogo.och.taxi.bean.OrderCompletedReqBean
|
||||
@@ -128,7 +127,7 @@ interface UnmannedTaskServiceApi {
|
||||
fun contrailList(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = MoGoAiCloudClientConfig.getInstance().token,
|
||||
@Body data: ContrailListReqBean?
|
||||
@Body data: Array<Long>
|
||||
): Observable<ContrailListRespBean>
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,6 +153,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
taskOtherInfo.text = Html.fromHtml(strHtml2,Html.FROM_HTML_MODE_LEGACY)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
private fun updateReserveOrderChanged(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
||||
mTaxiFragment?.let {
|
||||
it.updateReserveOrderChanged(taskAndOrder)
|
||||
@@ -263,7 +264,12 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
when (taskType) {
|
||||
TaskTypeEnum.VirtualTask.code -> {// 演练任务
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code){
|
||||
updateOrderUI(order)
|
||||
return
|
||||
}
|
||||
if (startSite == null || endSite == null) return
|
||||
|
||||
taskStatus.text = resources.getString(R.string.task_start_end_site)
|
||||
taskTypeTv.background = resources.getDrawable(R.drawable.task_unreal_type_btn_bg,null)
|
||||
taskTypeTv.text = resources.getString(R.string.task_exercise)
|
||||
@@ -272,15 +278,13 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
}
|
||||
TaskTypeEnum.ToOrderEndTask.code,TaskTypeEnum.ToOrderStartTask.code -> {// 送驾/接驾任务任务
|
||||
if (order == null) return
|
||||
taskTypeTv.text = resources.getString(R.string.task_order)
|
||||
taskTypeTv.background = resources.getDrawable(R.drawable.task_order_type_btn_bg,null)
|
||||
orderPhoneAndNum.text = Html.fromHtml("${order.bookingUserPhone} " +
|
||||
"<font color=\"#33FFFFFF\"> | </font> " +
|
||||
"${order.passengerSize}人",Html.FROM_HTML_MODE_LEGACY)
|
||||
startStationName.text = order.orderStartSite?.siteName
|
||||
endStationName.text = order.orderEndSite?.siteName
|
||||
updateOrderUI(order)
|
||||
}
|
||||
TaskTypeEnum.None.code -> {
|
||||
if (order != null){
|
||||
updateOrderUI(order)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateRemainDistanceAndTime(false)
|
||||
@@ -289,6 +293,14 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
private fun updateOrderUI(order: OrderDetail) {
|
||||
|
||||
taskTypeTv.text = resources.getString(R.string.task_order)
|
||||
taskTypeTv.background = resources.getDrawable(R.drawable.task_order_type_btn_bg,null)
|
||||
orderPhoneAndNum.text = Html.fromHtml("<font color=\"#FFFFFF\"> " + order.bookingUserPhone + "</font>" +
|
||||
"<font color=\"#33FFFFFF\"> | </font>" +
|
||||
"<font color=\"#FFFFFF\">" + order.passengerSize + "人" + "</font>",Html.FROM_HTML_MODE_LEGACY)
|
||||
startStationName.text = order.orderStartSite?.siteName
|
||||
endStationName.text = order.orderEndSite?.siteName
|
||||
|
||||
when(order.orderStatus){
|
||||
|
||||
TaxiOrderStatusEnum.None.code -> { //无
|
||||
@@ -463,33 +475,45 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
private fun updateUIShowStatus(taskType: Int, currentStatus: Int, order: OrderDetail?) {
|
||||
when (taskType) {
|
||||
TaskTypeEnum.None.code ->{
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code){
|
||||
handleOrderView(order)
|
||||
}
|
||||
}
|
||||
TaskTypeEnum.VirtualTask.code -> { //演练任务
|
||||
cancelOrder.visibility = View.GONE
|
||||
orderPhoneAndNum.visibility = View.GONE
|
||||
taskClickBtn.visibility = View.GONE
|
||||
// currentStatus 0:空闲 1:获取任务 2:开始任务 3:到达目的地
|
||||
naviToStart.visibility = View.GONE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
naviToEnd.visibility = if (currentStatus >= TaskStatusEnum.StartTask.code) View.VISIBLE else View.GONE
|
||||
taskOtherInfo.visibility = if (currentStatus == TaskStatusEnum.GetTask.code) View.GONE else View.VISIBLE
|
||||
}
|
||||
TaskTypeEnum.ToOrderEndTask.code,TaskTypeEnum.ToOrderStartTask.code -> {// 运营单(接驾任务、送驾任务)
|
||||
if (order == null) return
|
||||
cancelOrder.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.VISIBLE
|
||||
taskClickBtn.visibility = View.VISIBLE
|
||||
// orderStatus: 0 订单创建(为派单), 10 已派上司机(司机去往上车点), 20 司机到达上车点,
|
||||
// 30 乘客到达上车点, 40 服务中(去往目的地), 50 到达目的地, 60 已完成, 70 已取消
|
||||
naviToStart.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToStart.code) View.VISIBLE else View.GONE
|
||||
|
||||
naviToEnd.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToEnd.code) View.VISIBLE else View.GONE
|
||||
|
||||
taskOtherInfo.visibility = View.VISIBLE
|
||||
handleOrderView(order)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleOrderView(order: OrderDetail?) {
|
||||
if (order == null) return
|
||||
cancelOrder.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.VISIBLE
|
||||
taskClickBtn.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
// orderStatus: 0 订单创建(为派单), 10 已派上司机(司机去往上车点), 20 司机到达上车点,
|
||||
// 30 乘客到达上车点, 40 服务中(去往目的地), 50 到达目的地, 60 已完成, 70 已取消
|
||||
naviToStart.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToStart.code) View.VISIBLE else View.GONE
|
||||
|
||||
naviToEnd.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToEnd.code) View.VISIBLE else View.GONE
|
||||
|
||||
taskOtherInfo.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
||||
private fun hideNavi() {
|
||||
naviToStart.visibility = View.GONE
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.widget.TextView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.elegant.network.utils.GsonUtil
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
@@ -27,6 +28,12 @@ import com.mogo.och.taxi.presenter.TaxiPresenter
|
||||
import com.mogo.och.taxi.utils.TPRouteDataTestUtils
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_operation_status
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.taxi_driver_role_tv
|
||||
import kotlinx.android.synthetic.main.taxi_panel.orderInfo
|
||||
import kotlinx.android.synthetic.main.taxi_panel.orderToStartLines
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskEndSite
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskStartSite
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskStatus2
|
||||
import kotlinx.android.synthetic.main.taxi_panel.taskType2
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -111,6 +118,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
serverOrdersFragmentWR!!.get()!!.onChangeOperationStatus()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun updateReserveOrderChanged(taskAndOrder: QueryCurrentTaskRespBean.Result?){
|
||||
if (null == serverOrdersFragmentWR || serverOrdersFragmentWR!!.get() == null) return
|
||||
serverOrdersFragmentWR!!.get()!!.updateOrderChanged(taskAndOrder)
|
||||
@@ -198,9 +206,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
findViewById<View>(R.id.test_bar_to_virtual)?.setOnClickListener{
|
||||
TaxiModel.setArriveAtUntruthStation()
|
||||
}
|
||||
findViewById<View>(R.id.test_bar_to_start)?.setOnClickListener {
|
||||
TaxiModel.setArriveAtStartStation()
|
||||
}
|
||||
|
||||
findViewById<View>(R.id.test_bar_to_end)?.setOnClickListener {
|
||||
TaxiModel.setArriveAtEndStation()
|
||||
}
|
||||
@@ -276,35 +282,32 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
testBar!!.visibility = View.GONE
|
||||
} else {
|
||||
val result = TaxiModel.getCurTaskAndOrder()
|
||||
val task = result?.endSite
|
||||
val order = result?.order
|
||||
testCurOrderId!!.text = ":" + (order?.orderNo ?: "")
|
||||
testCurLineId!!.text = "lineId:" + (result?.lineId.toString() ?: "")
|
||||
// testCurTrajMd5!!.text = "TMd5:" + if (order == null) "" else order.csvFileMd5
|
||||
// testCurStopMd5!!.text = "SMd5:" + if (order == null) "" else order.txtFileMd5
|
||||
// testCurTrajMd5DPQP!!.text =
|
||||
// "TMd5DPQP:" + if (order == null) "" else order.csvFileMd5DPQP
|
||||
// testCurStopMd5DPQP!!.text =
|
||||
// "SMd5DPQP:" + if (order == null) "" else order.txtFileMd5DPQP
|
||||
testCurOrderId!!.text = "orderNo: " + order?.orderNo
|
||||
testCurLineId!!.text = "当前任务lineId: " + result?.lineId
|
||||
taskType2.text = "当前任务类型: " + result?.taskType
|
||||
taskStatus2.text = "任务状态: "+ result?.currentStatus
|
||||
taskStartSite.text = "任务开始站点: "+ result?.startSite?.siteName +
|
||||
", siteId: " + result?.startSite?.siteId
|
||||
taskEndSite.text = "任务结束站点: "+ result?.endSite?.siteName +
|
||||
", siteId: " + result?.endSite?.siteId
|
||||
|
||||
orderInfo.text = "订单信息: 开始: " + order?.orderStartSite?.siteName + ", 结束: "+
|
||||
order?.orderEndSite?.siteName + ", orderStatus: "+ order?.orderStatus
|
||||
|
||||
orderToStartLines.text = "接驾任务的lineId集合: " + GsonUtil.jsonFromObject(order?.planningLines)
|
||||
|
||||
val curContrail = TaxiModel.getCurTaskContrail()
|
||||
testCurTrajMd5!!.text = "TMd5:" + curContrail?.csvFileMd5
|
||||
testCurStopMd5!!.text = "SMd5:" + curContrail?.txtFileMd5
|
||||
testCurTrajMd5DPQP!!.text =
|
||||
"TMd5DPQP:" + curContrail?.csvFileMd5DPQP
|
||||
testCurStopMd5DPQP!!.text =
|
||||
"SMd5DPQP:" + curContrail?.txtFileMd5DPQP
|
||||
testBar!!.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun updateTaxiTestBarInfo() {
|
||||
// if (testBar != null && testBar!!.visibility == View.VISIBLE) {
|
||||
// val order = TaxiModel.getCurrentOrder()
|
||||
// testCurOrderId!!.text = "orderNo:" + (order?.orderNo?.toString() ?: "")
|
||||
// testCurLineId!!.text = "lineId:" + (order?.lineId?.toString() ?: "")
|
||||
// testCurTrajMd5!!.text = "TMd5:" + if (order == null) "" else order.csvFileMd5
|
||||
// testCurStopMd5!!.text = "SMd5:" + if (order == null) "" else order.txtFileMd5
|
||||
// testCurTrajMd5DPQP!!.text =
|
||||
// "TMd5DPQP:" + if (order == null) "" else order.csvFileMd5DPQP
|
||||
// testCurStopMd5DPQP!!.text =
|
||||
// "SMd5DPQP:" + if (order == null) "" else order.txtFileMd5DPQP
|
||||
// }
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "TaxiFragment"
|
||||
fun newInstance(): TaxiFragment {
|
||||
|
||||
@@ -5,8 +5,11 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
@@ -44,18 +47,26 @@ class TaxiReserveOrderFragment : BaseFragment() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
showNoOrderView()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun updateOrderChanged(model: QueryCurrentTaskRespBean.Result?) {
|
||||
if (model == null) return
|
||||
if (model.order == null || model.taskType != TaskTypeEnum.ToOrderStartTask.code){
|
||||
if (model?.order == null) {
|
||||
showNoOrderView()
|
||||
return
|
||||
}
|
||||
val order = model.order
|
||||
updateOrderUI(order!!)
|
||||
|
||||
if (model.taskType == TaskTypeEnum.VirtualTask.code){
|
||||
val order = model.order
|
||||
updateOrderUI(order!!)
|
||||
}else{
|
||||
showNoOrderView()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun updateOrderUI(order: OrderDetail) {
|
||||
showOrderView()
|
||||
@@ -63,7 +74,10 @@ class TaxiReserveOrderFragment : BaseFragment() {
|
||||
naviToStart.visibility = View.GONE
|
||||
naviToEnd.visibility = View.GONE
|
||||
|
||||
orderPhoneAndNum.text = "${order.bookingUserPhone} | ${order.passengerSize}人"
|
||||
orderPhoneAndNum.text = Html.fromHtml("<font color=\"#FFFFFF\"> " + order.bookingUserPhone + "</font>" +
|
||||
"<font color=\"#33FFFFFF\"> | </font>" +
|
||||
"<font color=\"#FFFFFF\">" + order.passengerSize + "人" + "</font>",Html.FROM_HTML_MODE_LEGACY)
|
||||
|
||||
|
||||
order.orderStartSite?.let {
|
||||
startStationName.text = it.siteName
|
||||
@@ -72,7 +86,6 @@ class TaxiReserveOrderFragment : BaseFragment() {
|
||||
endStationName.text = it.siteName
|
||||
}
|
||||
|
||||
taskStatus.text = resources.getString(R.string.waiting_server)
|
||||
taskTypeTv.text = resources.getString(R.string.task_order)
|
||||
taskTypeTv.background = resources.getDrawable(R.drawable.task_order_type_btn_bg,null)
|
||||
|
||||
|
||||
@@ -169,6 +169,7 @@ class TaxiServerOrdersFragment : BaseFragment(){
|
||||
beingTaskFragment!!.onChangeOperationStatus()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun updateOrderChanged(model: QueryCurrentTaskRespBean.Result?){
|
||||
if (null == reserveOrdersFragment) return
|
||||
reserveOrdersFragment!!.updateOrderChanged(model)
|
||||
|
||||
@@ -32,6 +32,11 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAX
|
||||
public class TaxiTrajectoryManager {
|
||||
private static final String TAG = TaxiTrajectoryManager.class.getSimpleName();
|
||||
|
||||
//载类型: 0:正常下载 1:预下载
|
||||
private static final int COMMON_LOADING = 0;
|
||||
private static final int PRE_LOADING = 1;
|
||||
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final TaxiTrajectoryManager INSTANCE = new TaxiTrajectoryManager();
|
||||
}
|
||||
@@ -40,7 +45,11 @@ public class TaxiTrajectoryManager {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
//正常加载的路线
|
||||
private AutopilotControlParameters.AutoPilotLine mAutoPilotLine = null;
|
||||
//预加载的路线
|
||||
private AutopilotControlParameters.AutoPilotLine mPreAutoPilotLine = null;
|
||||
|
||||
private Disposable mSendReqDisposable = null;
|
||||
private String mPrevTaskLineId = "";
|
||||
|
||||
@@ -48,6 +57,10 @@ public class TaxiTrajectoryManager {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
|
||||
mPreAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,17 +137,6 @@ public class TaxiTrajectoryManager {
|
||||
final OrderDetail orderDetail = taskAndOrder.getOrder();
|
||||
ContrailListRespBean.Result preloadContrail = null; //预加载的轨迹
|
||||
|
||||
if (orderDetail != null && orderContrails != null && orderContrails.size() != 0 ){
|
||||
if (orderContrails.contains(curLineId)){ //预加载轨迹是curLineId索引的下一个
|
||||
int index = orderContrails.indexOf(curLineId);
|
||||
if (orderContrails.size()-1 >= index){
|
||||
preloadContrail = orderContrails.get(index);
|
||||
}
|
||||
}else {//预加载轨迹直接是集合第一个
|
||||
preloadContrail = orderContrails.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(curTaskContrail.getLineId(), curTaskContrail.getLineName(),
|
||||
curTaskContrail.getCsvFileUrl(), curTaskContrail.getCsvFileMd5(), curTaskContrail.getTxtFileUrl(),
|
||||
@@ -156,24 +158,76 @@ public class TaxiTrajectoryManager {
|
||||
mAutoPilotLine.setStopMd5_dpqp(curTaskContrail.getTxtFileMd5DPQP());
|
||||
mAutoPilotLine.setTimestamp_dpqp(curTaskContrail.getContrailSaveTimeDPQP());
|
||||
}
|
||||
|
||||
if (orderDetail != null && orderContrails != null && orderContrails.size() != 0 ){
|
||||
if (orderContrails.contains(curLineId)){ //预加载轨迹是curLineId索引的下一个
|
||||
int index = orderContrails.indexOf(curLineId);
|
||||
if (orderContrails.size()-1 >= index){
|
||||
preloadContrail = orderContrails.get(index);
|
||||
}
|
||||
}else {//预加载轨迹直接是集合第一个
|
||||
preloadContrail = orderContrails.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (preloadContrail == null) return;
|
||||
|
||||
if (mPreAutoPilotLine == null) {
|
||||
mPreAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(preloadContrail.getLineId(), preloadContrail.getLineName(),
|
||||
preloadContrail.getCsvFileUrl(), preloadContrail.getCsvFileMd5(), preloadContrail.getTxtFileUrl(),
|
||||
preloadContrail.getTxtFileMd5(), preloadContrail.getContrailSaveTime(), "",//todo curTaskContrail.getCarModel()
|
||||
preloadContrail.getCsvFileUrlDPQP(), preloadContrail.getCsvFileMd5DPQP(), preloadContrail.getTxtFileUrlDPQP(),
|
||||
preloadContrail.getTxtFileMd5DPQP(), preloadContrail.getContrailSaveTimeDPQP());
|
||||
} else {
|
||||
mPreAutoPilotLine.setLineId(taskAndOrder.getLineId());
|
||||
mPreAutoPilotLine.setLineName(preloadContrail.getLineName());
|
||||
mPreAutoPilotLine.setTrajUrl(preloadContrail.getCsvFileUrl());
|
||||
mPreAutoPilotLine.setTrajMd5(preloadContrail.getCsvFileMd5());
|
||||
mPreAutoPilotLine.setStopUrl(preloadContrail.getTxtFileUrl());
|
||||
mPreAutoPilotLine.setStopMd5(preloadContrail.getTxtFileMd5());
|
||||
mPreAutoPilotLine.setTimestamp(preloadContrail.getContrailSaveTime());
|
||||
mPreAutoPilotLine.setVehicleModel("");// todo curTaskContrail.getCarModel()
|
||||
mPreAutoPilotLine.setTrajUrl_dpqp(preloadContrail.getCsvFileUrlDPQP());
|
||||
mPreAutoPilotLine.setTrajMd5_dpqp(preloadContrail.getCsvFileMd5DPQP());
|
||||
mPreAutoPilotLine.setStopUrl_dpqp(preloadContrail.getTxtFileUrlDPQP());
|
||||
mPreAutoPilotLine.setStopMd5_dpqp(preloadContrail.getTxtFileMd5DPQP());
|
||||
mPreAutoPilotLine.setTimestamp_dpqp(preloadContrail.getContrailSaveTimeDPQP());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return;
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setLineName("");
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
mAutoPilotLine.setStopMd5("");
|
||||
mAutoPilotLine.setTimestamp(0);
|
||||
mAutoPilotLine.setVehicleModel("");
|
||||
mAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mAutoPilotLine.setStopUrl_dpqp("");
|
||||
mAutoPilotLine.setStopMd5_dpqp("");
|
||||
mAutoPilotLine.setTimestamp_dpqp(0);
|
||||
if (mAutoPilotLine != null){
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setLineName("");
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
mAutoPilotLine.setStopMd5("");
|
||||
mAutoPilotLine.setTimestamp(0);
|
||||
mAutoPilotLine.setVehicleModel("");
|
||||
mAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mAutoPilotLine.setStopUrl_dpqp("");
|
||||
mAutoPilotLine.setStopMd5_dpqp("");
|
||||
mAutoPilotLine.setTimestamp_dpqp(0);
|
||||
}
|
||||
|
||||
if (mPreAutoPilotLine != null){
|
||||
mPreAutoPilotLine.setLineId(-1);
|
||||
mPreAutoPilotLine.setLineName("");
|
||||
mPreAutoPilotLine.setTrajUrl("");
|
||||
mPreAutoPilotLine.setTrajMd5("");
|
||||
mPreAutoPilotLine.setStopUrl("");
|
||||
mPreAutoPilotLine.setStopMd5("");
|
||||
mPreAutoPilotLine.setTimestamp(0);
|
||||
mPreAutoPilotLine.setVehicleModel("");
|
||||
mPreAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mPreAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mPreAutoPilotLine.setStopUrl_dpqp("");
|
||||
mPreAutoPilotLine.setStopMd5_dpqp("");
|
||||
mPreAutoPilotLine.setTimestamp_dpqp(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void startTrajReqLoop() {
|
||||
@@ -208,13 +262,19 @@ public class TaxiTrajectoryManager {
|
||||
}
|
||||
|
||||
private void sendTrajectoryReq() {
|
||||
if (mAutoPilotLine == null) {
|
||||
if (mAutoPilotLine != null) {
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine,COMMON_LOADING);
|
||||
}else {
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
if (mPreAutoPilotLine != null){
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mPreAutoPilotLine,PRE_LOADING);
|
||||
}else {
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "sendTrajectoryReq(): mPreAutoPilotLine is null!!!");
|
||||
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "sendTrajectoryReq(): common_load = "
|
||||
+ GsonUtils.toJson(mAutoPilotLine) + "pre_load" + GsonUtils.toJson(mPreAutoPilotLine));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,48 @@
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskType2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskStatus2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskStartSite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taskEndSite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderToStartLines"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_bar_current_traj_md5"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -73,13 +115,6 @@
|
||||
android:text="到达标定站点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_to_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达起点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_start_service_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -98,7 +133,7 @@
|
||||
android:id="@+id/test_bar_to_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达终点"
|
||||
android:text="到达站点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user