[1.0.0]
[m1] [回写提示]
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerFunctionDeviceFragment
|
||||
|
||||
abstract class BusBasePassengerFunctionDevicePresenter<V : IView?>(view: V) :
|
||||
Presenter<V>(view)
|
||||
@@ -1,7 +1,56 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
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.ui.BusPassengerFunctionDeviceFragment
|
||||
import com.mogo.och.common.module.manager.OCHM1LightAirconditionDoorStatusManager
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
|
||||
class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragment?) :
|
||||
Presenter<BusPassengerFunctionDeviceFragment?>(view)
|
||||
BusBasePassengerFunctionDevicePresenter<BusPassengerFunctionDeviceFragment?>(view),
|
||||
OCHM1LightAirconditionDoorStatusManager.OCHM1LightAirconditionDoorCallback {
|
||||
|
||||
companion object{
|
||||
private const val TAG = "BusPassengerFunctionDevicePresenter"
|
||||
}
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
OCHM1LightAirconditionDoorStatusManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
OCHM1LightAirconditionDoorStatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onDoorStatusCallback(isOpen: Boolean) {
|
||||
if(isOpen){
|
||||
ToastUtils.showShort("开门状态")
|
||||
}else{
|
||||
ToastUtils.showShort("关门状态")
|
||||
}
|
||||
}
|
||||
|
||||
fun startStopSide() {
|
||||
when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶
|
||||
ToastUtils.showShort("设备未就绪请稍等")
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {//
|
||||
ToastUtils.showShort("启动自动驾驶中")
|
||||
// TODO: 查找线路和订单来确定 CallerAutoPilotControlManager.startAutoPilot(parameters);
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
AdasManager.getInstance().sendPlanningCmd(2)
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
ToastUtils.showShort("平行驾驶中请稍后")
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,52 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerFunctionFragment
|
||||
import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager
|
||||
|
||||
class BusPassengerFunctionPresenter(view: BusPassengerFunctionFragment?) :
|
||||
Presenter<BusPassengerFunctionFragment?>(view)
|
||||
BusBasePassengerFunctionDevicePresenter<BusPassengerFunctionFragment?>(view),
|
||||
OCHPlanningStopSideStatusManager.OCHPlanningActionsCallback {
|
||||
companion object{
|
||||
private const val TAG = "BusPassengerFunctionPresenter"
|
||||
}
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
OCHPlanningStopSideStatusManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
OCHPlanningStopSideStatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onStartAutopilotFailure(
|
||||
actionStatus: OCHPlanningStopSideStatusManager.Status,
|
||||
stopSideStatus: Boolean?,
|
||||
errorInfo: String?
|
||||
) {
|
||||
when (actionStatus) {
|
||||
OCHPlanningStopSideStatusManager.Status.NOSTART -> {
|
||||
ToastUtils.showShort(errorInfo)
|
||||
}
|
||||
OCHPlanningStopSideStatusManager.Status.START -> {
|
||||
ToastUtils.showShort("开始靠边停车")
|
||||
}
|
||||
OCHPlanningStopSideStatusManager.Status.DOING -> {
|
||||
|
||||
}
|
||||
OCHPlanningStopSideStatusManager.Status.Ending -> {
|
||||
stopSideStatus?.let {
|
||||
if(it){
|
||||
ToastUtils.showShort("靠边停车成功")
|
||||
}else{
|
||||
ToastUtils.showShort("靠边停车失败")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,89 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerFunctionSoftFragment
|
||||
import com.mogo.och.common.module.manager.OCHM1LightAirconditionDoorStatusManager
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
|
||||
class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?) :
|
||||
Presenter<BusPassengerFunctionSoftFragment?>(view)
|
||||
BusBasePassengerFunctionDevicePresenter<BusPassengerFunctionSoftFragment?>(view),
|
||||
OCHM1LightAirconditionDoorStatusManager.OCHM1LightAirconditionDoorCallback {
|
||||
companion object {
|
||||
private const val TAG = "BusPassengerFunctionSoftPresenter"
|
||||
}
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
OCHM1LightAirconditionDoorStatusManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 空调状态变化
|
||||
*/
|
||||
override fun onAirconditionStatusCallback(heaterIsOpen: Boolean,airconditionStatus: OCHM1LightAirconditionDoorStatusManager.AirconditionStatus) {
|
||||
mView?.setAirconditionHeaterView(
|
||||
airconditionStatus.isOpen,
|
||||
heaterIsOpen,
|
||||
airconditionStatus.temperature,
|
||||
airconditionStatus.pattert,
|
||||
airconditionStatus.windSpeed
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 暖风机状态变化
|
||||
*/
|
||||
override fun onHeaterStatusCallback(airconditionIsOpen:Boolean,heaterStatue: OCHM1LightAirconditionDoorStatusManager.HeaterStatue) {
|
||||
mView?.setAirconditionHeaterView(
|
||||
heaterStatue.isOpen,
|
||||
airconditionIsOpen,
|
||||
0,
|
||||
0,
|
||||
heaterStatue.windSpeed
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 灯状态变化
|
||||
*/
|
||||
override fun onLightCallback(lightStatus: OCHM1LightAirconditionDoorStatusManager.LightStatus) {
|
||||
mView?.setLightView(lightStatus.isOpenLight1,lightStatus.isOpenLight2,lightStatus.isOpenatmosphere)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置空调
|
||||
*/
|
||||
fun sendRoboBusJinlvM1AirConditionerCmd(switchCmd: Int, modeCmd: Int, windSpeedCmd: Int, temperatureCmd: Int) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(switchCmd,modeCmd,windSpeedCmd,temperatureCmd)
|
||||
}
|
||||
/**
|
||||
* 设置暖风
|
||||
*/
|
||||
fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(switchCmd,windSpeedCmd)
|
||||
}
|
||||
|
||||
fun setLightData(leftLight: Boolean, rightLight: Boolean, atmosphereLight: Boolean) {
|
||||
if (leftLight && rightLight) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1MainLampCmd(1,1)
|
||||
} else if (!leftLight && !rightLight) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1MainLampCmd(2,2)
|
||||
} else {
|
||||
if (leftLight) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1MainLampCmd(1,2)
|
||||
}
|
||||
if (rightLight) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1MainLampCmd(2,1)
|
||||
}
|
||||
}
|
||||
if (atmosphereLight) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(1)
|
||||
} else {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,4 @@ import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerFunctionVideoFragment
|
||||
|
||||
class BusPassengerFunctionVideoPresenter(view: BusPassengerFunctionVideoFragment?) :
|
||||
Presenter<BusPassengerFunctionVideoFragment?>(view)
|
||||
BusBasePassengerFunctionDevicePresenter<BusPassengerFunctionVideoFragment?>(view)
|
||||
@@ -4,4 +4,4 @@ import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment
|
||||
|
||||
class BusPassengerPresenter(view: BusPassengerRouteFragment?) :
|
||||
Presenter<BusPassengerRouteFragment?>(view)
|
||||
BusBasePassengerFunctionDevicePresenter<BusPassengerRouteFragment?>(view)
|
||||
@@ -2,8 +2,11 @@ package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionDevicePresenter
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import kotlinx.android.synthetic.m1.bus_p_function_setting_devices_fragment.*
|
||||
|
||||
/**
|
||||
* @author: yangyakun
|
||||
@@ -16,7 +19,27 @@ class BusPassengerFunctionDeviceFragment :
|
||||
override fun getTagName(): String = TAG
|
||||
|
||||
override fun initViews() {
|
||||
initListener()
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
tv_car_setting_go.setOnClickListener {
|
||||
//判断自动驾驶状态
|
||||
// 自动驾驶状态中: AdasManager.getInstance().sendPlanningCmd(2);
|
||||
// 没有在自动驾驶中:启动自动驾驶 CallerAutoPilotControlManager.INSTANCE.startAutoPilot(parameters);
|
||||
mPresenter?.startStopSide()
|
||||
}
|
||||
tv_car_setting_stopside.setOnClickListener {
|
||||
// 执行靠边停车 AdasManager.getInstance().sendPlanningCmd(1);
|
||||
AdasManager.getInstance().sendPlanningCmd(1);
|
||||
}
|
||||
tv_car_setting_opendoor.onClick {
|
||||
// 开门 AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(2);
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(1);
|
||||
}
|
||||
tv_car_setting_closedoor.onClick {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(2);
|
||||
}
|
||||
}
|
||||
|
||||
override fun createPresenter(): BusPassengerFunctionDevicePresenter =
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.graphics.drawable.ScaleDrawable
|
||||
import android.media.AudioManager
|
||||
@@ -10,10 +9,15 @@ import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionSoftPresenter
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper
|
||||
import com.yangyakun.main.ui.loading.drawable.MineGradientDrawable
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import kotlinx.android.synthetic.m1.bus_p_function_setting_soft_fragment.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
@@ -50,35 +54,266 @@ class BusPassengerFunctionSoftFragment :
|
||||
}
|
||||
}
|
||||
rg_select_function.check(R.id.tv_setting_aircondition)
|
||||
tv_light_top_01.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
setLightImage(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked)
|
||||
}
|
||||
tv_light_top_02.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
setLightImage(tv_light_top_01.isChecked, isChecked, tv_light_atmosphere.isChecked)
|
||||
}
|
||||
tv_light_atmosphere.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
setLightImage(tv_light_top_01.isChecked, tv_light_top_02.isChecked, isChecked)
|
||||
}
|
||||
setAirconditionListener()
|
||||
setLightListener()
|
||||
setVoiceInfo()
|
||||
}
|
||||
|
||||
private fun setAirconditionListener() {
|
||||
// 开关空调或暖风机
|
||||
tv_aircondition_switch.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (tv_aircondition_switch.tag == touchTag) {
|
||||
tv_aircondition_switch.tag = null
|
||||
}else{
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
if (rg_setting_pattern.checkedRadioButtonId==R.id.rb_pattern_heating) {
|
||||
if(isChecked){// 打开暖风机
|
||||
openHeater()
|
||||
}else{// 关闭暖风机
|
||||
closeHeater()
|
||||
}
|
||||
}else{
|
||||
if(isChecked){// 打开空调
|
||||
openAircondition()
|
||||
}else{//关闭空调
|
||||
closeAircondition()
|
||||
}
|
||||
}
|
||||
}
|
||||
// 模式调节
|
||||
rg_setting_pattern.setOnCheckedChangeListener { group, checkedId ->
|
||||
if (rg_setting_pattern.tag == touchTag) {
|
||||
rg_setting_pattern.tag = null
|
||||
}else{
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"调节模式")
|
||||
when (checkedId) {
|
||||
R.id.rb_pattern_heating -> {
|
||||
openHeater()
|
||||
}
|
||||
else -> {
|
||||
openAircondition()
|
||||
}
|
||||
}
|
||||
}
|
||||
// 风速调节
|
||||
rg_setting_windspeed.setOnCheckedChangeListener { group, checkedId ->
|
||||
if (rg_setting_windspeed.tag == touchTag) {
|
||||
rg_setting_windspeed.tag = null
|
||||
}else{
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"调节风速")
|
||||
if (rg_setting_pattern.checkedRadioButtonId==R.id.rb_pattern_heating) {//暖风机
|
||||
openHeater()
|
||||
}else{
|
||||
openAircondition()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭空调
|
||||
*/
|
||||
private fun closeAircondition() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"关闭空调")
|
||||
mPresenter?.sendRoboBusJinlvM1AirConditionerCmd(2,0,0,0)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启空调
|
||||
*/
|
||||
private fun openAircondition() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"打开空调")
|
||||
var modeCmd = 0
|
||||
var windSpeedCmd = 0
|
||||
var temperatureCmd = 0
|
||||
closeHeater()//关闭暖风
|
||||
when (rg_setting_pattern.checkedRadioButtonId) {
|
||||
R.id.rb_pattern_automatic -> modeCmd = 1 // 自动
|
||||
R.id.rb_pattern_refrigeration -> modeCmd = 2 // 制冷
|
||||
R.id.rb_pattern_ventilate -> modeCmd = 3 // 通风
|
||||
else -> {}
|
||||
}
|
||||
when (rg_setting_windspeed.checkedRadioButtonId) {
|
||||
R.id.rb_wind_speed_low -> windSpeedCmd = 1 // 1档
|
||||
R.id.rb_wind_speed_middle -> windSpeedCmd = 2 // 2档
|
||||
R.id.rb_wind_speed_high -> windSpeedCmd = 3 // 3档
|
||||
else -> {}
|
||||
}
|
||||
mPresenter?.sendRoboBusJinlvM1AirConditionerCmd(1,modeCmd,windSpeedCmd,18)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车的状态会写页面状态
|
||||
*/
|
||||
fun setAirconditionHeaterView(airIsOpen:Boolean,heaterIsOpen:Boolean,temperatureCmd:Int,pattern:Int,windSpeed:Int){
|
||||
if(!airIsOpen&&!heaterIsOpen){
|
||||
tv_aircondition_switch.tag = touchTag
|
||||
tv_aircondition_switch.isChecked = false
|
||||
}else{
|
||||
tv_aircondition_switch.tag = touchTag
|
||||
tv_aircondition_switch.isChecked = true
|
||||
}
|
||||
if(airIsOpen){
|
||||
// TODO: 差一个温度
|
||||
rg_setting_pattern.tag = touchTag
|
||||
when (pattern) {//1: 自动模式, 2: 制冷模式, 3: 通风模式(仅送风,无温度)
|
||||
1 -> {rb_pattern_automatic.isChecked = true}
|
||||
2 -> {rb_pattern_refrigeration.isChecked = true}
|
||||
3 -> {rb_pattern_ventilate.isChecked = true}
|
||||
else -> {}
|
||||
}
|
||||
heaterAirEnable(true)
|
||||
rg_setting_windspeed.tag = touchTag
|
||||
when (windSpeed) {//1: 1档,2: 2档,3:3档
|
||||
1 -> {rb_wind_speed_low.isChecked = true}
|
||||
2 -> {rb_wind_speed_middle.isChecked = true}
|
||||
3 -> {rb_wind_speed_high.isChecked = true}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
if(heaterIsOpen){
|
||||
rg_setting_pattern.tag = touchTag
|
||||
rb_pattern_heating.isChecked = true
|
||||
heaterAirEnable(false)
|
||||
rg_setting_windspeed.tag = touchTag
|
||||
when (windSpeed) {//1: 1档,2: 2档
|
||||
1 -> {rb_wind_speed_middle.isChecked = true}
|
||||
2 -> {rb_wind_speed_high.isChecked = true}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭暖风机
|
||||
*/
|
||||
private fun closeHeater() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"关闭暖风")
|
||||
heaterAirEnable(true)
|
||||
when (rg_setting_windspeed.checkedRadioButtonId) {
|
||||
R.id.rb_wind_speed_low -> {}
|
||||
R.id.rb_wind_speed_middle -> {
|
||||
mPresenter?.sendRoboBusJinlvM1HeaderCmd(2,1)
|
||||
}
|
||||
R.id.rb_wind_speed_high -> {
|
||||
mPresenter?.sendRoboBusJinlvM1HeaderCmd(2,2)
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(2,2)
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun heaterAirEnable(enable:Boolean){
|
||||
tv_temperature_title.isEnabled = enable
|
||||
v_temp.isEnabled = enable
|
||||
rb_wind_speed_low.isEnabled = enable
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启暖风机
|
||||
*/
|
||||
private fun openHeater() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"打开暖风")
|
||||
heaterAirEnable(false)
|
||||
closeAircondition()//关闭空调
|
||||
when (rg_setting_windspeed.checkedRadioButtonId) {
|
||||
R.id.rb_wind_speed_low -> {
|
||||
rb_wind_speed_middle.tag = touchTag
|
||||
rb_wind_speed_middle.toggle()
|
||||
}
|
||||
R.id.rb_wind_speed_middle -> {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(1,1)
|
||||
}
|
||||
R.id.rb_wind_speed_high -> {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(1,2)
|
||||
}
|
||||
else -> {
|
||||
rb_wind_speed_middle.tag = touchTag
|
||||
rb_wind_speed_middle.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// region 灯
|
||||
private fun setLightListener() {
|
||||
tv_light_top_01.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
mPresenter?.setLightData(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked)
|
||||
setLightView(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked)
|
||||
}
|
||||
tv_light_top_02.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
mPresenter?.setLightData(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked)
|
||||
setLightView(tv_light_top_01.isChecked, isChecked, tv_light_atmosphere.isChecked)
|
||||
|
||||
}
|
||||
tv_light_atmosphere.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
mPresenter?.setLightData(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked)
|
||||
setLightView(tv_light_top_01.isChecked, tv_light_top_02.isChecked, isChecked)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 灯的UI发生变化
|
||||
*/
|
||||
fun setLightView(leftLight: Boolean, rightLight: Boolean, atmosphereLight: Boolean) {
|
||||
if(leftLight){
|
||||
tv_light_top_01.text = requireContext().getString(R.string.bus_p_m1_close_light1)
|
||||
}else{
|
||||
tv_light_top_01.text = requireContext().getString(R.string.bus_p_m1_open_light1)
|
||||
}
|
||||
if(rightLight){
|
||||
tv_light_top_02.text = requireContext().getString(R.string.bus_p_m1_close_light2)
|
||||
}else{
|
||||
tv_light_top_02.text = requireContext().getString(R.string.bus_p_m1_open_light2)
|
||||
}
|
||||
if (leftLight && rightLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_middle_selected)// 都打开
|
||||
} else if (!leftLight && !rightLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_nor)// 都关闭
|
||||
} else {
|
||||
if (leftLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_select_left)// 左面开
|
||||
}
|
||||
if (rightLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_select_right)// 左面开
|
||||
}
|
||||
}
|
||||
if (atmosphereLight) {
|
||||
tv_light_atmosphere.text = requireContext().getString(R.string.bus_p_m1_close_atmosphere)
|
||||
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_select)
|
||||
} else {
|
||||
tv_light_atmosphere.text = requireContext().getString(R.string.bus_p_m1_open_atmosphere)
|
||||
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_nor)
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region 声音
|
||||
private var mAudioManager: AudioManager? = null
|
||||
private var mMaxVolume: Int? = 100;
|
||||
|
||||
|
||||
private fun setVoiceInfo() {
|
||||
val dp2px = AutoSizeUtils.dp2px(context, 26f)//进度条高度
|
||||
val temp03 =
|
||||
MineGradientDrawable(Color.parseColor("#2CBFFC"), Color.parseColor("#1060FF"), dp2px)
|
||||
R.color.bus_p_m1_47576E
|
||||
val color2CBFFC = ContextCompat.getColor(requireContext(), R.color.bus_p_m1_2cbffc)
|
||||
val color1060FF = ContextCompat.getColor(requireContext(), R.color.bus_p_m1_1060ff)
|
||||
val color96A5C2 = ContextCompat.getColor(requireContext(), R.color.bus_p_m1_96a5c2)
|
||||
val temp03 = MineGradientDrawable(color2CBFFC, color1060FF, dp2px)
|
||||
val scaleDrawable3 = ScaleDrawable(temp03, Gravity.START, 1f, 0f)
|
||||
val temp01 =
|
||||
MineGradientDrawable(Color.parseColor("#96A5C2"), Color.parseColor("#96A5C2"), dp2px)
|
||||
val temp01 = MineGradientDrawable(color96A5C2, color96A5C2, dp2px)
|
||||
val arr = arrayOf(temp01, scaleDrawable3)
|
||||
val ld = LayerDrawable(arr)
|
||||
ld.setDrawableByLayerId(android.R.id.background, temp01)
|
||||
ld.setDrawableByLayerId(android.R.id.progress, scaleDrawable3)
|
||||
sb_voice_bar.setProgressDrawableTiled(ld)
|
||||
sb_voice_bar.max = 100
|
||||
sb_voice_bar.min = 5
|
||||
sb_voice_bar.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
tv_current_voice_value.text = "$progress%"
|
||||
@@ -118,32 +353,15 @@ class BusPassengerFunctionSoftFragment :
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun setLightImage(leftLight: Boolean, rightLight: Boolean, atmosphereLight: Boolean) {
|
||||
if (leftLight && rightLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_middle_selected)// 都打开
|
||||
} else if (!leftLight && !rightLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_nor)// 都关闭
|
||||
} else {
|
||||
if (leftLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_select_left)// 左面开
|
||||
}
|
||||
if (rightLight) {
|
||||
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_select_right)// 左面开
|
||||
}
|
||||
}
|
||||
if (atmosphereLight) {
|
||||
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_select)
|
||||
} else {
|
||||
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_nor)
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
|
||||
override fun createPresenter(): BusPassengerFunctionSoftPresenter =
|
||||
BusPassengerFunctionSoftPresenter(this)
|
||||
|
||||
companion object {
|
||||
const val TAG = "BusPassengerFunctionSoftFragment"
|
||||
const val touchTagKey = 2
|
||||
const val touchTag = 2
|
||||
@JvmStatic
|
||||
fun newInstance(): BusPassengerFunctionSoftFragment {
|
||||
val args = Bundle()
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.mogo.och.bus.passenger.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class PickerLayoutManager extends LinearLayoutManager {
|
||||
|
||||
private float scaleDownBy = 0.66f;
|
||||
private float scaleDownDistance = 0.9f;
|
||||
private boolean changeAlpha = true;
|
||||
|
||||
private onScrollStopListener onScrollStopListener;
|
||||
|
||||
public PickerLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
||||
super(context, orientation, reverseLayout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
scaleDownView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
int orientation = getOrientation();
|
||||
if (orientation == HORIZONTAL) {
|
||||
int scrolled = super.scrollHorizontallyBy(dx, recycler, state);
|
||||
scaleDownView();
|
||||
return scrolled;
|
||||
} else return 0;
|
||||
}
|
||||
|
||||
private void scaleDownView() {
|
||||
float mid = getWidth() / 2.0f;
|
||||
float unitScaleDownDist = scaleDownDistance * mid;
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View child = getChildAt(i);
|
||||
if (child == null) {
|
||||
continue;
|
||||
}
|
||||
float childMid = (getDecoratedLeft(child) + getDecoratedRight(child)) / 2.0f;
|
||||
float scale = 1.0f + (-1 * scaleDownBy) * (Math.min(unitScaleDownDist, Math.abs(mid - childMid))) / unitScaleDownDist;
|
||||
child.setScaleX(scale);
|
||||
child.setScaleY(scale);
|
||||
if (changeAlpha) {
|
||||
child.setAlpha(scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(int state) {
|
||||
super.onScrollStateChanged(state);
|
||||
if (state == 0) {
|
||||
if (onScrollStopListener != null) {
|
||||
int selected = 0;
|
||||
float lastHeight = 0f;
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View child = getChildAt(i);
|
||||
if (child == null) {
|
||||
continue;
|
||||
}
|
||||
if (lastHeight < child.getScaleY()) {
|
||||
lastHeight = child.getScaleY();
|
||||
selected = i;
|
||||
}
|
||||
}
|
||||
onScrollStopListener.selectedView(getChildAt(selected));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getScaleDownBy() {
|
||||
return scaleDownBy;
|
||||
}
|
||||
|
||||
public void setScaleDownBy(float scaleDownBy) {
|
||||
this.scaleDownBy = scaleDownBy;
|
||||
}
|
||||
|
||||
public float getScaleDownDistance() {
|
||||
return scaleDownDistance;
|
||||
}
|
||||
|
||||
public void setScaleDownDistance(float scaleDownDistance) {
|
||||
this.scaleDownDistance = scaleDownDistance;
|
||||
}
|
||||
|
||||
public boolean isChangeAlpha() {
|
||||
return changeAlpha;
|
||||
}
|
||||
|
||||
public void setChangeAlpha(boolean changeAlpha) {
|
||||
this.changeAlpha = changeAlpha;
|
||||
}
|
||||
|
||||
public void setOnScrollStopListener(onScrollStopListener onScrollStopListener) {
|
||||
this.onScrollStopListener = onScrollStopListener;
|
||||
}
|
||||
|
||||
public interface onScrollStopListener {
|
||||
void selectedView(View view);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import android.graphics.drawable.Drawable
|
||||
import android.util.Log
|
||||
import androidx.core.graphics.toRectF
|
||||
|
||||
/**
|
||||
* 进度条drawable
|
||||
*/
|
||||
class MineGradientDrawable(colorStart: Int = Color.BLUE,colorEnd:Int = Color.RED,height:Int) : Drawable() {
|
||||
|
||||
private var mPaint: Paint = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
@@ -74,7 +77,6 @@ class MineGradientDrawable(colorStart: Int = Color.BLUE,colorEnd:Int = Color.RED
|
||||
countstep++
|
||||
canvas.drawRoundRect(rectF,48f,48f,mPaint)
|
||||
}
|
||||
Log.d("MineGradientDrawable","$countstep-------------$size")
|
||||
}
|
||||
|
||||
override fun setAlpha(alpha: Int) {
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
app:layout_constraintWidth_percent="0.4589">
|
||||
|
||||
<TextView
|
||||
android:gravity="center"
|
||||
android:id="@+id/tv_car_setting_go"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@drawable/bus_p_function_device_go_press_selecor"
|
||||
android:text="出发"
|
||||
android:clickable="true"
|
||||
android:drawableTop="@drawable/bus_p_function_device_go_press_selecor"
|
||||
android:gravity="center"
|
||||
android:text="出发"
|
||||
android:textColor="@color/bus_p_m1_203555"
|
||||
android:textSize="@dimen/dp_28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -35,13 +35,13 @@
|
||||
android:id="@+id/tv_car_setting_stopside"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="靠边停车"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:drawableTop="@drawable/bus_p_function_device_stopside_press_selecor"
|
||||
android:gravity="center"
|
||||
android:text="靠边停车"
|
||||
android:textColor="@color/bus_p_m1_203555"
|
||||
android:textSize="@dimen/dp_28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:drawableTop="@drawable/bus_p_function_device_stopside_press_selecor"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_car_setting_opendoor"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_car_setting_go"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -50,12 +50,12 @@
|
||||
android:id="@+id/tv_car_setting_opendoor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开车门"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:drawableTop="@drawable/bus_p_function_device_opendoor_press_selecor"
|
||||
android:gravity="center"
|
||||
android:text="开车门"
|
||||
android:textColor="@color/bus_p_m1_203555"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:drawableTop="@drawable/bus_p_function_device_opendoor_press_selecor"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_car_setting_closedoor"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_car_setting_stopside"
|
||||
@@ -65,13 +65,13 @@
|
||||
android:id="@+id/tv_car_setting_closedoor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="关车门"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:drawableTop="@drawable/bus_p_function_device_closedoor_press_selecor"
|
||||
android:gravity="center"
|
||||
android:text="关车门"
|
||||
android:textColor="@color/bus_p_m1_203555"
|
||||
android:textSize="@dimen/dp_28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:drawableTop="@drawable/bus_p_function_device_closedoor_press_selecor"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_car_setting_opendoor"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
android:id="@+id/tv_setting_aircondition"
|
||||
android:layout_width="@dimen/dp_160"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="@dimen/dp_26"
|
||||
android:background="@drawable/bus_p_function_airconditon_bg_selector"
|
||||
android:button="@null"
|
||||
android:layout_marginBottom="@dimen/dp_26"
|
||||
android:drawableLeft="@drawable/bus_p_function_airconditon_left_selector"
|
||||
android:drawablePadding="-20dp"
|
||||
android:gravity="center"
|
||||
@@ -43,9 +43,9 @@
|
||||
android:id="@+id/tv_setting_lighting"
|
||||
android:layout_width="@dimen/dp_160"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="@dimen/dp_26"
|
||||
android:background="@drawable/bus_p_function_airconditon_bg_selector"
|
||||
android:button="@null"
|
||||
android:layout_marginBottom="@dimen/dp_26"
|
||||
android:drawableLeft="@drawable/bus_p_function_light_left_selector"
|
||||
android:drawablePadding="-20dp"
|
||||
android:gravity="center"
|
||||
@@ -83,170 +83,177 @@
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/tv_aircondition_switch"
|
||||
android:text="打开空调"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_76"
|
||||
android:background="@drawable/bus_p_function_aircondition_switch_selector"
|
||||
android:button="@null"
|
||||
app:layout_constraintWidth_percent="0.289"
|
||||
android:layout_marginTop="@dimen/dp_57"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:background="@drawable/bus_p_function_aircondition_switch_selector"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
|
||||
android:gravity="center"
|
||||
android:checked="true"
|
||||
android:text="打开空调"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_light_top_02"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/gl_right"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintWidth_percent="0.289" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_temperature_title"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toTopOf="@+id/v_temp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/v_temp"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:textColor="@color/bus_p_m1_47576E"
|
||||
android:text="@string/bus_p_m1_temperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bus_p_m1_temperature"
|
||||
android:textColor="@color/bus_p_m1_47576E"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/v_temp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toTopOf="@+id/v_temp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_temp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_aircondition_switch"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_marginTop="@dimen/dp_41"
|
||||
android:background="@drawable/bus_p_function_aircondition_common_bg"
|
||||
app:layout_constraintWidth_percent="0.244"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_60"/>
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintWidth_percent="0.244" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_aircondition_pattern_title"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toTopOf="@+id/rg_setting_pattern"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rg_setting_pattern"
|
||||
android:text="设置"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:textColor="@color/bus_p_m1_47576E"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设置"
|
||||
android:textColor="@color/bus_p_m1_47576E"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rg_setting_pattern"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toTopOf="@+id/rg_setting_pattern" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_setting_pattern"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_marginTop="@dimen/dp_41"
|
||||
android:background="@drawable/bus_p_function_aircondition_common_bg"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toBottomOf="@+id/v_temp"
|
||||
app:layout_constraintWidth_percent="0.244"
|
||||
android:background="@drawable/bus_p_function_aircondition_common_bg"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_41"
|
||||
android:gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_60">
|
||||
app:layout_constraintWidth_percent="0.244">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pattern_automatic"
|
||||
android:text="@string/bus_p_m1_automatic"
|
||||
android:gravity="center"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_pattern_text_color_selector"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/dp_21"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"/>
|
||||
<RadioButton
|
||||
android:text="@string/bus_p_m1_refrigeration"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:text="@string/bus_p_m1_automatic"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_pattern_text_color_selector"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pattern_refrigeration"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:layout_marginEnd="@dimen/dp_21"
|
||||
android:button="@null"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/dp_21"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_refrigeration"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pattern_heating"
|
||||
android:text="@string/bus_p_m1_heating"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:layout_marginEnd="@dimen/dp_21"
|
||||
android:button="@null"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/dp_21"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_heating"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pattern_ventilate"
|
||||
android:text="@string/bus_p_m1_ventilate"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:button="@null"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_ventilate"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_aircondition_wind_speed_title"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toTopOf="@+id/rg_setting_windspeed"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rg_setting_windspeed"
|
||||
android:text="@string/bus_p_m1_wind_speed"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:textColor="@color/bus_p_m1_47576E"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bus_p_m1_wind_speed"
|
||||
android:textColor="@color/bus_p_m1_47576E"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rg_setting_windspeed"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toTopOf="@+id/rg_setting_windspeed" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_setting_windspeed"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_marginTop="@dimen/dp_41"
|
||||
android:background="@drawable/bus_p_function_aircondition_common_bg"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_aircondition_switch"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rg_setting_pattern"
|
||||
app:layout_constraintWidth_percent="0.244"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bus_p_function_aircondition_common_bg"
|
||||
android:layout_marginTop="@dimen/dp_41"
|
||||
android:gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_60">
|
||||
app:layout_constraintWidth_percent="0.244">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_wind_speed_low"
|
||||
android:text="@string/bus_p_m1_wind_speed_low"
|
||||
android:gravity="center"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_pattern_text_color_selector"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/dp_44"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:checked="true"
|
||||
android:button="@null"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"/>
|
||||
android:checked="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_wind_speed_low"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_pattern_text_color_selector"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_wind_speed_middle"
|
||||
android:text="@string/bus_p_m1_wind_speed_middle"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:layout_marginEnd="@dimen/dp_44"
|
||||
android:button="@null"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/dp_44"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_wind_speed_middle"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_wind_speed_high"
|
||||
android:text="@string/bus_p_m1_wind_speed_high"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:button="@null"
|
||||
android:layout_width="@dimen/dp_59"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bus_p_function_aircondition_pattern_selecotr"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_wind_speed_high"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
</RadioGroup>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
@@ -283,15 +290,15 @@
|
||||
<!--顶部灯01-->
|
||||
<CheckBox
|
||||
android:id="@+id/tv_light_top_01"
|
||||
android:text="关闭顶灯1"
|
||||
android:layout_width="@dimen/dp_220"
|
||||
android:layout_height="@dimen/dp_76"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:background="@drawable/bus_p_function_light_switch_bg_selector"
|
||||
android:button="@null"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
|
||||
android:drawablePadding="-20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_close_light1"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_light_top_02"
|
||||
@@ -302,16 +309,16 @@
|
||||
<!--顶部灯02-->
|
||||
<CheckBox
|
||||
android:id="@+id/tv_light_top_02"
|
||||
android:text="关闭顶灯2"
|
||||
android:layout_width="@dimen/dp_220"
|
||||
android:layout_height="@dimen/dp_76"
|
||||
android:layout_marginTop="@dimen/dp_17"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:background="@drawable/bus_p_function_light_switch_bg_selector"
|
||||
android:button="@null"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:layout_marginTop="@dimen/dp_17"
|
||||
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
|
||||
android:drawablePadding="-20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_close_light2"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_light_atmosphere"
|
||||
@@ -321,16 +328,15 @@
|
||||
<!--氛围灯-->
|
||||
<CheckBox
|
||||
android:id="@+id/tv_light_atmosphere"
|
||||
android:text="关闭氛围灯"
|
||||
android:layout_width="@dimen/dp_220"
|
||||
android:layout_height="@dimen/dp_76"
|
||||
android:layout_marginTop="@dimen/dp_17"
|
||||
android:background="@drawable/bus_p_function_light_switch_bg_selector"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:layout_marginTop="@dimen/dp_17"
|
||||
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
|
||||
android:drawablePadding="-20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_p_m1_close_atmosphere"
|
||||
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -361,65 +367,67 @@
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/sb_voice_bar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:splitTrack="false"
|
||||
app:layout_constraintVertical_bias="0.404"
|
||||
app:layout_constraintWidth_percent="0.253"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:thumbOffset="@dimen/dp_2"
|
||||
android:splitTrack="false"
|
||||
android:thumb="@drawable/bus_p_function_voice_right_process_humb"
|
||||
app:layout_constraintStart_toEndOf="@+id/gl_right"
|
||||
android:thumbOffset="@dimen/dp_2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
app:layout_constraintStart_toEndOf="@+id/gl_right"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.404"
|
||||
app:layout_constraintWidth_percent="0.253" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_voice_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_19"
|
||||
android:text="音量"
|
||||
android:textColor="#374968"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:layout_marginBottom="@dimen/dp_19"
|
||||
app:layout_constraintStart_toStartOf="@+id/sb_voice_bar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/sb_voice_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
app:layout_constraintStart_toStartOf="@+id/sb_voice_bar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_current_voice_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_19"
|
||||
android:text="0%"
|
||||
android:textColor="#374968"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:layout_marginBottom="@dimen/dp_19"
|
||||
app:layout_constraintEnd_toEndOf="@+id/sb_voice_bar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/sb_voice_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
app:layout_constraintEnd_toEndOf="@+id/sb_voice_bar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_start_voice"
|
||||
android:layout_width="@dimen/dp_21"
|
||||
android:layout_height="@dimen/dp_23"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:src="@drawable/bus_p_function_voice_min"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sb_voice_bar"
|
||||
app:layout_constraintStart_toStartOf="@+id/sb_voice_bar"
|
||||
android:layout_width="@dimen/dp_21"
|
||||
android:layout_height="@dimen/dp_23"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/sb_voice_bar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_end_voice"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_23"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/bus_p_function_voice_max"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sb_voice_bar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/sb_voice_bar"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_23"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/sb_voice_bar" />
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/g_voice_setting"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="iv_voice,sb_voice_bar,tv_voice_title,iv_end_voice,iv_start_voice,tv_current_voice_value" />
|
||||
<!--endregion-->
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
<color name="bus_p_m1_203555">#203555</color>
|
||||
<color name="bus_p_m1_47576E">#47576E</color>
|
||||
<color name="bus_p_m1_374968">#374968</color>
|
||||
<color name="bus_p_m1_2cbffc">#2CBFFC</color>
|
||||
<color name="bus_p_m1_1060ff">#1060FF</color>
|
||||
<color name="bus_p_m1_96a5c2">#96A5C2</color>
|
||||
|
||||
<color name="bus_p_m1_CCFFFFFF">#CCFFFFFF</color>
|
||||
</resources>
|
||||
@@ -12,4 +12,15 @@
|
||||
<string name="bus_p_m1_wind_speed_middle">中</string>
|
||||
<string name="bus_p_m1_wind_speed_high">高</string>
|
||||
|
||||
|
||||
<string name="bus_p_m1_close_light1">关闭顶灯1</string>
|
||||
<string name="bus_p_m1_close_light2">关闭顶灯2</string>
|
||||
<string name="bus_p_m1_close_atmosphere">关闭氛围灯</string>
|
||||
|
||||
<string name="bus_p_m1_open_light1">开启顶灯1</string>
|
||||
<string name="bus_p_m1_open_light2">开启顶灯2</string>
|
||||
<string name="bus_p_m1_open_atmosphere">开启氛围灯</string>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
BIN
OCH/mogo-och-bus-passenger/src/main/res/raw/bus_di.mp3
Normal file
BIN
OCH/mogo-och-bus-passenger/src/main/res/raw/bus_di.mp3
Normal file
Binary file not shown.
@@ -0,0 +1,133 @@
|
||||
package com.mogo.och.common.module.manager
|
||||
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StatesListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerRoboBusJinlvM1StatesListenerManager
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object OCHM1LightAirconditionDoorStatusManager : IMoGoRoboBusJinlvM1StatesListener {
|
||||
private const val TAG = "OCHM1LightAirconditionDoorStatusManager"
|
||||
|
||||
init {
|
||||
CallerRoboBusJinlvM1StatesListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
val M_LISTENERS: ConcurrentHashMap<String, OCHM1LightAirconditionDoorCallback> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
val airconditionStatus = AirconditionStatus(false, 0, 26, 2)
|
||||
val heaterStatue = HeaterStatue(false, 2)
|
||||
val doorStatus = DoorStatus(false)
|
||||
val lightStatus = LightStatus(false, false, false)
|
||||
|
||||
fun addListener(
|
||||
tag: String,
|
||||
listener: OCHM1LightAirconditionDoorCallback
|
||||
) {
|
||||
if (M_LISTENERS.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_LISTENERS[tag] = listener
|
||||
}
|
||||
|
||||
fun removeListener(tag: String) {
|
||||
if (!M_LISTENERS.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_LISTENERS.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监听
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun removeListener(listener: OCHM1LightAirconditionDoorCallback) {
|
||||
if (!M_LISTENERS.containsValue(listener)) {
|
||||
return
|
||||
}
|
||||
M_LISTENERS.forEach {
|
||||
if (it.value == listener) {
|
||||
M_LISTENERS.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface OCHM1LightAirconditionDoorCallback {
|
||||
|
||||
fun onAirconditionStatusCallback(heaterIsOpen:Boolean,airconditionStatus: AirconditionStatus){}
|
||||
|
||||
fun onHeaterStatusCallback(airconditionIsOpen: Boolean,heaterStatue: HeaterStatue){}
|
||||
|
||||
fun onDoorStatusCallback(isOpen: Boolean){}
|
||||
|
||||
fun onLightCallback(lightStatus: LightStatus){}
|
||||
|
||||
}
|
||||
|
||||
data class AirconditionStatus(
|
||||
var isOpen: Boolean,
|
||||
var pattert: Int,
|
||||
var temperature: Int,
|
||||
var windSpeed: Int
|
||||
)
|
||||
|
||||
data class HeaterStatue(var isOpen: Boolean, var windSpeed: Int)
|
||||
data class DoorStatus(var isOpen: Boolean)
|
||||
data class LightStatus(
|
||||
var isOpenLight1: Boolean,
|
||||
var isOpenLight2: Boolean,
|
||||
var isOpenatmosphere: Boolean
|
||||
)
|
||||
|
||||
override fun onRoboBusJinlvM1States(states: VehicleStateOuterClass.RoboBusJinlvM1State) {
|
||||
val airConditionerState = states.airConditionerState
|
||||
val heaterState = states.heaterState
|
||||
if (airConditionerState.isOn != airconditionStatus.isOpen ||
|
||||
airConditionerState.mode != airconditionStatus.pattert ||
|
||||
airConditionerState.temperature != airconditionStatus.temperature ||
|
||||
airConditionerState.windSpeed != airconditionStatus.windSpeed
|
||||
) {
|
||||
airconditionStatus.isOpen = airConditionerState.isOn
|
||||
airconditionStatus.pattert = airConditionerState.mode
|
||||
airconditionStatus.temperature = airConditionerState.temperature
|
||||
airconditionStatus.windSpeed = airConditionerState.windSpeed
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onAirconditionStatusCallback(heaterState.isOn,airconditionStatus)
|
||||
}
|
||||
}
|
||||
if (heaterState.isOn != heaterStatue.isOpen ||
|
||||
heaterState.windSpeed != heaterStatue.windSpeed
|
||||
) {
|
||||
heaterStatue.isOpen = heaterState.isOn
|
||||
heaterStatue.windSpeed = heaterState.windSpeed
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onHeaterStatusCallback(airConditionerState.isOn,heaterStatue)
|
||||
}
|
||||
}
|
||||
if (states.frontDoorState.isOn != doorStatus.isOpen) {
|
||||
doorStatus.isOpen = states.frontDoorState.isOn
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onDoorStatusCallback(doorStatus.isOpen)
|
||||
}
|
||||
}
|
||||
if (states.mainLamp1State.isOn != lightStatus.isOpenLight1||
|
||||
states.mainLamp2State.isOn != lightStatus.isOpenLight2||
|
||||
states.smallLampState.isOn != lightStatus.isOpenatmosphere) {
|
||||
lightStatus.isOpenLight1 = states.mainLamp1State.isOn
|
||||
lightStatus.isOpenLight2 = states.mainLamp2State.isOn
|
||||
lightStatus.isOpenatmosphere = states.smallLampState.isOn
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onLightCallback(lightStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.mogo.och.common.module.manager
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener {
|
||||
private const val TAG = "OCHPlanningActionsManager"
|
||||
|
||||
init {
|
||||
CallerPlanningActionsListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
val M_LISTENERS: ConcurrentHashMap<String, OCHPlanningActionsCallback> = ConcurrentHashMap()
|
||||
|
||||
fun addListener(
|
||||
tag: String,
|
||||
listener: OCHPlanningActionsCallback
|
||||
) {
|
||||
if (M_LISTENERS.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_LISTENERS[tag] = listener
|
||||
}
|
||||
|
||||
fun removeListener(tag: String) {
|
||||
if (!M_LISTENERS.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_LISTENERS.remove(tag)
|
||||
}
|
||||
/**
|
||||
* 删除监听
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun removeListener(listener: OCHPlanningActionsCallback) {
|
||||
if (!M_LISTENERS.containsValue(listener)) {
|
||||
return
|
||||
}
|
||||
M_LISTENERS.forEach {
|
||||
if (it.value == listener) {
|
||||
M_LISTENERS.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) {
|
||||
val drivingState = planningActionMsg.parkScenarioAction.actionMsg.drivingState
|
||||
val drivingAction = planningActionMsg.parkScenarioAction.actionMsg.drivingAction
|
||||
when (drivingState) {
|
||||
MessagePad.ParkScenarioDrivingState.PARK_SENARIO_FORCE_PULL_OVER_ON -> {
|
||||
when (drivingAction) {
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_ONE -> {
|
||||
// 表示开始靠边停车
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.START,null,null)
|
||||
listener.onStartAutopilotFailure(Status.DOING,null,null)
|
||||
}
|
||||
}
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_TWO -> {
|
||||
//表示靠边停车成功
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.Ending,true,null)
|
||||
}
|
||||
}
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_THREE -> {
|
||||
//靠边停车失败
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.Ending,false,null)
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
MessagePad.ParkScenarioDrivingState.PARK_SENARIO_FORCE_PULL_OVER_OFF -> {
|
||||
when (drivingAction) {
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_ONE -> {
|
||||
// 表示距离前方站点100m
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"距离前方站点100m")
|
||||
}
|
||||
}
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_TWO -> {
|
||||
//表示距离路口100m
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"距离路口100m")
|
||||
}
|
||||
}
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_THREE -> {
|
||||
//正在变道
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"正在变道")
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
//未知问题
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"正在变道")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
enum class Status(val code: Int){
|
||||
NOSTART(-1),
|
||||
START(0),
|
||||
DOING(1),
|
||||
Ending(2)
|
||||
}
|
||||
|
||||
interface OCHPlanningActionsCallback {
|
||||
fun onStartAutopilotFailure(actionStatus:Status,stopSideStatus : Boolean?, errorInfo : String?)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user