From 6d7f7309c65d5d9d4c853cce8c7dd984d2f0d394 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 9 Feb 2023 23:42:54 +0800 Subject: [PATCH] =?UTF-8?q?[m1]=20[1.0.0]=20[=E5=9B=9E=E5=86=99=E5=B9=B6?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E7=A6=81=E6=AD=A2=E5=86=8D=E5=90=91=E5=BA=95?= =?UTF-8?q?=E7=9B=98=E4=BC=A0=E9=80=92=E6=95=B0=E6=8D=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusPassengerFunctionSoftPresenter.kt | 40 +++++++---- .../ui/BusPassengerFunctionSoftFragment.kt | 72 +++++++++++++------ 2 files changed, 78 insertions(+), 34 deletions(-) diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionSoftPresenter.kt b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionSoftPresenter.kt index 67b7555524..48ade86299 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionSoftPresenter.kt +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionSoftPresenter.kt @@ -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) } diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt index bb5e366e4a..299a5b1e56 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt @@ -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)