[1.0.0]
[回写并展示禁止再向底盘传递数据]
This commit is contained in:
yangyakun
2023-02-09 23:42:54 +08:00
parent c388eec1f0
commit 6d7f7309c6
2 changed files with 78 additions and 34 deletions

View File

@@ -29,30 +29,42 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?)
* 空调状态变化
*/
override fun onAirconditionStatusCallback(heaterIsOpen: Boolean,airconditionStatus: OCHM1LightAirconditionDoorStatusManager.AirconditionStatus) {
// mView?.setAirconditionHeaterView(
// airconditionStatus.isOpen,
// heaterIsOpen,
// airconditionStatus.temperature,
// airconditionStatus.pattert,
// airconditionStatus.windSpeed
// )
CallerLogger.d(SceneConstant.M_BUS_P + TAG,
"回写--空调开关:${OCHM1LightAirconditionDoorStatusManager.airconditionStatus.isOpen}" +
"空调温度:${OCHM1LightAirconditionDoorStatusManager.airconditionStatus.temperature}" +
"空调模式:${OCHM1LightAirconditionDoorStatusManager.airconditionStatus.pattert}" +
"空调风速:${OCHM1LightAirconditionDoorStatusManager.airconditionStatus.windSpeed}")
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
// )
CallerLogger.d(SceneConstant.M_BUS_P + TAG,
"回写--暖风机开关:${heaterStatue.isOpen}" +
"空调风速:${heaterStatue.windSpeed}")
mView?.setAirconditionHeaterView(
airconditionIsOpen,
heaterStatue.isOpen,
0,
0,
heaterStatue.windSpeed
)
}
/**
* 灯状态变化
*/
override fun onLightCallback(lightStatus: OCHM1LightAirconditionDoorStatusManager.LightStatus) {
CallerLogger.d(SceneConstant.M_BUS_P + TAG,
"回写--顶灯1开关:${lightStatus.isOpenLight1}" +
"顶灯2开关:${lightStatus.isOpenLight2}" +
"氛围灯开关:${lightStatus.isOpenatmosphere}")
mView?.setLightView(lightStatus.isOpenLight1,lightStatus.isOpenLight2,lightStatus.isOpenatmosphere)
}

View File

@@ -2,6 +2,7 @@ package com.mogo.och.bus.passenger.ui
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ClipDrawable
import android.graphics.drawable.LayerDrawable
import android.graphics.drawable.ScaleDrawable
import android.media.AudioManager
@@ -75,11 +76,10 @@ class BusPassengerFunctionSoftFragment :
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(!buttonView.isPressed){
return@setOnCheckedChangeListener
}
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {
if (isChecked) {// 打开暖风机
openHeater()
@@ -99,16 +99,36 @@ class BusPassengerFunctionSoftFragment :
if (!tv_aircondition_switch.isChecked) {
return@setOnCheckedChangeListener
}
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 -> {
if(!rb_pattern_heating.isPressed){
return@setOnCheckedChangeListener
}
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
openHeater()
}
R.id.rb_pattern_automatic->{
if(!rb_pattern_automatic.isPressed){
return@setOnCheckedChangeListener
}
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
openAircondition()
}
R.id.rb_pattern_refrigeration->{
if(!rb_pattern_refrigeration.isPressed){
return@setOnCheckedChangeListener
}
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
openAircondition()
}
R.id.rb_pattern_ventilate->{
if(!rb_pattern_ventilate.isPressed){
return@setOnCheckedChangeListener
}
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
openAircondition()
}
else -> {
openAircondition()
}
@@ -120,11 +140,25 @@ class BusPassengerFunctionSoftFragment :
if (!tv_aircondition_switch.isChecked) {
return@setOnCheckedChangeListener
}
if (rg_setting_windspeed.tag == touchTag) {
rg_setting_windspeed.tag = null
}else{
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
when (checkedId) {
R.id.rb_wind_speed_low-> {
if(!rb_wind_speed_low.isPressed){
return@setOnCheckedChangeListener
}
}
R.id.rb_wind_speed_middle-> {
if(!rb_wind_speed_middle.isPressed){
return@setOnCheckedChangeListener
}
}
R.id.rb_wind_speed_high-> {
if(!rb_wind_speed_high.isPressed){
return@setOnCheckedChangeListener
}
}
else -> {}
}
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {//暖风机
openHeater()
} else {
@@ -147,6 +181,7 @@ class BusPassengerFunctionSoftFragment :
pickerLayoutManager.setOnScrollStopListener { view ->
if (view is TextView) {
view.setTextColor(Color.WHITE)
// 未拖到中点、自动滚动到中点会短时间触发两次
if (ClickUtils.isClickTooFrequent(rv_aircondition_temperature)) {
return@setOnScrollStopListener
}
@@ -156,6 +191,7 @@ class BusPassengerFunctionSoftFragment :
ToastUtils.showShort(tag.value)
if(rv_aircondition_temperature.tag== touchTag){
rv_aircondition_temperature.tag = null
return@setOnScrollStopListener
}else {
SoundPoolHelper.getSoundPoolHelper()
.playSoundWithRedId(context, R.raw.bus_di)
@@ -229,10 +265,8 @@ class BusPassengerFunctionSoftFragment :
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) {
@@ -245,7 +279,6 @@ class BusPassengerFunctionSoftFragment :
}
}
}
rg_setting_pattern.tag = touchTag
when (pattern) {//1: 自动模式, 2: 制冷模式, 3: 通风模式(仅送风,无温度)
1 -> {rb_pattern_automatic.isChecked = true}
2 -> {rb_pattern_refrigeration.isChecked = true}
@@ -253,7 +286,6 @@ class BusPassengerFunctionSoftFragment :
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}
@@ -262,10 +294,8 @@ class BusPassengerFunctionSoftFragment :
}
}
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}
@@ -304,6 +334,7 @@ class BusPassengerFunctionSoftFragment :
R.id.rb_wind_speed_low -> {
rb_wind_speed_middle.tag = touchTag
rb_wind_speed_middle.toggle()
mPresenter?.openAndSetHeader(1)
}
R.id.rb_wind_speed_middle -> {
mPresenter?.openAndSetHeader(1)
@@ -314,6 +345,7 @@ class BusPassengerFunctionSoftFragment :
else -> {
rb_wind_speed_middle.tag = touchTag
rb_wind_speed_middle.toggle()
mPresenter?.openAndSetHeader(1)
}
}
}
@@ -414,7 +446,7 @@ class BusPassengerFunctionSoftFragment :
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 scaleDrawable3 = ClipDrawable(temp03, Gravity.START, ClipDrawable.HORIZONTAL)
val temp01 = MineGradientDrawable(color96A5C2, color96A5C2, dp2px)
val arr = arrayOf(temp01, scaleDrawable3)
val ld = LayerDrawable(arr)