[1.0.0]
[暖风机禁止温度选择、关闭空调状态设置温度、设置、风速 不进行数据传递]
This commit is contained in:
yangyakun
2023-02-09 18:30:45 +08:00
parent 2f524d2ed0
commit c388eec1f0
3 changed files with 45 additions and 26 deletions

View File

@@ -20,8 +20,6 @@ import java.util.concurrent.TimeUnit
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
@@ -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)
}

View File

@@ -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)
}
}
/**

View File

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