From 5edd005b3098752b1877a31f32382efb567b9f12 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 9 Feb 2023 15:06:30 +0800 Subject: [PATCH] =?UTF-8?q?[m1]=20[1.0.0]=20[=E7=9E=AC=E9=97=B4=E7=82=B9?= =?UTF-8?q?=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) {