From 23d4e82e2580c5c0cabb285ab2a3ddeafe0fa05d Mon Sep 17 00:00:00 2001 From: yangyakun Date: Mon, 24 Apr 2023 20:46:05 +0800 Subject: [PATCH] =?UTF-8?q?[charter]=20[3.2.0]=20[=E6=8A=BD=E5=8F=96go?= =?UTF-8?q?=E5=92=8C=E9=9D=A0=E8=BE=B9=E5=81=9C=E8=BD=A6=E5=88=B0view?= =?UTF-8?q?=E4=B8=AD]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusPassengerFunctionDevicePresenter.kt | 44 ---------------- .../och/bus/passenger/ui/M1DeviceFragment.kt | 13 +---- .../bus/passenger/ui/view/stopsite/GoView.kt | 50 +++++++++++++++++++ .../ui/view/stopsite/StopSiteView.kt | 44 ++++++++++++++++ .../main/res/layout/m1_devices_fragment.xml | 4 +- 5 files changed, 97 insertions(+), 58 deletions(-) create mode 100644 OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/GoView.kt create mode 100644 OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/StopSiteView.kt diff --git a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt index 130365e0be..86dbf5b2f5 100644 --- a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt +++ b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt @@ -26,48 +26,4 @@ class BusPassengerFunctionDevicePresenter(view: M1DeviceFragment?) : super.onDestroy(owner) } - // 靠边停车 - fun startStopSide() { - when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) { - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶 - ToastUtils.showShort("设备未就绪请稍等,请稍后再试") - } - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {// - ToastUtils.showShort("因车辆正在人工驾驶中无法靠边停车,请稍后再试") - } - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> { - // 靠边停车 - CallerAutoPilotControlManager.sendPlanningCmd(1) - } - IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> { - ToastUtils.showShort("因车辆正在平行驾驶中无法靠边停车,请稍后再试") - } - else -> {} - } - } - - fun startGo() { - when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) { - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶 - ToastUtils.showShort("设备未就绪请稍等") - } - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {// - ToastUtils.showShort("启动自动驾驶中") - CallerAutoPilotControlManager.sendPlanningCmd(2) - CharterPassengerModel.startAutopilot() - CharterPassengerModel.leaveStation() - CharterPassengerModel.sendTripInfo() - } - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> { - // 重新起步 - CallerAutoPilotControlManager.sendPlanningCmd(2) - CharterPassengerModel.leaveStation() - } - IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> { - ToastUtils.showShort("因车辆正在平行驾驶中无法靠边停车,请稍后再试") - } - else -> {} - } - } - } \ No newline at end of file diff --git a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/M1DeviceFragment.kt b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/M1DeviceFragment.kt index 3a914f1f50..4d3944bcac 100644 --- a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/M1DeviceFragment.kt +++ b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/M1DeviceFragment.kt @@ -24,18 +24,7 @@ class M1DeviceFragment : } private fun initListener() { - tv_car_setting_go.setOnClickListener { - //判断自动驾驶状态 - // 自动驾驶状态中: AdasManager.getInstance().sendPlanningCmd(2); - // 没有在自动驾驶中:启动自动驾驶 CallerAutoPilotControlManager.INSTANCE.startAutoPilot(parameters); - mPresenter?.startGo() - SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) - } - tv_car_setting_stopside.setOnClickListener { - // 执行靠边停车 AdasManager.getInstance().sendPlanningCmd(1); - mPresenter?.startStopSide() - SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) - } + } override fun createPresenter(): BusPassengerFunctionDevicePresenter = diff --git a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/GoView.kt b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/GoView.kt new file mode 100644 index 0000000000..00c447662d --- /dev/null +++ b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/GoView.kt @@ -0,0 +1,50 @@ +package com.mogo.och.bus.passenger.ui.view.stopsite + +import android.content.Context +import android.util.AttributeSet +import androidx.appcompat.widget.AppCompatTextView +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.och.bus.passenger.R +import com.mogo.och.bus.passenger.model.CharterPassengerModel +import com.mogo.och.common.module.utils.SoundPoolHelper + +class GoView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : AppCompatTextView(context, attrs, defStyleAttr) { + + init { + setOnClickListener { + startGo() + } + } + + private fun startGo(){ + when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) { + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶 + ToastUtils.showShort("设备未就绪请稍等") + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {// + ToastUtils.showShort("启动自动驾驶中") + CallerAutoPilotControlManager.sendPlanningCmd(2) + CharterPassengerModel.startAutopilot() + CharterPassengerModel.leaveStation() + CharterPassengerModel.sendTripInfo() + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> { + // 重新起步 + CallerAutoPilotControlManager.sendPlanningCmd(2) + CharterPassengerModel.leaveStation() + } + IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> { + ToastUtils.showShort("因车辆正在平行驾驶中无法靠边停车,请稍后再试") + } + else -> {} + } + SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) + } +} \ No newline at end of file diff --git a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/StopSiteView.kt b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/StopSiteView.kt new file mode 100644 index 0000000000..7dec48188f --- /dev/null +++ b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/view/stopsite/StopSiteView.kt @@ -0,0 +1,44 @@ +package com.mogo.och.bus.passenger.ui.view.stopsite + +import android.content.Context +import android.util.AttributeSet +import androidx.appcompat.widget.AppCompatTextView +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.och.bus.passenger.R +import com.mogo.och.common.module.utils.SoundPoolHelper + +class StopSiteView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : AppCompatTextView(context, attrs, defStyleAttr) { + + init { + setOnClickListener { + stopSite() + } + } + + private fun stopSite(){ + when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) { + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶 + ToastUtils.showShort("设备未就绪请稍等,请稍后再试") + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {// + ToastUtils.showShort("因车辆正在人工驾驶中无法靠边停车,请稍后再试") + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> { + // 靠边停车 + CallerAutoPilotControlManager.sendPlanningCmd(1) + } + IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> { + ToastUtils.showShort("因车辆正在平行驾驶中无法靠边停车,请稍后再试") + } + else -> {} + } + SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) + } +} \ No newline at end of file diff --git a/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_devices_fragment.xml b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_devices_fragment.xml index 65c1f4571b..8a66824115 100644 --- a/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_devices_fragment.xml +++ b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_devices_fragment.xml @@ -16,7 +16,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintWidth_percent="0.4589"> - -