[charter]
[3.2.0] [抽取go和靠边停车到view中]
This commit is contained in:
@@ -26,48 +26,4 @@ class BusPassengerFunctionDevicePresenter(view: M1DeviceFragment?) :
|
|||||||
super.onDestroy(owner)
|
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 -> {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,18 +24,7 @@ class M1DeviceFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initListener() {
|
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 =
|
override fun createPresenter(): BusPassengerFunctionDevicePresenter =
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintWidth_percent="0.4589">
|
app:layout_constraintWidth_percent="0.4589">
|
||||||
|
|
||||||
<TextView
|
<com.mogo.och.bus.passenger.ui.view.stopsite.GoView
|
||||||
android:id="@+id/tv_car_setting_go"
|
android:id="@+id/tv_car_setting_go"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_bias="0.492" />
|
app:layout_constraintVertical_bias="0.492" />
|
||||||
|
|
||||||
<TextView
|
<com.mogo.och.bus.passenger.ui.view.stopsite.StopSiteView
|
||||||
android:id="@+id/tv_car_setting_stopside"
|
android:id="@+id/tv_car_setting_stopside"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
Reference in New Issue
Block a user