From 5edd005b3098752b1877a31f32382efb567b9f12 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 9 Feb 2023 15:06:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[m1]=20[1.0.0]=20[=E7=9E=AC=E9=97=B4?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=A7=A6=E5=8F=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusPassengerFunctionDevicePresenter.kt | 33 ++-- .../BusPassengerFunctionSoftPresenter.kt | 82 +++++---- .../ui/BusPassengerFunctionSoftFragment.kt | 157 ++++++++++-------- .../bus/passenger/view/DrawableCheckBox.java | 70 ++++++++ .../passenger/view/PickerLayoutManager.java | 12 ++ ...s_p_function_aircondition_common_bg_01.xml | 6 + .../bus_p_function_setting_soft_fragment.xml | 29 +++- ...OCHM1LightAirconditionDoorStatusManager.kt | 3 + 8 files changed, 272 insertions(+), 120 deletions(-) create mode 100644 OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/DrawableCheckBox.java create mode 100644 OCH/mogo-och-bus-passenger/src/m1/res/drawable/bus_p_function_aircondition_common_bg_01.xml diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt index 47ce998aa4..b120fa7baf 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt @@ -35,22 +35,23 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme } 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 -> {} - } + AdasManager.getInstance().sendPlanningCmd(2) +// 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 -> {} +// } } } \ No newline at end of file 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 28ed65446a..0647a0d6df 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 @@ -2,6 +2,8 @@ package com.mogo.och.bus.passenger.presenter import androidx.lifecycle.LifecycleOwner import com.mogo.commons.mvp.Presenter +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.ui.BusPassengerFunctionSoftFragment import com.mogo.och.common.module.manager.OCHM1LightAirconditionDoorStatusManager import com.zhidao.support.adas.high.AdasManager @@ -20,66 +22,82 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?) override fun onDestroy(owner: LifecycleOwner) { super.onDestroy(owner) - + OCHM1LightAirconditionDoorStatusManager.removeListener(TAG) } /** * 空调状态变化 */ override fun onAirconditionStatusCallback(heaterIsOpen: Boolean,airconditionStatus: OCHM1LightAirconditionDoorStatusManager.AirconditionStatus) { - mView?.setAirconditionHeaterView( - airconditionStatus.isOpen, - heaterIsOpen, - airconditionStatus.temperature, - airconditionStatus.pattert, - 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 - ) +// mView?.setAirconditionHeaterView( +// heaterStatue.isOpen, +// airconditionIsOpen, +// 0, +// 0, +// heaterStatue.windSpeed +// ) } /** * 灯状态变化 */ override fun onLightCallback(lightStatus: OCHM1LightAirconditionDoorStatusManager.LightStatus) { - mView?.setLightView(lightStatus.isOpenLight1,lightStatus.isOpenLight2,lightStatus.isOpenatmosphere) + //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 openAndSetAircondition(modeCmd: Int, windSpeedCmd: Int, temperatureCmd: Int) { + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "打开空调,模式$modeCmd--档位${windSpeedCmd}--温度:$temperatureCmd") + AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(1,modeCmd,windSpeedCmd,temperatureCmd) + } + fun closeAircondition() { + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "关闭空调") + AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(2,0,0,0) } /** * 设置暖风 */ - fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int) { - AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(switchCmd,windSpeedCmd) + fun openAndSetHeader(windSpeedCmd: Int) { + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "打开暖风机、档位${windSpeedCmd}") + AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(1,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) - } + fun closeHeader(){ + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "关闭暖风机") + AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(2,0) + } + + fun setLightData1(leftLight: Boolean){ + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "顶灯2:$leftLight") + if(leftLight){ + AdasManager.getInstance().sendRoboBusJinlvM1MainLamp1Cmd(1) + }else{ + AdasManager.getInstance().sendRoboBusJinlvM1MainLamp1Cmd(2) } + } + fun setLightData2(rightLight: Boolean){ + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "顶灯1:$rightLight") + if(rightLight){ + AdasManager.getInstance().sendRoboBusJinlvM1MainLamp2Cmd(1) + }else{ + AdasManager.getInstance().sendRoboBusJinlvM1MainLamp2Cmd(2) + } + } + fun setAtmosphereLightData2(atmosphereLight: Boolean){ + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "氛围灯:$atmosphereLight") if (atmosphereLight) { AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(1) } else { 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 d910a1c474..220d1d6a23 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 @@ -1,6 +1,7 @@ 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 @@ -17,6 +18,7 @@ import androidx.recyclerview.widget.SnapHelper 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.eagle.core.utilcode.util.ClickUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.och.bus.passenger.R import com.mogo.och.bus.passenger.bean.Temperature @@ -41,7 +43,7 @@ class BusPassengerFunctionSoftFragment : override fun getTagName(): String = TAG - private var currentTemperature:Temperature?=null + private var currentTemperature: Temperature? = null override fun initViews() { rg_select_function.setOnCheckedChangeListener { group, checkedId -> @@ -78,16 +80,16 @@ class BusPassengerFunctionSoftFragment : }else{ SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) } - if (rg_setting_pattern.checkedRadioButtonId==R.id.rb_pattern_heating) { - if(isChecked){// 打开暖风机 + if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) { + if (isChecked) {// 打开暖风机 openHeater() - }else{// 关闭暖风机 + } else {// 关闭暖风机 closeHeater() } - }else{ - if(isChecked){// 打开空调 + } else { + if (isChecked) {// 打开空调 openAircondition() - }else{//关闭空调 + } else {//关闭空调 closeAircondition() } } @@ -99,7 +101,7 @@ class BusPassengerFunctionSoftFragment : }else{ SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) } - CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"调节模式") + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "调节模式") when (checkedId) { R.id.rb_pattern_heating -> { openHeater() @@ -109,9 +111,10 @@ class BusPassengerFunctionSoftFragment : } } } - val pickerLayoutManager = PickerLayoutManager(requireContext(), PickerLayoutManager.HORIZONTAL, false) + val pickerLayoutManager = + PickerLayoutManager(requireContext(), PickerLayoutManager.HORIZONTAL, false) pickerLayoutManager.isChangeAlpha = true - pickerLayoutManager.scaleDownBy = 0.39f + pickerLayoutManager.scaleDownBy = 0.29f pickerLayoutManager.scaleDownDistance = 0.8f val adapter = TemperatureAdapter(requireContext(), getData(), rv_aircondition_temperature) @@ -119,7 +122,7 @@ class BusPassengerFunctionSoftFragment : snapHelper.attachToRecyclerView(rv_aircondition_temperature) rv_aircondition_temperature.layoutManager = pickerLayoutManager rv_aircondition_temperature.adapter = adapter - rv_aircondition_temperature.addItemDecoration(HorizontalDecoration(20)) + rv_aircondition_temperature.addItemDecoration(HorizontalDecoration(15)) // 风速调节 rg_setting_windspeed.setOnCheckedChangeListener { group, checkedId -> @@ -128,16 +131,19 @@ class BusPassengerFunctionSoftFragment : }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) {//暖风机 + if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {//暖风机 openHeater() - }else{ + } else { openAircondition() } } pickerLayoutManager.setOnScrollStopListener { view -> if (view is TextView) { + view.setTextColor(Color.WHITE) + if (ClickUtils.isClickTooFrequent(rv_aircondition_temperature)) { + return@setOnScrollStopListener + } val tag = view.tag if (tag is Temperature) { currentTemperature = tag @@ -150,23 +156,24 @@ class BusPassengerFunctionSoftFragment : } openAircondition() } + } } } private fun getData(): MutableList { val mutableListOf = mutableListOf() - mutableListOf.add(Temperature(0,16,"16°")) - mutableListOf.add(Temperature(1,17,"17°")) - mutableListOf.add(Temperature(2,18,"18°")) - mutableListOf.add(Temperature(3,19,"19°")) - mutableListOf.add(Temperature(4,20,"20°")) - mutableListOf.add(Temperature(5,21,"21°")) - mutableListOf.add(Temperature(6,22,"22°")) - mutableListOf.add(Temperature(7,23,"23°")) - mutableListOf.add(Temperature(8,24,"24°")) - mutableListOf.add(Temperature(9,25,"25°")) - mutableListOf.add(Temperature(10,26,"26°")) + mutableListOf.add(Temperature(0, 16, "16°")) + mutableListOf.add(Temperature(1, 17, "17°")) + mutableListOf.add(Temperature(2, 18, "18°")) + mutableListOf.add(Temperature(3, 19, "19°")) + mutableListOf.add(Temperature(4, 20, "20°")) + mutableListOf.add(Temperature(5, 21, "21°")) + mutableListOf.add(Temperature(6, 22, "22°")) + mutableListOf.add(Temperature(7, 23, "23°")) + mutableListOf.add(Temperature(8, 24, "24°")) + mutableListOf.add(Temperature(9, 25, "25°")) + mutableListOf.add(Temperature(10, 26, "26°")) return mutableListOf } @@ -174,50 +181,56 @@ class BusPassengerFunctionSoftFragment : * 关闭空调 */ private fun closeAircondition() { - CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"关闭空调") - mPresenter?.sendRoboBusJinlvM1AirConditionerCmd(2,0,0,0) + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "关闭空调") + mPresenter?.closeAircondition() } /** * 开启空调 */ private fun openAircondition() { - CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"打开空调") + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "打开空调") var modeCmd = 0 var windSpeedCmd = 0 - val temperatureCmd = currentTemperature?.value?:26 + val temperatureCmd = currentTemperature?.value ?: 26 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 // 通风 + 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档 + R.id.rb_wind_speed_high -> windSpeedCmd = 3 // 3档 else -> {} } - mPresenter?.sendRoboBusJinlvM1AirConditionerCmd(1,modeCmd,windSpeedCmd,temperatureCmd) + mPresenter?.openAndSetAircondition(modeCmd, windSpeedCmd, temperatureCmd) } /** * 根据车的状态会写页面状态 */ - fun setAirconditionHeaterView(airIsOpen:Boolean,heaterIsOpen:Boolean,temperatureCmd:Int,pattern:Int,windSpeed:Int){ - if(!airIsOpen&&!heaterIsOpen){ + 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{ + } else { tv_aircondition_switch.tag = touchTag tv_aircondition_switch.isChecked = true } - if(airIsOpen){ + if (airIsOpen) { val adapter = rv_aircondition_temperature.adapter if (adapter is TemperatureAdapter) { adapter.data.forEach { - if (it.value==temperatureCmd) { + if (it.value == temperatureCmd) { rv_aircondition_temperature.tag = touchTag rv_aircondition_temperature.smoothScrollToPosition(it.index) } @@ -239,7 +252,7 @@ class BusPassengerFunctionSoftFragment : else -> {} } } - if(heaterIsOpen){ + if (heaterIsOpen) { rg_setting_pattern.tag = touchTag rb_pattern_heating.isChecked = true heaterAirEnable(false) @@ -256,22 +269,12 @@ class BusPassengerFunctionSoftFragment : * 关闭暖风机 */ private fun closeHeater() { - CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"关闭暖风") + 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 -> {} - } + mPresenter?.closeHeader() } - private fun heaterAirEnable(enable:Boolean){ + private fun heaterAirEnable(enable: Boolean) { tv_temperature_title.isEnabled = enable rv_aircondition_temperature.isEnabled = enable rb_wind_speed_low.isEnabled = enable @@ -281,7 +284,7 @@ class BusPassengerFunctionSoftFragment : * 开启暖风机 */ private fun openHeater() { - CallerLogger.d(SceneConstant.M_BUS_P+ TAG,"打开暖风") + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "打开暖风") heaterAirEnable(false) closeAircondition()//关闭空调 when (rg_setting_windspeed.checkedRadioButtonId) { @@ -290,10 +293,10 @@ class BusPassengerFunctionSoftFragment : rb_wind_speed_middle.toggle() } R.id.rb_wind_speed_middle -> { - AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(1,1) + mPresenter?.openAndSetHeader(1) } R.id.rb_wind_speed_high -> { - AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(1,2) + mPresenter?.openAndSetHeader(2) } else -> { rb_wind_speed_middle.tag = touchTag @@ -303,40 +306,55 @@ class BusPassengerFunctionSoftFragment : } - // region 灯 private fun setLightListener() { tv_light_top_01.setOnCheckedChangeListener { buttonView, isChecked -> SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) - mPresenter?.setLightData(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked) + mPresenter?.setLightData1(isChecked) setLightView(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked) } tv_light_top_02.setOnCheckedChangeListener { buttonView, isChecked -> SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) - mPresenter?.setLightData(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked) + mPresenter?.setLightData2(isChecked) setLightView(tv_light_top_01.isChecked, isChecked, tv_light_atmosphere.isChecked) - } tv_light_atmosphere.setOnCheckedChangeListener { buttonView, isChecked -> SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) - mPresenter?.setLightData(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked) + mPresenter?.setAtmosphereLightData2(isChecked) setLightView(tv_light_top_01.isChecked, tv_light_top_02.isChecked, isChecked) } } + private fun voiceBi(target: View): Boolean { + if (target.tag == touchTag) { + target.tag = null + return false + } else { + SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) + return true + } + } + /** * 灯的UI发生变化 */ fun setLightView(leftLight: Boolean, rightLight: Boolean, atmosphereLight: Boolean) { - if(leftLight){ + tv_light_top_01.tag = touchTag + tv_light_top_02.tag = touchTag + tv_light_atmosphere.tag = touchTag + if (leftLight) { tv_light_top_01.text = requireContext().getString(R.string.bus_p_m1_close_light1) - }else{ + //tv_light_top_01.isChecked = true + } else { tv_light_top_01.text = requireContext().getString(R.string.bus_p_m1_open_light1) + //tv_light_top_01.isChecked = false } - if(rightLight){ + if (rightLight) { tv_light_top_02.text = requireContext().getString(R.string.bus_p_m1_close_light2) - }else{ + //tv_light_top_02.isChecked = true + } else { tv_light_top_02.text = requireContext().getString(R.string.bus_p_m1_open_light2) + //tv_light_top_02.isChecked = false } if (leftLight && rightLight) { iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_middle_selected)// 都打开 @@ -352,9 +370,11 @@ class BusPassengerFunctionSoftFragment : } if (atmosphereLight) { tv_light_atmosphere.text = requireContext().getString(R.string.bus_p_m1_close_atmosphere) + //tv_light_atmosphere.isChecked = true 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) + //tv_light_atmosphere.isChecked = false iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_nor) } } @@ -387,7 +407,7 @@ class BusPassengerFunctionSoftFragment : if (fromUser) { mMaxVolume?.let { var currnetValue = ((progress.toFloat() / 100) * it).toInt() - if(currnetValue <=0){ + if (currnetValue <= 0) { currnetValue = 1; } mAudioManager?.setStreamVolume( @@ -417,13 +437,13 @@ class BusPassengerFunctionSoftFragment : val mCurrentVolume = mAudioManager?.getStreamVolume(AudioManager.STREAM_MUSIC) mMaxVolume?.let { max -> mCurrentVolume?.let { current -> - if(current==1){ + if (current == 1) { sb_voice_bar.progress = 5 - tv_current_voice_value.text= "5%" - }else { + tv_current_voice_value.text = "5%" + } else { val fl = current.toFloat() / max * 100 sb_voice_bar.progress = fl.toInt() - tv_current_voice_value.text= "${fl.toInt()}%" + tv_current_voice_value.text = "${fl.toInt()}%" } } } @@ -439,6 +459,7 @@ class BusPassengerFunctionSoftFragment : const val TAG = "BusPassengerFunctionSoftFragment" const val touchTagKey = 2 const val touchTag = 2 + @JvmStatic fun newInstance(): BusPassengerFunctionSoftFragment { val args = Bundle() diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/DrawableCheckBox.java b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/DrawableCheckBox.java new file mode 100644 index 0000000000..b208883823 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/DrawableCheckBox.java @@ -0,0 +1,70 @@ +package com.mogo.och.bus.passenger.view; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.widget.CheckBox; + +import androidx.annotation.Nullable; + +import java.lang.ref.WeakReference; + +public class DrawableCheckBox extends androidx.appcompat.widget.AppCompatCheckBox { + + public DrawableCheckBox(Context context, AttributeSet attrs, int defStyle) { + + super(context, attrs, defStyle); + +// TODO Auto-generated constructor stub + + } + + public DrawableCheckBox(Context context, AttributeSet attrs) { + + super(context, attrs); + +// TODO Auto-generated constructor stub + + } + + public DrawableCheckBox(Context context) { + + super(context); + +// TODO Auto-generated constructor stub + + } + + @Override + + protected void onDraw(Canvas canvas) { + //获取设置的图片 + Drawable[] drawables = getCompoundDrawables(); + if (drawables != null) { + //第一个是left + Drawable drawableLeft = drawables[0]; + if (drawableLeft != null) { + //获取文字的宽度 + float textWidth = getPaint().measureText(getText().toString()); + int drawablePadding = getCompoundDrawablePadding(); + int drawableWidth = 0; + drawableWidth = drawableLeft.getIntrinsicWidth(); + float bodyWidth = textWidth + drawableWidth + drawablePadding; + int y = getWidth(); + canvas.translate((getWidth() - bodyWidth) / 2, 0); + } + + } + + super.onDraw(canvas); + + } + + +} diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java index 1236314a66..5c8fbd766f 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java @@ -3,11 +3,16 @@ package com.mogo.och.bus.passenger.view; import android.content.Context; import android.util.DisplayMetrics; import android.view.View; +import android.widget.TextView; +import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearSmoothScroller; import androidx.recyclerview.widget.RecyclerView; +import com.mogo.eagle.core.utilcode.util.ClickUtils; +import com.mogo.och.bus.passenger.R; + public class PickerLayoutManager extends LinearLayoutManager { private float scaleDownBy = 0.66f; @@ -80,6 +85,13 @@ public class PickerLayoutManager extends LinearLayoutManager { } onScrollStopListener.selectedView(getChildAt(selected)); } + }else { + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (child instanceof TextView) { + ((TextView) child).setTextColor(ContextCompat.getColor(child.getContext(), R.color.bus_p_m1_47576E)); + } + } } } diff --git a/OCH/mogo-och-bus-passenger/src/m1/res/drawable/bus_p_function_aircondition_common_bg_01.xml b/OCH/mogo-och-bus-passenger/src/m1/res/drawable/bus_p_function_aircondition_common_bg_01.xml new file mode 100644 index 0000000000..5c1a6999f6 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m1/res/drawable/bus_p_function_aircondition_common_bg_01.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m1/res/layout/bus_p_function_setting_soft_fragment.xml b/OCH/mogo-och-bus-passenger/src/m1/res/layout/bus_p_function_setting_soft_fragment.xml index d63617d0db..36660b2d8d 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/res/layout/bus_p_function_setting_soft_fragment.xml +++ b/OCH/mogo-och-bus-passenger/src/m1/res/layout/bus_p_function_setting_soft_fragment.xml @@ -82,7 +82,7 @@ app:layout_constraintStart_toStartOf="@+id/gl_left" app:layout_constraintTop_toTopOf="parent" /> - + + + + @@ -262,7 +283,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="visible" - app:constraint_referenced_ids="tv_aircondition_switch,tv_temperature_title,rv_aircondition_temperature,tv_aircondition_pattern_title,rg_setting_pattern,tv_aircondition_wind_speed_title,rg_setting_windspeed" /> + app:constraint_referenced_ids="iv_temperature_select,v_temperature_bg,tv_aircondition_switch,tv_temperature_title,rv_aircondition_temperature,tv_aircondition_pattern_title,rg_setting_pattern,tv_aircondition_wind_speed_title,rg_setting_windspeed" /> diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHM1LightAirconditionDoorStatusManager.kt b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHM1LightAirconditionDoorStatusManager.kt index f8d25563a6..aad34ffe3c 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHM1LightAirconditionDoorStatusManager.kt +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHM1LightAirconditionDoorStatusManager.kt @@ -29,6 +29,9 @@ object OCHM1LightAirconditionDoorStatusManager : IMoGoRoboBusJinlvM1StatesListen return } M_LISTENERS[tag] = listener + listener.onLightCallback(lightStatus) + listener.onAirconditionStatusCallback(heaterStatue.isOpen,airconditionStatus) + listener.onHeaterStatusCallback(airconditionStatus.isOpen,heaterStatue) } fun removeListener(tag: String) { From 2f524d2ed0f72a75b73274e0f10eaa52ad5fd0df Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 9 Feb 2023 15:38:42 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[m1]=20[1.0.0]=20[=E7=81=AF=E5=85=89?= =?UTF-8?q?=E4=BC=9A=E5=86=99=E5=AE=8C=E6=88=90]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusPassengerFunctionDevicePresenter.kt | 33 +++++++++++++++++++ .../BusPassengerFunctionSoftPresenter.kt | 2 +- .../ui/BusPassengerFunctionDeviceFragment.kt | 21 ++++++++++-- .../ui/BusPassengerFunctionSoftFragment.kt | 21 ++++++++---- 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt index b120fa7baf..cf97e10908 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionDevicePresenter.kt @@ -8,11 +8,16 @@ 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 +import io.reactivex.Observable +import io.reactivex.android.schedulers.AndroidSchedulers +import io.reactivex.disposables.Disposable +import java.util.concurrent.TimeUnit class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragment?) : BusBasePassengerFunctionDevicePresenter(view), OCHM1LightAirconditionDoorStatusManager.OCHM1LightAirconditionDoorCallback { + private var subscribe: Disposable?=null companion object{ private const val TAG = "BusPassengerFunctionDevicePresenter" } @@ -34,6 +39,34 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme } } + fun openDoor(){ + subscribe?.let { + if (!it.isDisposed) { + it.dispose() + } + } + subscribe = Observable.timer(1000, TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(0) + } + AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(1); + } + + fun closeDoor(){ + subscribe?.let { + if (!it.isDisposed) { + it.dispose() + } + } + subscribe = Observable.timer(1000, TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(0) + } + AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(2) + } + fun startStopSide() { AdasManager.getInstance().sendPlanningCmd(2) // when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) { 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 0647a0d6df..67b7555524 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 @@ -53,7 +53,7 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?) * 灯状态变化 */ override fun onLightCallback(lightStatus: OCHM1LightAirconditionDoorStatusManager.LightStatus) { - //mView?.setLightView(lightStatus.isOpenLight1,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/BusPassengerFunctionDeviceFragment.kt b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionDeviceFragment.kt index 0640ef7376..47d9fb619a 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionDeviceFragment.kt +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionDeviceFragment.kt @@ -7,7 +7,11 @@ import com.mogo.och.bus.passenger.R import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionDevicePresenter import com.mogo.och.common.module.utils.SoundPoolHelper import com.zhidao.support.adas.high.AdasManager +import io.reactivex.Observable +import io.reactivex.android.schedulers.AndroidSchedulers +import io.reactivex.disposables.Disposable import kotlinx.android.synthetic.m1.bus_p_function_setting_devices_fragment.* +import java.util.concurrent.TimeUnit /** * @author: yangyakun @@ -15,6 +19,9 @@ import kotlinx.android.synthetic.m1.bus_p_function_setting_devices_fragment.* */ class BusPassengerFunctionDeviceFragment : MvpFragment() { + + private var subscribe: Disposable?=null + override fun getLayoutId(): Int = R.layout.bus_p_function_setting_devices_fragment override fun getTagName(): String = TAG @@ -33,16 +40,26 @@ class BusPassengerFunctionDeviceFragment : } tv_car_setting_stopside.setOnClickListener { // 执行靠边停车 AdasManager.getInstance().sendPlanningCmd(1); + subscribe?.let { + if (!it.isDisposed) { + it.dispose() + } + } + subscribe = Observable.timer(1000, TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + AdasManager.getInstance().sendPlanningCmd(0); + } AdasManager.getInstance().sendPlanningCmd(1); SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) } tv_car_setting_opendoor.onClick { // 开门 AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(2); - AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(1); + mPresenter?.openDoor() SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) } tv_car_setting_closedoor.onClick { - AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(2); + mPresenter?.closeDoor() SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) } } 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 220d1d6a23..bac722feda 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 @@ -309,16 +309,25 @@ class BusPassengerFunctionSoftFragment : // region 灯 private fun setLightListener() { tv_light_top_01.setOnCheckedChangeListener { buttonView, isChecked -> + if(!buttonView.isPressed){ + return@setOnCheckedChangeListener + } SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) mPresenter?.setLightData1(isChecked) setLightView(isChecked, tv_light_top_02.isChecked, tv_light_atmosphere.isChecked) } tv_light_top_02.setOnCheckedChangeListener { buttonView, isChecked -> + if(!buttonView.isPressed){ + return@setOnCheckedChangeListener + } SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) mPresenter?.setLightData2(isChecked) setLightView(tv_light_top_01.isChecked, isChecked, tv_light_atmosphere.isChecked) } tv_light_atmosphere.setOnCheckedChangeListener { buttonView, isChecked -> + if(!buttonView.isPressed){ + return@setOnCheckedChangeListener + } SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) mPresenter?.setAtmosphereLightData2(isChecked) setLightView(tv_light_top_01.isChecked, tv_light_top_02.isChecked, isChecked) @@ -344,17 +353,17 @@ class BusPassengerFunctionSoftFragment : tv_light_atmosphere.tag = touchTag if (leftLight) { tv_light_top_01.text = requireContext().getString(R.string.bus_p_m1_close_light1) - //tv_light_top_01.isChecked = true + tv_light_top_01.isChecked = true } else { tv_light_top_01.text = requireContext().getString(R.string.bus_p_m1_open_light1) - //tv_light_top_01.isChecked = false + tv_light_top_01.isChecked = false } if (rightLight) { tv_light_top_02.text = requireContext().getString(R.string.bus_p_m1_close_light2) - //tv_light_top_02.isChecked = true + tv_light_top_02.isChecked = true } else { tv_light_top_02.text = requireContext().getString(R.string.bus_p_m1_open_light2) - //tv_light_top_02.isChecked = false + tv_light_top_02.isChecked = false } if (leftLight && rightLight) { iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_middle_selected)// 都打开 @@ -370,11 +379,11 @@ class BusPassengerFunctionSoftFragment : } if (atmosphereLight) { tv_light_atmosphere.text = requireContext().getString(R.string.bus_p_m1_close_atmosphere) - //tv_light_atmosphere.isChecked = true + tv_light_atmosphere.isChecked = true 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) - //tv_light_atmosphere.isChecked = false + tv_light_atmosphere.isChecked = false iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_nor) } } From c388eec1f0e52719d412dd2f7c17dd332bf2bdcd Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 9 Feb 2023 18:30:45 +0800 Subject: [PATCH 3/5] =?UTF-8?q?[m1]=20[1.0.0]=20[=E6=9A=96=E9=A3=8E?= =?UTF-8?q?=E6=9C=BA=E7=A6=81=E6=AD=A2=E6=B8=A9=E5=BA=A6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E3=80=81=E5=85=B3=E9=97=AD=E7=A9=BA=E8=B0=83=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=B8=A9=E5=BA=A6=E3=80=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E3=80=81=E9=A3=8E=E9=80=9F=20=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BC=A0=E9=80=92]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/BusPassengerFunctionDeviceFragment.kt | 12 ------ .../ui/BusPassengerFunctionSoftFragment.kt | 41 ++++++++++++------- .../passenger/view/PickerLayoutManager.java | 18 ++++++++ 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionDeviceFragment.kt b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionDeviceFragment.kt index 47d9fb619a..377cbe342b 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionDeviceFragment.kt +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionDeviceFragment.kt @@ -20,8 +20,6 @@ import java.util.concurrent.TimeUnit class BusPassengerFunctionDeviceFragment : MvpFragment() { - private var subscribe: Disposable?=null - override fun getLayoutId(): Int = R.layout.bus_p_function_setting_devices_fragment override fun getTagName(): String = TAG @@ -40,16 +38,6 @@ class BusPassengerFunctionDeviceFragment : } tv_car_setting_stopside.setOnClickListener { // 执行靠边停车 AdasManager.getInstance().sendPlanningCmd(1); - subscribe?.let { - if (!it.isDisposed) { - it.dispose() - } - } - subscribe = Observable.timer(1000, TimeUnit.MILLISECONDS) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { - AdasManager.getInstance().sendPlanningCmd(0); - } AdasManager.getInstance().sendPlanningCmd(1); SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di) } 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 bac722feda..bb5e366e4a 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 @@ -96,6 +96,9 @@ class BusPassengerFunctionSoftFragment : } // 模式调节 rg_setting_pattern.setOnCheckedChangeListener { group, checkedId -> + if (!tv_aircondition_switch.isChecked) { + return@setOnCheckedChangeListener + } if (rg_setting_pattern.tag == touchTag) { rg_setting_pattern.tag = null }else{ @@ -111,6 +114,23 @@ class BusPassengerFunctionSoftFragment : } } } + + // 风速调节 + rg_setting_windspeed.setOnCheckedChangeListener { group, checkedId -> + 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) + } + if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {//暖风机 + openHeater() + } else { + openAircondition() + } + } val pickerLayoutManager = PickerLayoutManager(requireContext(), PickerLayoutManager.HORIZONTAL, false) pickerLayoutManager.isChangeAlpha = true @@ -124,20 +144,6 @@ class BusPassengerFunctionSoftFragment : rv_aircondition_temperature.adapter = adapter rv_aircondition_temperature.addItemDecoration(HorizontalDecoration(15)) - // 风速调节 - 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) - } - if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {//暖风机 - openHeater() - } else { - openAircondition() - } - } - pickerLayoutManager.setOnScrollStopListener { view -> if (view is TextView) { view.setTextColor(Color.WHITE) @@ -154,6 +160,9 @@ class BusPassengerFunctionSoftFragment : SoundPoolHelper.getSoundPoolHelper() .playSoundWithRedId(context, R.raw.bus_di) } + if (!tv_aircondition_switch.isChecked) { + return@setOnScrollStopListener + } openAircondition() } @@ -278,6 +287,10 @@ class BusPassengerFunctionSoftFragment : tv_temperature_title.isEnabled = enable rv_aircondition_temperature.isEnabled = enable rb_wind_speed_low.isEnabled = enable + val layoutManager = rv_aircondition_temperature.layoutManager + if (layoutManager is PickerLayoutManager) { + layoutManager.setHorizontallyScroll(enable) + } } /** diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java index 5c8fbd766f..9503f03167 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/view/PickerLayoutManager.java @@ -21,6 +21,8 @@ public class PickerLayoutManager extends LinearLayoutManager { private onScrollStopListener onScrollStopListener; + private boolean mCanHorizontallyScroll = true; + public PickerLayoutManager(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } @@ -31,6 +33,19 @@ public class PickerLayoutManager extends LinearLayoutManager { scaleDownView(); } + @Override + public boolean canScrollHorizontally() { + if (!mCanHorizontallyScroll){ + return false; + }else { + return super.canScrollHorizontally(); + } + } + + public void setHorizontallyScroll(boolean b){ + mCanHorizontallyScroll = b; + } + @Override public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) { int orientation = getOrientation(); @@ -61,6 +76,9 @@ public class PickerLayoutManager extends LinearLayoutManager { @Override public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) { + if(!mCanHorizontallyScroll){ + return; + } RecyclerView.SmoothScroller smoothScroller = new CenterSmoothScroller(recyclerView.getContext()); smoothScroller.setTargetPosition(position); startSmoothScroll(smoothScroller); From 6d7f7309c65d5d9d4c853cce8c7dd984d2f0d394 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 9 Feb 2023 23:42:54 +0800 Subject: [PATCH 4/5] =?UTF-8?q?[m1]=20[1.0.0]=20[=E5=9B=9E=E5=86=99?= =?UTF-8?q?=E5=B9=B6=E5=B1=95=E7=A4=BA=E7=A6=81=E6=AD=A2=E5=86=8D=E5=90=91?= =?UTF-8?q?=E5=BA=95=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) From e6413c71c76e3ee694b846298454c883af47b179 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Fri, 10 Feb 2023 15:02:03 +0800 Subject: [PATCH 5/5] =?UTF-8?q?[m1]=20[1.0.0]=20[=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=97=A5=E5=BF=97]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passenger/presenter/BusPassengerFunctionSoftPresenter.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 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 48ade86299..e751066beb 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 @@ -48,7 +48,7 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?) override fun onHeaterStatusCallback(airconditionIsOpen:Boolean,heaterStatue: OCHM1LightAirconditionDoorStatusManager.HeaterStatue) { CallerLogger.d(SceneConstant.M_BUS_P + TAG, "回写--暖风机开关:${heaterStatue.isOpen}、" + - "空调风速:${heaterStatue.windSpeed}") + "风速:${heaterStatue.windSpeed}") mView?.setAirconditionHeaterView( airconditionIsOpen, heaterStatue.isOpen, @@ -72,7 +72,8 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?) * 设置空调 */ fun openAndSetAircondition(modeCmd: Int, windSpeedCmd: Int, temperatureCmd: Int) { - CallerLogger.d(SceneConstant.M_BUS_P + TAG, "打开空调,模式$modeCmd--档位${windSpeedCmd}--温度:$temperatureCmd") + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "" + + "打开空调,模式$modeCmd--档位${windSpeedCmd}--温度:$temperatureCmd") AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(1,modeCmd,windSpeedCmd,temperatureCmd) } fun closeAircondition() {