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);