新增排程页面重做
This commit is contained in:
@@ -1,55 +1,55 @@
|
||||
package com.ckkj.water.plan.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.water.R;
|
||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class BindDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||
private Context mContext;
|
||||
private Set<Integer> mSelectedPositions = new HashSet<>();
|
||||
|
||||
public BindDeviceAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||
super(layoutResId, data);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||
CheckBox checkBox = helper.getView(R.id.radio);
|
||||
helper.setText(R.id.tv_device_name, item.getDeviceName());
|
||||
helper.setText(R.id.tv_device_serial, item.getDeviceCode());
|
||||
checkBox.setChecked(mSelectedPositions.contains(helper.getLayoutPosition()));
|
||||
}
|
||||
|
||||
public void toggleSelection(int position) {
|
||||
if (mSelectedPositions.contains(position)) {
|
||||
mSelectedPositions.remove(position);
|
||||
} else {
|
||||
mSelectedPositions.add(position);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void clearSelection() {
|
||||
mSelectedPositions.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public Set<Integer> getSelectedPositions() {
|
||||
return new HashSet<>(mSelectedPositions);
|
||||
}
|
||||
|
||||
public int getSelectedCount() {
|
||||
return mSelectedPositions.size();
|
||||
}
|
||||
}
|
||||
//package com.ckkj.water.plan.adapter;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.widget.CheckBox;
|
||||
//
|
||||
//import androidx.annotation.Nullable;
|
||||
//
|
||||
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||
//import com.ckkj.water.R;
|
||||
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
//
|
||||
//import java.util.HashSet;
|
||||
//import java.util.List;
|
||||
//import java.util.Set;
|
||||
//
|
||||
//public class BindDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||
// private Context mContext;
|
||||
// private Set<Integer> mSelectedPositions = new HashSet<>();
|
||||
//
|
||||
// public BindDeviceAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||
// super(layoutResId, data);
|
||||
// this.mContext = context;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||
// CheckBox checkBox = helper.getView(R.id.radio);
|
||||
// helper.setText(R.id.tv_device_name, item.getDeviceName());
|
||||
// helper.setText(R.id.tv_device_serial, item.getDeviceCode());
|
||||
// checkBox.setChecked(mSelectedPositions.contains(helper.getLayoutPosition()));
|
||||
// }
|
||||
//
|
||||
// public void toggleSelection(int position) {
|
||||
// if (mSelectedPositions.contains(position)) {
|
||||
// mSelectedPositions.remove(position);
|
||||
// } else {
|
||||
// mSelectedPositions.add(position);
|
||||
// }
|
||||
// notifyDataSetChanged();
|
||||
// }
|
||||
//
|
||||
// public void clearSelection() {
|
||||
// mSelectedPositions.clear();
|
||||
// notifyDataSetChanged();
|
||||
// }
|
||||
//
|
||||
// public Set<Integer> getSelectedPositions() {
|
||||
// return new HashSet<>(mSelectedPositions);
|
||||
// }
|
||||
//
|
||||
// public int getSelectedCount() {
|
||||
// return mSelectedPositions.size();
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package com.ckkj.water.plan.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.water.R;
|
||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PlanDetailDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||
|
||||
public PlanDetailDeviceAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||
super(layoutResId, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||
helper.setText(R.id.tv_device_name,item.getDeviceName());
|
||||
helper.setText(R.id.tv_device_serial,item.getDeviceCode());
|
||||
}
|
||||
}
|
||||
//package com.ckkj.water.plan.adapter;
|
||||
//
|
||||
//import androidx.annotation.Nullable;
|
||||
//
|
||||
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||
//import com.ckkj.water.R;
|
||||
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//public class PlanDetailDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||
//
|
||||
// public PlanDetailDeviceAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||
// super(layoutResId, data);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||
// helper.setText(R.id.tv_device_name,item.getDeviceName());
|
||||
// helper.setText(R.id.tv_device_serial,item.getDeviceCode());
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package com.ckkj.water.plan.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.water.R;
|
||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PlanDetailTimeAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.WashCycleEntity, BaseViewHolder> {
|
||||
|
||||
public PlanDetailTimeAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.WashCycleEntity> data) {
|
||||
super(layoutResId, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.WashCycleEntity item) {
|
||||
helper.setText(R.id.tv_week,item.getWeek());
|
||||
helper.setText(R.id.tv_start_time,item.getTime());
|
||||
helper.setText(R.id.tv_duration,item.getDuration());
|
||||
}
|
||||
}
|
||||
//package com.ckkj.water.plan.adapter;
|
||||
//
|
||||
//import androidx.annotation.Nullable;
|
||||
//
|
||||
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||
//import com.ckkj.water.R;
|
||||
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//public class PlanDetailTimeAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.WashCycleEntity, BaseViewHolder> {
|
||||
//
|
||||
// public PlanDetailTimeAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.WashCycleEntity> data) {
|
||||
// super(layoutResId, data);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.WashCycleEntity item) {
|
||||
// helper.setText(R.id.tv_week,item.getWeek());
|
||||
// helper.setText(R.id.tv_start_time,item.getTime());
|
||||
// helper.setText(R.id.tv_duration,item.getDuration());
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
package com.ckkj.water.plan.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.water.R;
|
||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class WaterPlanListAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||
private Context mContext;
|
||||
|
||||
public WaterPlanListAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||
super(layoutResId, data);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||
helper.setText(R.id.tv_device_name, item.getDeviceName());
|
||||
helper.setText(R.id.tv_device_serial, item.getDeviceCode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
//package com.ckkj.water.plan.adapter;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.widget.CheckBox;
|
||||
//
|
||||
//import androidx.annotation.Nullable;
|
||||
//
|
||||
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||
//import com.ckkj.water.R;
|
||||
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
//
|
||||
//import java.util.HashSet;
|
||||
//import java.util.List;
|
||||
//import java.util.Set;
|
||||
//
|
||||
//public class WaterPlanListAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||
// private Context mContext;
|
||||
//
|
||||
// public WaterPlanListAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||
// super(layoutResId, data);
|
||||
// this.mContext = context;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||
// helper.setText(R.id.tv_device_name, item.getDeviceName());
|
||||
// helper.setText(R.id.tv_device_serial, item.getDeviceCode());
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -7,7 +7,9 @@ import static android.view.View.VISIBLE;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -19,36 +21,66 @@ import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WaterPlanWeekAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.WashCycleEntity, BaseViewHolder> {
|
||||
private List<WaterPlanWeekEntity.WashCycleEntity> mList = new ArrayList<>();
|
||||
public class WaterPlanWeekAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DetailsBean, BaseViewHolder> {
|
||||
private List<WaterPlanWeekEntity.DetailsBean> mList = new ArrayList<>();
|
||||
private Context mContext;
|
||||
|
||||
private int mPos = 0;
|
||||
public WaterPlanWeekAdapter(Context context,int layoutResId, @Nullable List<WaterPlanWeekEntity.WashCycleEntity> data) {
|
||||
public WaterPlanWeekAdapter(Context context,int layoutResId, @Nullable List<WaterPlanWeekEntity.DetailsBean> data) {
|
||||
super(layoutResId, data);
|
||||
this.mContext = context;
|
||||
this.mList = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.WashCycleEntity item) {
|
||||
helper.setText(R.id.tv_week,item.getWeek());
|
||||
LinearLayout linearItem = helper.getView(R.id.linear_item);
|
||||
View viewStatus = helper.getView(R.id.view_status);
|
||||
if(helper.getLayoutPosition() == mPos){
|
||||
linearItem.setBackground(mContext.getResources().getDrawable(R.drawable.shape_water_period_sel_bg));
|
||||
viewStatus.setVisibility(VISIBLE);
|
||||
viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_green_circle));
|
||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DetailsBean item) {
|
||||
TextView tvStartTime = helper.getView(R.id.tv_select_time);
|
||||
CheckBox checkBox = helper.getView(R.id.checkbox);
|
||||
TextView tvPlanDuration = helper.getView(R.id.tv_plan_duration);
|
||||
|
||||
|
||||
helper.setText(R.id.tv_week_name,item.getWeekName());
|
||||
|
||||
if(!TextUtils.isEmpty(item.getStartTime())){
|
||||
helper.setText(R.id.tv_select_time,item.getStartTime());
|
||||
}else{
|
||||
linearItem.setBackground(null);
|
||||
if(!TextUtils.isEmpty(item.getTime()) && !TextUtils.isEmpty(item.getDuration())){
|
||||
viewStatus.setVisibility(VISIBLE);
|
||||
viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_yellow_circle));
|
||||
}else{
|
||||
viewStatus.setVisibility(INVISIBLE);
|
||||
viewStatus.setBackground(null);
|
||||
}
|
||||
helper.setText(R.id.tv_select_time,"");
|
||||
tvStartTime.setHint(mContext.getString(R.string.select_water_time));
|
||||
}
|
||||
if(item.getDurationMin() != 0){
|
||||
helper.setText(R.id.tv_plan_duration,item.getDurationMin() + "");
|
||||
}else{
|
||||
helper.setText(R.id.tv_plan_duration,"");
|
||||
tvPlanDuration.setHint(mContext.getString(R.string.input_water_plan_time));
|
||||
}
|
||||
|
||||
if(item.getStatus().equals("1")){
|
||||
checkBox.setChecked(true);
|
||||
}else{
|
||||
checkBox.setChecked(false);
|
||||
}
|
||||
|
||||
helper.addOnClickListener(R.id.linear_week);
|
||||
helper.addOnClickListener(R.id.checkbox);
|
||||
helper.addOnClickListener(R.id.tv_select_time);
|
||||
helper.addOnClickListener(R.id.tv_plan_duration);
|
||||
|
||||
// LinearLayout linearItem = helper.getView(R.id.linear_item);
|
||||
// View viewStatus = helper.getView(R.id.view_status);
|
||||
// if(helper.getLayoutPosition() == mPos){
|
||||
// linearItem.setBackground(mContext.getResources().getDrawable(R.drawable.shape_water_period_sel_bg));
|
||||
// viewStatus.setVisibility(VISIBLE);
|
||||
// viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_green_circle));
|
||||
// }else{
|
||||
// linearItem.setBackground(null);
|
||||
// if(!TextUtils.isEmpty(item.getTime()) && !TextUtils.isEmpty(item.getDuration())){
|
||||
// viewStatus.setVisibility(VISIBLE);
|
||||
// viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_yellow_circle));
|
||||
// }else{
|
||||
// viewStatus.setVisibility(INVISIBLE);
|
||||
// viewStatus.setBackground(null);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public void setSelPos(int position) {
|
||||
|
||||
Reference in New Issue
Block a user