[m1]
[1.0.0] [灯光会写完成]
This commit is contained in:
@@ -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<BusPassengerFunctionDeviceFragment?>(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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<BusPassengerFunctionDeviceFragment?, BusPassengerFunctionDevicePresenter?>() {
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user