Merge branch 'dev_robotaxi-d_230809_6.0.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_230809_6.0.0
This commit is contained in:
@@ -150,4 +150,21 @@ public class DateTimeUtil {
|
||||
return stringBuffer.toString();
|
||||
|
||||
}
|
||||
|
||||
public static String second2MMSS(Long second) {
|
||||
if (second == null || second < 0) {
|
||||
return "00:00";
|
||||
}
|
||||
long m = (long) Math.floor((second % 3600) / 60.0);// 向上取整
|
||||
long s = second % 60;
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
if (m > 0) {
|
||||
stringBuffer.append(m < 10 ? ("0" + m) : m).append(":");
|
||||
}else {
|
||||
stringBuffer.append("00:");
|
||||
}
|
||||
stringBuffer.append(s < 10 ? ("0" + s) : s);
|
||||
return stringBuffer.toString();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,6 @@ interface ITaxiTaskWithOrderCallback {
|
||||
fun onOrderTotalMileAndDurationChanged(mileage: Float, duration: Int)
|
||||
fun onOrderJourneyCompleted()
|
||||
fun onStartAutopilot()
|
||||
|
||||
fun onStartPrepareTask120s()
|
||||
}
|
||||
@@ -197,4 +197,8 @@ public class DebugView @JvmOverloads constructor(
|
||||
|
||||
override fun onStartAutopilot() {
|
||||
}
|
||||
|
||||
override fun onStartPrepareTask120s() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.ui.unmanned
|
||||
package com.mogo.och.taxi.ui.task
|
||||
|
||||
import com.mogo.och.taxi.base.IUiState
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
@@ -24,4 +24,6 @@ sealed class TaskWithOrderUIState {
|
||||
TaskWithOrderUIState()
|
||||
|
||||
data class UpdateTaskTripInfo(val mileage: Float, val duration: Int) : TaskWithOrderUIState()
|
||||
|
||||
data class UpdatePrepareTaskDelay120S(val isStart: Boolean) : TaskWithOrderUIState()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
@@ -24,6 +25,7 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog
|
||||
import com.mogo.och.taxi.R
|
||||
@@ -35,9 +37,9 @@ import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TAXI_END_MAP_MAKER
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TAXI_START_MAP_MAKER
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TIMER_PREPARE_TASK_INTERVAL_120S
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TYPE_MARKER_TAXI_ORDER
|
||||
import com.mogo.och.taxi.ui.base.TaxiFragment
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskWithOrderUIState
|
||||
import com.mogo.och.taxi.utils.MapMakerManager
|
||||
import com.mogo.och.taxi.utils.TaskUtils
|
||||
import kotlinx.android.synthetic.main.task_fragment_current.cancelOrder
|
||||
@@ -55,6 +57,7 @@ import kotlinx.android.synthetic.main.task_fragment_current.taskOtherInfo
|
||||
import kotlinx.android.synthetic.main.task_fragment_current.taskStatus
|
||||
import kotlinx.android.synthetic.main.task_fragment_current.taskTypeTv
|
||||
import kotlinx.android.synthetic.main.taxi_no_data_common_view.noOrderDataTv
|
||||
import kotlinx.android.synthetic.main.taxi_no_data_common_view.prepareTaskCountdownTv
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
/**
|
||||
@@ -66,6 +69,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
|
||||
private lateinit var mViewModel: TaxiCurrentTaskViewModel
|
||||
|
||||
private var prepareTasCountDownTimer: CountDownTimer? = null
|
||||
|
||||
companion object {
|
||||
const val TAG = M_TAXI + "TaxiCurrentTaskFragment"
|
||||
private var mTaxiFragment: TaxiFragment? = null
|
||||
@@ -158,6 +163,9 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
if (taskAndOrderUiState.driveToNearestStationTask != null) {
|
||||
updateViewByDriveToNearestStationTask(taskAndOrderUiState.driveToNearestStationTask)
|
||||
} else {
|
||||
prepareTaskCountdownTv.visibility = View.GONE
|
||||
prepareTasCountDownTimer?.cancel()
|
||||
prepareTasCountDownTimer = null
|
||||
initContainerView(false)
|
||||
removeAllMapMarker()
|
||||
}
|
||||
@@ -182,11 +190,45 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
taskAndOrderUiState.duration
|
||||
)
|
||||
}
|
||||
|
||||
is TaskWithOrderUIState.UpdatePrepareTaskDelay120S -> {
|
||||
if (taskAndOrderUiState.isStart){
|
||||
updatePrepareTaskDelay120SUI()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新120s倒计时
|
||||
*/
|
||||
private fun updatePrepareTaskDelay120SUI() {
|
||||
prepareTaskCountdownTv.visibility = View.VISIBLE
|
||||
prepareTasCountDownTimer = object : CountDownTimer(TIMER_PREPARE_TASK_INTERVAL_120S, 1000L) {// 5倒计时后开启自驾
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
// 倒计时
|
||||
UiThreadHandler.post {
|
||||
prepareTaskCountdownTv.text =
|
||||
"距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished/1000)}"
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
//倒计时结束了...
|
||||
UiThreadHandler.post {
|
||||
prepareTaskCountdownTv.visibility = View.GONE
|
||||
}
|
||||
prepareTasCountDownTimer?.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
prepareTasCountDownTimer?.start()
|
||||
}
|
||||
|
||||
private fun updateViewByDriveToNearestStationTask(driveToNearestStationTask: StartServiceRespBean.Result?) {
|
||||
if (driveToNearestStationTask == null) return
|
||||
initContainerView(true)
|
||||
@@ -305,6 +347,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
TaskTypeEnum.None.code -> {
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) {
|
||||
handleOrderView(order)
|
||||
updateOrderUI(order)
|
||||
VoiceNotice.showNotice("已为您接到订单")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,17 +365,7 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
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 -> {// 接驾任务 或 送驾任务
|
||||
order.also {
|
||||
handleOrderView(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
when (taskType) {
|
||||
TaskTypeEnum.VirtualTask.code -> {// 演练任务
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) {
|
||||
updateOrderUI(order)
|
||||
VoiceNotice.showNotice("已为您接到订单")
|
||||
@@ -348,18 +382,14 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
updateStartAndEndStationPointByStatus(true)
|
||||
}
|
||||
|
||||
TaskTypeEnum.ToOrderEndTask.code, TaskTypeEnum.ToOrderStartTask.code -> {// 送驾/接驾任务任务
|
||||
if (order == null) return
|
||||
updateOrderUI(order)
|
||||
}
|
||||
|
||||
TaskTypeEnum.None.code -> {
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) {
|
||||
updateOrderUI(order)
|
||||
VoiceNotice.showNotice("已为您接到订单")
|
||||
TaskTypeEnum.ToOrderEndTask.code, TaskTypeEnum.ToOrderStartTask.code -> {// 接驾任务 或 送驾任务
|
||||
order?.also {
|
||||
handleOrderView(it)
|
||||
updateOrderUI(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateMapMarkers(taskAndOrder)
|
||||
updateRemainDistanceAndTime(false)
|
||||
}
|
||||
@@ -557,6 +587,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
|
||||
override fun onDestroyView() {
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
prepareTasCountDownTimer?.cancel()
|
||||
prepareTasCountDownTimer = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,7 @@ import com.mogo.och.taxi.constant.TaskStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.network.TaxiTaskWithOrderServiceManager
|
||||
import com.mogo.och.taxi.network.TaxiTaskWithOrderServiceManager.cancelOrder
|
||||
import com.mogo.och.taxi.ui.debug.DebugView
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskWithOrderUIState
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedState
|
||||
import com.mogo.och.taxi.utils.TaxiTrajectoryManager
|
||||
|
||||
/**
|
||||
@@ -176,6 +173,17 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePrepareTaskDelay120SUI(isStart: Boolean){
|
||||
d(TAG, "UpdatePrepareTaskDelay120SUI = $isStart")
|
||||
sendUiState {
|
||||
copy(
|
||||
taskWithOrderUIState = TaskWithOrderUIState.UpdatePrepareTaskDelay120S(
|
||||
isStart
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateDriveToNearestStationTaskUI(driveToNearestStationTask: StartServiceRespBean.Result?) {
|
||||
d(TAG, "updateDriveToNearestStationTaskUI = ${driveToNearestStationTask?.toString()}")
|
||||
sendUiState {
|
||||
@@ -247,6 +255,13 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
}, TaxiUnmannedConst.START_AUTOPILOT_COUNTDOWN_INTERVAL) // 10s后开启自驾, 状态流转
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始倒计时120拉取任务
|
||||
*/
|
||||
override fun onStartPrepareTask120s() {
|
||||
updatePrepareTaskDelay120SUI(true)
|
||||
}
|
||||
|
||||
override fun onCarEndServiceSuccess(
|
||||
driveToNearestStationTask: StartServiceRespBean.Result?,
|
||||
currentTaskWithOrder: QueryCurrentTaskRespBean.Result?
|
||||
|
||||
@@ -907,6 +907,12 @@ object TaxiTaskModel {
|
||||
|
||||
fun startPrepareTaskDelay120S(siteId: Long) {
|
||||
DebugView.printInfoMsg("[PrepareNextTask] 倒计时${TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S/1000}秒后prepareNextTask")
|
||||
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onStartPrepareTask120s()
|
||||
}
|
||||
|
||||
UiThreadHandler.postDelayed({
|
||||
prepareNextTask(siteId)
|
||||
}, TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
android:text="暂无服务订单"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/getTaskCountdownTv"
|
||||
android:id="@+id/prepareTaskCountdownTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#91A1EA"
|
||||
@@ -35,6 +35,6 @@
|
||||
android:layout_marginTop="50dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/noOrderDataTv"
|
||||
android:text="距离任务获取还有"/>
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/noOrderDataTv" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user