[m1]
[1.0.0] [温度选中修改配置]
This commit is contained in:
@@ -166,15 +166,14 @@ class BusPassengerFunctionSoftFragment :
|
||||
|
||||
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) {
|
||||
adapter.setCheckIndex(tag.index)
|
||||
currentTemperature = tag
|
||||
ToastUtils.showShort(tag.value)
|
||||
if(rv_aircondition_temperature.tag== touchTag){
|
||||
rv_aircondition_temperature.tag = null
|
||||
return@setOnScrollStopListener
|
||||
@@ -187,13 +186,6 @@ class BusPassengerFunctionSoftFragment :
|
||||
|
||||
}
|
||||
}
|
||||
rv_aircondition_temperature.post {
|
||||
rv_aircondition_temperature.getChildAt(0)?.let {
|
||||
if (it is TextView) {
|
||||
it.setTextColor(Color.WHITE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getData(): MutableList<Temperature> {
|
||||
@@ -314,7 +306,6 @@ class BusPassengerFunctionSoftFragment :
|
||||
private fun heaterAirEnable(enable: Boolean) {
|
||||
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)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.passenger.ui.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -25,6 +26,7 @@ public class TemperatureAdapter extends RecyclerView.Adapter<TemperatureAdapter.
|
||||
private List<Temperature> dataList;
|
||||
private RecyclerView recyclerView;
|
||||
private Boolean enable = true;
|
||||
private int checkIndex = 0;
|
||||
|
||||
public TemperatureAdapter(Context context, List<Temperature> dataList, RecyclerView recyclerView) {
|
||||
this.context = context;
|
||||
@@ -44,9 +46,12 @@ public class TemperatureAdapter extends RecyclerView.Adapter<TemperatureAdapter.
|
||||
public void onBindViewHolder(TextVH holder, int position) {
|
||||
Temperature temperature = dataList.get(holder.getBindingAdapterPosition());
|
||||
holder.pickerTxt.setText(temperature.getShowTitle());
|
||||
|
||||
if(enable){
|
||||
holder.pickerTxt.setTextColor(ContextCompat.getColor(context,R.color.bus_p_m1_47576e));
|
||||
if(position==checkIndex){
|
||||
holder.pickerTxt.setTextColor(Color.WHITE);
|
||||
}else {
|
||||
holder.pickerTxt.setTextColor(ContextCompat.getColor(context,R.color.bus_p_m1_47576e));
|
||||
}
|
||||
}else {
|
||||
holder.pickerTxt.setTextColor(ContextCompat.getColor(context,R.color.bus_p_m1_6647576e));
|
||||
}
|
||||
@@ -77,6 +82,11 @@ public class TemperatureAdapter extends RecyclerView.Adapter<TemperatureAdapter.
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setCheckIndex(int index) {
|
||||
checkIndex = index;
|
||||
notifyItemChanged(checkIndex);
|
||||
}
|
||||
|
||||
class TextVH extends RecyclerView.ViewHolder {
|
||||
TextView pickerTxt;
|
||||
|
||||
|
||||
@@ -2,7 +2,5 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@android:color/white" android:state_checked="true"/>
|
||||
<item android:color="@color/bus_p_m1_47576e" android:state_checked="false"/>
|
||||
<item android:color="@color/bus_p_m1_6647576e" android:state_enabled="false"/>
|
||||
<item android:color="@color/bus_p_m1_47576e" android:state_enabled="true"/>
|
||||
<item android:color="@color/bus_p_m1_47576e" />
|
||||
</selector>
|
||||
Reference in New Issue
Block a user