新增排程页面重做
This commit is contained in:
@@ -11,6 +11,8 @@ import android.content.Intent;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.InputFilter;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -20,6 +22,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -30,6 +33,7 @@ import androidx.core.app.ActivityCompat;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.viewbinding.ViewBinding;
|
import androidx.viewbinding.ViewBinding;
|
||||||
|
|
||||||
|
import com.ckkj.water.utils.show.ToastUtil;
|
||||||
import com.esafirm.imagepicker.features.ImagePicker;
|
import com.esafirm.imagepicker.features.ImagePicker;
|
||||||
import com.ckkj.water.AppConfig;
|
import com.ckkj.water.AppConfig;
|
||||||
import com.ckkj.water.ConstantUtil;
|
import com.ckkj.water.ConstantUtil;
|
||||||
@@ -70,6 +74,12 @@ public abstract class BaseFragment<T extends ViewBinding,P extends IPresenter> e
|
|||||||
protected static final int REQUEST_EVENT_CODE_10002 = 10002;
|
protected static final int REQUEST_EVENT_CODE_10002 = 10002;
|
||||||
protected static final int REQUEST_EVENT_CODE_10003 = 10003;
|
protected static final int REQUEST_EVENT_CODE_10003 = 10003;
|
||||||
|
|
||||||
|
public static final int INPUT_TYPE_NORMAL = 0; // 默认
|
||||||
|
public static final int INPUT_TYPE_NUMBER = 1; // 数字
|
||||||
|
public static final int INPUT_TYPE_LETTER = 2; // 英文字母
|
||||||
|
public static final int INPUT_TYPE_CHINESE = 3; // 中文
|
||||||
|
public static final int INPUT_TYPE_NUMBER_LETTER = 4;//数字+字母
|
||||||
|
|
||||||
private static final AtomicBoolean isDialogShown = new AtomicBoolean(false); // 使用 AtomicBoolean 保证线程安全
|
private static final AtomicBoolean isDialogShown = new AtomicBoolean(false); // 使用 AtomicBoolean 保证线程安全
|
||||||
|
|
||||||
|
|
||||||
@@ -860,6 +870,193 @@ public abstract class BaseFragment<T extends ViewBinding,P extends IPresenter> e
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* +
|
||||||
|
*
|
||||||
|
* @param title 标题
|
||||||
|
* @param hint 提示内容2
|
||||||
|
* @param content 内容
|
||||||
|
* @param touchOutsideCancel 弹窗类型
|
||||||
|
* @param cancelText 取消 文案
|
||||||
|
* @param confirmText 确定 文案
|
||||||
|
* @param click
|
||||||
|
*/
|
||||||
|
public void showEditDialog(String title,
|
||||||
|
String hint,
|
||||||
|
String content,
|
||||||
|
boolean touchOutsideCancel,
|
||||||
|
String cancelText,
|
||||||
|
String confirmText,
|
||||||
|
int inputType,
|
||||||
|
final BaseActivity.OnDialogClick click) {
|
||||||
|
|
||||||
|
View view = getLayoutInflater().inflate(
|
||||||
|
R.layout.public_dialog_input_text,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
EditText editText = view.findViewById(R.id.et_input);
|
||||||
|
|
||||||
|
//设置输入类型
|
||||||
|
setEditInputType(editText,inputType);
|
||||||
|
|
||||||
|
if(TextUtils.isEmpty(content)){
|
||||||
|
editText.setHint(hint);
|
||||||
|
}else{
|
||||||
|
editText.setText(content);
|
||||||
|
editText.setSelection(content.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
setTextView(R.id.tv_title,title,view);
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(confirmText)
|
||||||
|
&& !TextUtils.isEmpty(cancelText)) {
|
||||||
|
|
||||||
|
((TextView)view.findViewById(R.id.btnLeft))
|
||||||
|
.setText(cancelText);
|
||||||
|
|
||||||
|
((TextView)view.findViewById(R.id.btnRight))
|
||||||
|
.setText(confirmText);
|
||||||
|
}
|
||||||
|
|
||||||
|
view.findViewById(R.id.btnLeft)
|
||||||
|
.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
if(dialog!=null&&dialog.isShowing())
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
if(click!=null)
|
||||||
|
click.onCancelClick();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
view.findViewById(R.id.btnRight)
|
||||||
|
.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
String value=editText.getText()
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
if(TextUtils.isEmpty(value)){
|
||||||
|
ToastUtil.showShort(mContext,hint);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dialog!=null&&dialog.isShowing())
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
if(click!=null)
|
||||||
|
click.onConfirmClisk(value);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog.Builder builder;
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
builder = new AlertDialog.Builder(
|
||||||
|
mContext,
|
||||||
|
AlertDialog.THEME_HOLO_LIGHT
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
builder = new AlertDialog.Builder(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.setInverseBackgroundForced(true);
|
||||||
|
builder.setView(view);
|
||||||
|
|
||||||
|
dialog = builder.show();
|
||||||
|
|
||||||
|
dialog.setCanceledOnTouchOutside(
|
||||||
|
touchOutsideCancel
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
((View)dialog.getWindow()
|
||||||
|
.getDecorView()
|
||||||
|
.findViewById(R.id.contentDialog)
|
||||||
|
.getParent()
|
||||||
|
.getParent())
|
||||||
|
.setBackgroundColor(
|
||||||
|
getResources().getColor(
|
||||||
|
R.color.transparent
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEditInputType(EditText editText,int type){
|
||||||
|
|
||||||
|
switch (type){
|
||||||
|
|
||||||
|
case INPUT_TYPE_NUMBER:
|
||||||
|
//纯数字键盘
|
||||||
|
editText.setInputType(
|
||||||
|
InputType.TYPE_CLASS_NUMBER
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_TYPE_LETTER:
|
||||||
|
|
||||||
|
//只能输入字母
|
||||||
|
editText.setFilters(
|
||||||
|
new InputFilter[]{
|
||||||
|
(source,start,end,dest,dstart,dend)->{
|
||||||
|
|
||||||
|
if(source.toString()
|
||||||
|
.matches("[a-zA-Z]+")){
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_TYPE_CHINESE:
|
||||||
|
|
||||||
|
//只能输入中文
|
||||||
|
editText.setFilters(
|
||||||
|
new InputFilter[]{
|
||||||
|
(source,start,end,dest,dstart,dend)->{
|
||||||
|
|
||||||
|
if(source.toString()
|
||||||
|
.matches("[\\u4e00-\\u9fa5]+")){
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_TYPE_NUMBER_LETTER:
|
||||||
|
|
||||||
|
//数字+字母
|
||||||
|
editText.setFilters(
|
||||||
|
new InputFilter[]{
|
||||||
|
(source,start,end,dest,dstart,dend)->{
|
||||||
|
|
||||||
|
if(source.toString()
|
||||||
|
.matches("[a-zA-Z0-9]+")){
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
editText.setInputType(
|
||||||
|
InputType.TYPE_CLASS_TEXT
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限请求结果回调
|
* 权限请求结果回调
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ public class AddWaterPlanActivity extends BaseActivity<AddWaterPlanLayoutBinding
|
|||||||
implements WaterPlanContract.WaterPlanView {
|
implements WaterPlanContract.WaterPlanView {
|
||||||
|
|
||||||
private List<Fragment> mFragmentList = new ArrayList<>();
|
private List<Fragment> mFragmentList = new ArrayList<>();
|
||||||
private List<WaterPlanWeekEntity.DeviceEntity> mSelectedDevices = new ArrayList<>();
|
// private List<WaterPlanWeekEntity.DeviceEntity> mSelectedDevices = new ArrayList<>();
|
||||||
|
//
|
||||||
public List<WaterPlanWeekEntity.DeviceEntity> getSelectedDevices() {
|
// public List<WaterPlanWeekEntity.DeviceEntity> getSelectedDevices() {
|
||||||
return mSelectedDevices;
|
// return mSelectedDevices;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setSelectedDevices(List<WaterPlanWeekEntity.DeviceEntity> selectedDevices) {
|
// public void setSelectedDevices(List<WaterPlanWeekEntity.DeviceEntity> selectedDevices) {
|
||||||
this.mSelectedDevices = selectedDevices;
|
// this.mSelectedDevices = selectedDevices;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WaterPlanPresenter createPresenter() {
|
public WaterPlanPresenter createPresenter() {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.ckkj.water.base.BaseFragment;
|
|||||||
import com.ckkj.water.databinding.PlanBindDeviceLayoutBinding;
|
import com.ckkj.water.databinding.PlanBindDeviceLayoutBinding;
|
||||||
import com.ckkj.water.main.activity.MainActivity;
|
import com.ckkj.water.main.activity.MainActivity;
|
||||||
import com.ckkj.water.network.BaseBean;
|
import com.ckkj.water.network.BaseBean;
|
||||||
import com.ckkj.water.plan.adapter.BindDeviceAdapter;
|
//import com.ckkj.water.plan.adapter.BindDeviceAdapter;
|
||||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
||||||
@@ -29,35 +29,35 @@ public class BindDeviceFragment extends BaseFragment<PlanBindDeviceLayoutBinding
|
|||||||
implements WaterPlanContract.WaterPlanView {
|
implements WaterPlanContract.WaterPlanView {
|
||||||
|
|
||||||
private List<WaterPlanWeekEntity> weekList = new ArrayList<>();
|
private List<WaterPlanWeekEntity> weekList = new ArrayList<>();
|
||||||
private BindDeviceAdapter mAdapter;
|
// private BindDeviceAdapter mAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData(Bundle state) {
|
public void initData(Bundle state) {
|
||||||
String jsonContent = getString(R.string.plan_water_entity_json);
|
String jsonContent = getString(R.string.plan_water_entity_json);
|
||||||
WaterPlanWeekEntity entity = new Gson().fromJson(jsonContent, WaterPlanWeekEntity.class);
|
WaterPlanWeekEntity entity = new Gson().fromJson(jsonContent, WaterPlanWeekEntity.class);
|
||||||
weekList.add(entity);
|
weekList.add(entity);
|
||||||
mAdapter = new BindDeviceAdapter(mContext,R.layout.plan_bind_device_item,weekList.get(0).getDeviceList());
|
// mAdapter = new BindDeviceAdapter(mContext,R.layout.plan_bind_device_item,weekList.get(0).getDeviceList());
|
||||||
viewBinding.rvDevices.setAdapter(mAdapter);
|
// viewBinding.rvDevices.setAdapter(mAdapter);
|
||||||
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
// mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
// public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||||
mAdapter.toggleSelection(position);
|
// mAdapter.toggleSelection(position);
|
||||||
syncSelectedDevices();
|
// syncSelectedDevices();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncSelectedDevices() {
|
private void syncSelectedDevices() {
|
||||||
Set<Integer> selectedPositions = mAdapter.getSelectedPositions();
|
// Set<Integer> selectedPositions = mAdapter.getSelectedPositions();
|
||||||
List<WaterPlanWeekEntity.DeviceEntity> selected = new ArrayList<>();
|
// List<WaterPlanWeekEntity.DeviceEntity> selected = new ArrayList<>();
|
||||||
for (int pos : selectedPositions) {
|
// for (int pos : selectedPositions) {
|
||||||
if (pos >= 0 && pos < weekList.get(0).getDeviceList().size()) {
|
// if (pos >= 0 && pos < weekList.get(0).getDeviceList().size()) {
|
||||||
selected.add(weekList.get(0).getDeviceList().get(pos));
|
// selected.add(weekList.get(0).getDeviceList().get(pos));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (getActivity() instanceof AddWaterPlanActivity) {
|
// if (getActivity() instanceof AddWaterPlanActivity) {
|
||||||
((AddWaterPlanActivity) getActivity()).setSelectedDevices(selected);
|
// ((AddWaterPlanActivity) getActivity()).setSelectedDevices(selected);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import com.ckkj.water.R;
|
|||||||
import com.ckkj.water.base.BaseActivity;
|
import com.ckkj.water.base.BaseActivity;
|
||||||
import com.ckkj.water.databinding.WaterPlanDetailLayoutBinding;
|
import com.ckkj.water.databinding.WaterPlanDetailLayoutBinding;
|
||||||
import com.ckkj.water.network.BaseBean;
|
import com.ckkj.water.network.BaseBean;
|
||||||
import com.ckkj.water.plan.adapter.PlanDetailDeviceAdapter;
|
//import com.ckkj.water.plan.adapter.PlanDetailDeviceAdapter;
|
||||||
import com.ckkj.water.plan.adapter.PlanDetailTimeAdapter;
|
//import com.ckkj.water.plan.adapter.PlanDetailTimeAdapter;
|
||||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
||||||
@@ -35,10 +35,10 @@ public class PlanDetailActivity extends BaseActivity<WaterPlanDetailLayoutBindin
|
|||||||
.init();
|
.init();
|
||||||
viewBinding.includedTitle.tvTitle.setText(R.string.plan_detail_title);
|
viewBinding.includedTitle.tvTitle.setText(R.string.plan_detail_title);
|
||||||
initListener();
|
initListener();
|
||||||
PlanDetailTimeAdapter timeAdapter = new PlanDetailTimeAdapter(R.layout.plan_detail_time_item,entity.getWashCycleList());
|
// PlanDetailTimeAdapter timeAdapter = new PlanDetailTimeAdapter(R.layout.plan_detail_time_item,entity.getWashCycleList());
|
||||||
viewBinding.rvPlanTime.setAdapter(timeAdapter);
|
// viewBinding.rvPlanTime.setAdapter(timeAdapter);
|
||||||
PlanDetailDeviceAdapter deviceAdapter = new PlanDetailDeviceAdapter(R.layout.plan_detail_bind_device_item,entity.getDeviceList());
|
// PlanDetailDeviceAdapter deviceAdapter = new PlanDetailDeviceAdapter(R.layout.plan_detail_bind_device_item,entity.getDeviceList());
|
||||||
viewBinding.rvBindDevices.setAdapter(deviceAdapter);
|
// viewBinding.rvBindDevices.setAdapter(deviceAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initListener() {
|
private void initListener() {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.bigkoo.pickerview.listener.OnTimeSelectListener;
|
|||||||
import com.bigkoo.pickerview.view.TimePickerView;
|
import com.bigkoo.pickerview.view.TimePickerView;
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.ckkj.water.R;
|
import com.ckkj.water.R;
|
||||||
|
import com.ckkj.water.base.BaseActivity;
|
||||||
import com.ckkj.water.base.BaseFragment;
|
import com.ckkj.water.base.BaseFragment;
|
||||||
import com.ckkj.water.databinding.WaterConfigFragmentLayoutBinding;
|
import com.ckkj.water.databinding.WaterConfigFragmentLayoutBinding;
|
||||||
import com.ckkj.water.network.BaseBean;
|
import com.ckkj.water.network.BaseBean;
|
||||||
@@ -19,6 +20,8 @@ import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
|||||||
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanPresenter;
|
import com.ckkj.water.plan.mvp.WaterPlanPresenter;
|
||||||
|
import com.ckkj.water.utils.show.ToastUtil;
|
||||||
|
import com.ckkj.water.utils.text.TextUtil;
|
||||||
import com.ckkj.water.utils.time.ZYTimeUtils;
|
import com.ckkj.water.utils.time.ZYTimeUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
@@ -28,70 +31,110 @@ import java.util.List;
|
|||||||
|
|
||||||
public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutBinding, WaterPlanPresenter>
|
public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutBinding, WaterPlanPresenter>
|
||||||
implements WaterPlanContract.WaterPlanView {
|
implements WaterPlanContract.WaterPlanView {
|
||||||
private List<WaterPlanWeekEntity> weekList = new ArrayList<>();
|
private List<WaterPlanWeekEntity.DetailsBean> mConfigList = new ArrayList<>();
|
||||||
|
|
||||||
|
private WaterPlanWeekEntity mConfigEntity;
|
||||||
private WaterPlanWeekAdapter mWeekAdapter;
|
private WaterPlanWeekAdapter mWeekAdapter;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData(Bundle state) {
|
public void initData(Bundle state) {
|
||||||
String jsonContent = getString(R.string.plan_water_entity_json);
|
mConfigEntity = new WaterPlanWeekEntity();
|
||||||
WaterPlanWeekEntity entity = new Gson().fromJson(jsonContent, WaterPlanWeekEntity.class);
|
List<WaterPlanWeekEntity.DetailsBean> list = new ArrayList<>();
|
||||||
weekList.add(entity);
|
for(int i = 0; i < 7; i++){
|
||||||
mWeekAdapter = new WaterPlanWeekAdapter(mContext, R.layout.plan_period_item,weekList.get(0).getWashCycleList());
|
WaterPlanWeekEntity.DetailsBean bean = new WaterPlanWeekEntity.DetailsBean();
|
||||||
viewBinding.rvWeek.setAdapter(mWeekAdapter);
|
bean.setWeekday(i);
|
||||||
|
bean.setStatus("0");
|
||||||
|
bean.setWeekName(ZYTimeUtils.getWeekName(i));
|
||||||
|
list.add(bean);
|
||||||
|
}
|
||||||
|
mConfigEntity.setDetails(list);
|
||||||
|
mWeekAdapter = new WaterPlanWeekAdapter(mContext,R.layout.plan_week_config_item, mConfigEntity.getDetails());
|
||||||
|
viewBinding.rvWeekConfig.setAdapter(mWeekAdapter);
|
||||||
initListener();
|
initListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initListener() {
|
private void initListener() {
|
||||||
setClick(viewBinding.tvCommit);
|
setClick(viewBinding.tvCommit);
|
||||||
setClick(viewBinding.tvSelectTime);
|
//
|
||||||
viewBinding.etPlanTime.addTextChangedListener(new TextWatcher() {
|
mWeekAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||||
}
|
switch (view.getId()){
|
||||||
|
case R.id.linear_week://选中
|
||||||
@Override
|
case R.id.checkbox:
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
if(mConfigEntity.getDetails().get(position).getStatus().equals("1")){
|
||||||
}
|
mConfigEntity.getDetails().get(position).setStatus("0");
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
if(weekList != null){
|
|
||||||
String time = s.toString();
|
|
||||||
if(TextUtils.isEmpty(time)){
|
|
||||||
weekList.get(0).getWashCycleList().get(mWeekAdapter.getmPos()).setDuration("");
|
|
||||||
}else{
|
}else{
|
||||||
weekList.get(0).getWashCycleList().get(mWeekAdapter.getmPos()).setDuration(time);
|
mConfigEntity.getDetails().get(position).setStatus("1");
|
||||||
}
|
}
|
||||||
|
mWeekAdapter.notifyItemChanged(position);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.tv_select_time:
|
||||||
|
selectStartTime(position);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.tv_plan_duration:
|
||||||
|
inputDuration(position);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mWeekAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
private void inputDuration(int position) {
|
||||||
|
showEditDialog(getString(R.string.device_work_times_title),
|
||||||
|
getString(R.string.input_water_plan_time),
|
||||||
|
mConfigEntity.getDetails().get(position).getDurationMin() == 0 ?
|
||||||
|
"" : mConfigEntity.getDetails().get(position).getDurationMin() + "",
|
||||||
|
true,
|
||||||
|
getString(R.string.cancel_text),
|
||||||
|
getString(R.string.confirm_text),
|
||||||
|
BaseFragment.INPUT_TYPE_NUMBER,
|
||||||
|
new BaseActivity.OnDialogClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
public void onCancelClick() {
|
||||||
mWeekAdapter.setSelPos(position);
|
|
||||||
String planStartTime = weekList.get(0).getWashCycleList().get(position).getTime();
|
|
||||||
String planTime = weekList.get(0).getWashCycleList().get(position).getDuration();
|
|
||||||
|
|
||||||
if(TextUtils.isEmpty(planStartTime)){
|
|
||||||
viewBinding.tvSelectTime.setHint(getString(R.string.select_water_time));
|
|
||||||
viewBinding.tvSelectTime.setText("");
|
|
||||||
}else{
|
|
||||||
viewBinding.tvSelectTime.setText(planStartTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(TextUtils.isEmpty(planTime)){
|
@Override
|
||||||
viewBinding.etPlanTime.setHint(getString(R.string.input_water_plan_time));
|
public void onConfirmClisk() {
|
||||||
viewBinding.etPlanTime.setText("");
|
|
||||||
}else{
|
|
||||||
viewBinding.etPlanTime.setText(planTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClisk(String content) {
|
||||||
|
if(Integer.parseInt(content) <= 0){
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.input_water_plan_time_error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mConfigEntity.getDetails().get(position).setDurationMin(Integer.parseInt(content));
|
||||||
|
mWeekAdapter.notifyItemChanged(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onView1Click() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void selectStartTime(int position) {
|
||||||
|
boolean times[] = {false, false, false, true, true, false};
|
||||||
|
//时间选择器
|
||||||
|
TimePickerView pvTime = new TimePickerBuilder(mContext, new OnTimeSelectListener() {
|
||||||
|
@Override
|
||||||
|
public void onTimeSelect(Date date, View v) {
|
||||||
|
mConfigEntity.getDetails().get(position).setStartTime(ZYTimeUtils.getStrTimeData_H_M(date));
|
||||||
|
mWeekAdapter.notifyItemChanged(position);
|
||||||
|
}
|
||||||
|
}).setType(times)
|
||||||
|
.setCancelColor(mContext.getColor(R.color.color_999999))
|
||||||
|
.setSubmitColor(mContext.getColor(R.color.color_zhu))
|
||||||
|
.setTextColorCenter(mContext.getColor(R.color.color_zhu))
|
||||||
|
.build();
|
||||||
|
pvTime.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void setClick(View view) {
|
private void setClick(View view) {
|
||||||
view.setOnClickListener(this::onClick);
|
view.setOnClickListener(this::onClick);
|
||||||
}
|
}
|
||||||
@@ -99,41 +142,49 @@ public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutB
|
|||||||
public void onClick(View v){
|
public void onClick(View v){
|
||||||
switch (v.getId()){
|
switch (v.getId()){
|
||||||
case R.id.tv_select_time:
|
case R.id.tv_select_time:
|
||||||
boolean times[] = {false, false, false, true, true, false};
|
|
||||||
//时间选择器
|
|
||||||
TimePickerView pvTime = new TimePickerBuilder(mContext, new OnTimeSelectListener() {
|
|
||||||
@Override
|
|
||||||
public void onTimeSelect(Date date, View v) {
|
|
||||||
viewBinding.tvSelectTime.setText(ZYTimeUtils.getStrTimeData_H_M(date));
|
|
||||||
if(weekList != null){
|
|
||||||
String startTime = ZYTimeUtils.getStrTimeData_H_M(date).trim();
|
|
||||||
weekList.get(0).getWashCycleList().get(mWeekAdapter.getmPos()).setTime(startTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).setType(times)
|
|
||||||
.setCancelColor(mContext.getColor(R.color.color_999999))
|
|
||||||
.setSubmitColor(mContext.getColor(R.color.color_zhu))
|
|
||||||
.setTextColorCenter(mContext.getColor(R.color.color_zhu))
|
|
||||||
.build();
|
|
||||||
pvTime.show();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.tv_commit:
|
case R.id.tv_commit:
|
||||||
List<WaterPlanWeekEntity.DeviceEntity> list = getSelectedDevices();
|
if(checkConfigFinish()){
|
||||||
if(list != null){
|
ToastUtil.showShort(mContext,"提交");
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkConfigFinish() {
|
||||||
|
if(TextUtils.isEmpty(viewBinding.etPlanName.getText().toString())){
|
||||||
|
ToastUtil.showShort(mContext,getString(R.string.plan_name_text_empty_hint));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<WaterPlanWeekEntity.DetailsBean> list = mConfigEntity.getDetails();
|
||||||
|
//是否勾选了排程日期
|
||||||
|
boolean isSelectOne = false;
|
||||||
|
if(list != null){
|
||||||
|
for(WaterPlanWeekEntity.DetailsBean bean : list){
|
||||||
|
if(bean.getStatus().equals("1")){
|
||||||
|
isSelectOne = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!isSelectOne){
|
||||||
|
ToastUtil.showShort(mContext,getString(R.string.plan_week_empty_hint));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//是否配置了排程日期的时间
|
||||||
|
boolean isPlanConfig = false;
|
||||||
|
for(WaterPlanWeekEntity.DetailsBean bean : list){
|
||||||
|
if(bean.getStatus().equals("1")){
|
||||||
|
if((TextUtils.isEmpty(bean.getStartTime()) ||
|
||||||
|
bean.getDurationMin() == 0)){
|
||||||
|
ToastUtil.showShort(mContext,"请完成" + bean.getWeekName() + "的时间配置");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private List<WaterPlanWeekEntity.DeviceEntity> getSelectedDevices() {
|
|
||||||
if (getActivity() instanceof AddWaterPlanActivity) {
|
|
||||||
return ((AddWaterPlanActivity) getActivity()).getSelectedDevices();
|
|
||||||
}
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WaterPlanPresenter createPresenter() {
|
public WaterPlanPresenter createPresenter() {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.ckkj.water.base.BaseFragment;
|
|||||||
import com.ckkj.water.databinding.WaterPlanFragmentBinding;
|
import com.ckkj.water.databinding.WaterPlanFragmentBinding;
|
||||||
import com.ckkj.water.main.activity.MainActivity;
|
import com.ckkj.water.main.activity.MainActivity;
|
||||||
import com.ckkj.water.network.BaseBean;
|
import com.ckkj.water.network.BaseBean;
|
||||||
import com.ckkj.water.plan.adapter.WaterPlanListAdapter;
|
//import com.ckkj.water.plan.adapter.WaterPlanListAdapter;
|
||||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
||||||
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
||||||
@@ -25,14 +25,14 @@ import java.util.List;
|
|||||||
|
|
||||||
public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, WaterPlanPresenter>
|
public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, WaterPlanPresenter>
|
||||||
implements WaterPlanContract.WaterPlanView {
|
implements WaterPlanContract.WaterPlanView {
|
||||||
private List<WaterPlanWeekEntity.DeviceEntity> mDevList = new ArrayList<>();
|
// private List<WaterPlanWeekEntity.DeviceEntity> mDevList = new ArrayList<>();
|
||||||
private WaterPlanListAdapter mAdapter;
|
// private WaterPlanListAdapter mAdapter;
|
||||||
@Override
|
@Override
|
||||||
public void initData(Bundle state) {
|
public void initData(Bundle state) {
|
||||||
|
|
||||||
String jsonContent = getString(R.string.plan_water_entity_json);
|
String jsonContent = getString(R.string.plan_water_entity_json);
|
||||||
WaterPlanWeekEntity entity = new Gson().fromJson(jsonContent, WaterPlanWeekEntity.class);
|
WaterPlanWeekEntity entity = new Gson().fromJson(jsonContent, WaterPlanWeekEntity.class);
|
||||||
mDevList = entity.getDeviceList();
|
// mDevList = entity.getDeviceList();
|
||||||
|
|
||||||
ImmersionBar.with(mContext)
|
ImmersionBar.with(mContext)
|
||||||
.statusBarColor(R.color.mainBackgroundColor)
|
.statusBarColor(R.color.mainBackgroundColor)
|
||||||
@@ -43,14 +43,14 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
viewBinding.includedTitle.tvTitle.setText(getString(R.string.plan_title));
|
viewBinding.includedTitle.tvTitle.setText(getString(R.string.plan_title));
|
||||||
initListener();
|
initListener();
|
||||||
|
|
||||||
mAdapter = new WaterPlanListAdapter(mContext,R.layout.water_plan_list_item,mDevList);
|
// mAdapter = new WaterPlanListAdapter(mContext,R.layout.water_plan_list_item,mDevList);
|
||||||
viewBinding.rvPlans.setAdapter(mAdapter);
|
// viewBinding.rvPlans.setAdapter(mAdapter);
|
||||||
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
// mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
// public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||||
goTo(mContext, PlanDetailActivity.class,null);
|
// goTo(mContext, PlanDetailActivity.class,null);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,55 +1,55 @@
|
|||||||
package com.ckkj.water.plan.adapter;
|
//package com.ckkj.water.plan.adapter;
|
||||||
|
//
|
||||||
import android.content.Context;
|
//import android.content.Context;
|
||||||
import android.widget.CheckBox;
|
//import android.widget.CheckBox;
|
||||||
|
//
|
||||||
import androidx.annotation.Nullable;
|
//import androidx.annotation.Nullable;
|
||||||
|
//
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.ckkj.water.R;
|
//import com.ckkj.water.R;
|
||||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||||
|
//
|
||||||
import java.util.HashSet;
|
//import java.util.HashSet;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
|
//
|
||||||
public class BindDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
//public class BindDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||||
private Context mContext;
|
// private Context mContext;
|
||||||
private Set<Integer> mSelectedPositions = new HashSet<>();
|
// private Set<Integer> mSelectedPositions = new HashSet<>();
|
||||||
|
//
|
||||||
public BindDeviceAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
// public BindDeviceAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||||
super(layoutResId, data);
|
// super(layoutResId, data);
|
||||||
this.mContext = context;
|
// this.mContext = context;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||||
CheckBox checkBox = helper.getView(R.id.radio);
|
// CheckBox checkBox = helper.getView(R.id.radio);
|
||||||
helper.setText(R.id.tv_device_name, item.getDeviceName());
|
// helper.setText(R.id.tv_device_name, item.getDeviceName());
|
||||||
helper.setText(R.id.tv_device_serial, item.getDeviceCode());
|
// helper.setText(R.id.tv_device_serial, item.getDeviceCode());
|
||||||
checkBox.setChecked(mSelectedPositions.contains(helper.getLayoutPosition()));
|
// checkBox.setChecked(mSelectedPositions.contains(helper.getLayoutPosition()));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void toggleSelection(int position) {
|
// public void toggleSelection(int position) {
|
||||||
if (mSelectedPositions.contains(position)) {
|
// if (mSelectedPositions.contains(position)) {
|
||||||
mSelectedPositions.remove(position);
|
// mSelectedPositions.remove(position);
|
||||||
} else {
|
// } else {
|
||||||
mSelectedPositions.add(position);
|
// mSelectedPositions.add(position);
|
||||||
}
|
// }
|
||||||
notifyDataSetChanged();
|
// notifyDataSetChanged();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void clearSelection() {
|
// public void clearSelection() {
|
||||||
mSelectedPositions.clear();
|
// mSelectedPositions.clear();
|
||||||
notifyDataSetChanged();
|
// notifyDataSetChanged();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Set<Integer> getSelectedPositions() {
|
// public Set<Integer> getSelectedPositions() {
|
||||||
return new HashSet<>(mSelectedPositions);
|
// return new HashSet<>(mSelectedPositions);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public int getSelectedCount() {
|
// public int getSelectedCount() {
|
||||||
return mSelectedPositions.size();
|
// return mSelectedPositions.size();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
package com.ckkj.water.plan.adapter;
|
//package com.ckkj.water.plan.adapter;
|
||||||
|
//
|
||||||
import androidx.annotation.Nullable;
|
//import androidx.annotation.Nullable;
|
||||||
|
//
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.ckkj.water.R;
|
//import com.ckkj.water.R;
|
||||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
public class PlanDetailDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
//public class PlanDetailDeviceAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||||
|
//
|
||||||
public PlanDetailDeviceAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
// public PlanDetailDeviceAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||||
super(layoutResId, data);
|
// super(layoutResId, data);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||||
helper.setText(R.id.tv_device_name,item.getDeviceName());
|
// helper.setText(R.id.tv_device_name,item.getDeviceName());
|
||||||
helper.setText(R.id.tv_device_serial,item.getDeviceCode());
|
// helper.setText(R.id.tv_device_serial,item.getDeviceCode());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
package com.ckkj.water.plan.adapter;
|
//package com.ckkj.water.plan.adapter;
|
||||||
|
//
|
||||||
import androidx.annotation.Nullable;
|
//import androidx.annotation.Nullable;
|
||||||
|
//
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.ckkj.water.R;
|
//import com.ckkj.water.R;
|
||||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
public class PlanDetailTimeAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.WashCycleEntity, BaseViewHolder> {
|
//public class PlanDetailTimeAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.WashCycleEntity, BaseViewHolder> {
|
||||||
|
//
|
||||||
public PlanDetailTimeAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.WashCycleEntity> data) {
|
// public PlanDetailTimeAdapter(int layoutResId, @Nullable List<WaterPlanWeekEntity.WashCycleEntity> data) {
|
||||||
super(layoutResId, data);
|
// super(layoutResId, data);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.WashCycleEntity item) {
|
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.WashCycleEntity item) {
|
||||||
helper.setText(R.id.tv_week,item.getWeek());
|
// helper.setText(R.id.tv_week,item.getWeek());
|
||||||
helper.setText(R.id.tv_start_time,item.getTime());
|
// helper.setText(R.id.tv_start_time,item.getTime());
|
||||||
helper.setText(R.id.tv_duration,item.getDuration());
|
// helper.setText(R.id.tv_duration,item.getDuration());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
package com.ckkj.water.plan.adapter;
|
//package com.ckkj.water.plan.adapter;
|
||||||
|
//
|
||||||
import android.content.Context;
|
//import android.content.Context;
|
||||||
import android.widget.CheckBox;
|
//import android.widget.CheckBox;
|
||||||
|
//
|
||||||
import androidx.annotation.Nullable;
|
//import androidx.annotation.Nullable;
|
||||||
|
//
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
//import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
//import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.ckkj.water.R;
|
//import com.ckkj.water.R;
|
||||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
//import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||||
|
//
|
||||||
import java.util.HashSet;
|
//import java.util.HashSet;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
|
//
|
||||||
public class WaterPlanListAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
//public class WaterPlanListAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DeviceEntity, BaseViewHolder> {
|
||||||
private Context mContext;
|
// private Context mContext;
|
||||||
|
//
|
||||||
public WaterPlanListAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
// public WaterPlanListAdapter(Context context, int layoutResId, @Nullable List<WaterPlanWeekEntity.DeviceEntity> data) {
|
||||||
super(layoutResId, data);
|
// super(layoutResId, data);
|
||||||
this.mContext = context;
|
// this.mContext = context;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
// protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DeviceEntity item) {
|
||||||
helper.setText(R.id.tv_device_name, item.getDeviceName());
|
// helper.setText(R.id.tv_device_name, item.getDeviceName());
|
||||||
helper.setText(R.id.tv_device_serial, item.getDeviceCode());
|
// 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.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
@@ -19,36 +21,66 @@ import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WaterPlanWeekAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.WashCycleEntity, BaseViewHolder> {
|
public class WaterPlanWeekAdapter extends BaseQuickAdapter<WaterPlanWeekEntity.DetailsBean, BaseViewHolder> {
|
||||||
private List<WaterPlanWeekEntity.WashCycleEntity> mList = new ArrayList<>();
|
private List<WaterPlanWeekEntity.DetailsBean> mList = new ArrayList<>();
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private int mPos = 0;
|
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);
|
super(layoutResId, data);
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mList = data;
|
this.mList = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.WashCycleEntity item) {
|
protected void convert(BaseViewHolder helper, WaterPlanWeekEntity.DetailsBean item) {
|
||||||
helper.setText(R.id.tv_week,item.getWeek());
|
TextView tvStartTime = helper.getView(R.id.tv_select_time);
|
||||||
LinearLayout linearItem = helper.getView(R.id.linear_item);
|
CheckBox checkBox = helper.getView(R.id.checkbox);
|
||||||
View viewStatus = helper.getView(R.id.view_status);
|
TextView tvPlanDuration = helper.getView(R.id.tv_plan_duration);
|
||||||
if(helper.getLayoutPosition() == mPos){
|
|
||||||
linearItem.setBackground(mContext.getResources().getDrawable(R.drawable.shape_water_period_sel_bg));
|
|
||||||
viewStatus.setVisibility(VISIBLE);
|
helper.setText(R.id.tv_week_name,item.getWeekName());
|
||||||
viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_green_circle));
|
|
||||||
|
if(!TextUtils.isEmpty(item.getStartTime())){
|
||||||
|
helper.setText(R.id.tv_select_time,item.getStartTime());
|
||||||
}else{
|
}else{
|
||||||
linearItem.setBackground(null);
|
helper.setText(R.id.tv_select_time,"");
|
||||||
if(!TextUtils.isEmpty(item.getTime()) && !TextUtils.isEmpty(item.getDuration())){
|
tvStartTime.setHint(mContext.getString(R.string.select_water_time));
|
||||||
viewStatus.setVisibility(VISIBLE);
|
}
|
||||||
viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_yellow_circle));
|
if(item.getDurationMin() != 0){
|
||||||
|
helper.setText(R.id.tv_plan_duration,item.getDurationMin() + "");
|
||||||
}else{
|
}else{
|
||||||
viewStatus.setVisibility(INVISIBLE);
|
helper.setText(R.id.tv_plan_duration,"");
|
||||||
viewStatus.setBackground(null);
|
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) {
|
public void setSelPos(int position) {
|
||||||
|
|||||||
@@ -3,150 +3,62 @@ package com.ckkj.water.plan.entity;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
public class WaterPlanWeekEntity implements Serializable {
|
public class WaterPlanWeekEntity implements Serializable {
|
||||||
|
|
||||||
/**
|
|
||||||
* 排程名称
|
|
||||||
*/
|
|
||||||
private String scheduleName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* id : 2057637613963182082
|
||||||
|
* userId : 2056543507514097665
|
||||||
|
* name : 排程四
|
||||||
|
* deviceIds : null
|
||||||
|
* status : 1
|
||||||
|
* details : [{"createDept":null,"createBy":"2056543507514097665","createTime":"2026-05-22 09:40:10","updateBy":"2056543507514097665","updateTime":"2026-05-22 09:40:10","id":"2057637613963182083","scheduleId":"2057637613963182082","weekday":1,"startTime":"2026-04-11 10:12:12","durationMin":20,"zones":null,"triggerType":"0","status":"1"},{"createDept":null,"createBy":"2056543507514097665","createTime":"2026-05-22 09:40:10","updateBy":"2056543507514097665","updateTime":"2026-05-22 09:40:10","id":"2057637613963182084","scheduleId":"2057637613963182082","weekday":2,"startTime":"2026-04-11 10:12:12","durationMin":20,"zones":null,"triggerType":"0","status":"1"},{"createDept":null,"createBy":"2056543507514097665","createTime":"2026-05-22 09:40:10","updateBy":"2056543507514097665","updateTime":"2026-05-22 09:40:10","id":"2057637613963182085","scheduleId":"2057637613963182082","weekday":3,"startTime":"2026-04-11 10:12:12","durationMin":20,"zones":null,"triggerType":"0","status":"1"}]
|
||||||
*/
|
*/
|
||||||
private boolean enable;
|
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String userId;
|
||||||
|
private String name;
|
||||||
|
private Object deviceIds;
|
||||||
|
private String status;
|
||||||
|
private List<DetailsBean> details;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public static class DetailsBean implements Serializable{
|
||||||
/**
|
/**
|
||||||
* 洗水周期列表
|
* createDept : null
|
||||||
|
* createBy : 2056543507514097665
|
||||||
|
* createTime : 2026-05-22 09:40:10
|
||||||
|
* updateBy : 2056543507514097665
|
||||||
|
* updateTime : 2026-05-22 09:40:10
|
||||||
|
* id : 2057637613963182083
|
||||||
|
* scheduleId : 2057637613963182082
|
||||||
|
* weekday : 1
|
||||||
|
* startTime : 2026-04-11 10:12:12
|
||||||
|
* durationMin : 20
|
||||||
|
* zones : null
|
||||||
|
* triggerType : 0
|
||||||
|
* status : 1
|
||||||
*/
|
*/
|
||||||
private List<WashCycleEntity> washCycleList;
|
|
||||||
|
|
||||||
/**
|
private Object createDept;
|
||||||
* 关联设备列表
|
private String createBy;
|
||||||
*/
|
private String createTime;
|
||||||
private List<DeviceEntity> deviceList;
|
private String updateBy;
|
||||||
|
private String updateTime;
|
||||||
public String getScheduleName() {
|
private String id;
|
||||||
return scheduleName;
|
private String scheduleId;
|
||||||
}
|
private int weekday;
|
||||||
|
private String weekName;
|
||||||
public void setScheduleName(String scheduleName) {
|
private String startTime;
|
||||||
this.scheduleName = scheduleName;
|
private int durationMin = 0;
|
||||||
}
|
private Object zones;
|
||||||
|
private String triggerType;
|
||||||
public boolean isEnable() {
|
private String status;
|
||||||
return enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnable(boolean enable) {
|
|
||||||
this.enable = enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<WashCycleEntity> getWashCycleList() {
|
|
||||||
return washCycleList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWashCycleList(List<WashCycleEntity> washCycleList) {
|
|
||||||
this.washCycleList = washCycleList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DeviceEntity> getDeviceList() {
|
|
||||||
return deviceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceList(List<DeviceEntity> deviceList) {
|
|
||||||
this.deviceList = deviceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 洗水周期
|
|
||||||
*/
|
|
||||||
public static class WashCycleEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 星期
|
|
||||||
* 如:周一
|
|
||||||
*/
|
|
||||||
private String week;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间
|
|
||||||
* 如:10:30
|
|
||||||
*/
|
|
||||||
private String time;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时长
|
|
||||||
* 如:10min
|
|
||||||
*/
|
|
||||||
private String duration;
|
|
||||||
|
|
||||||
public String getWeek() {
|
|
||||||
return week;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWeek(String week) {
|
|
||||||
this.week = week;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTime() {
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTime(String time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDuration() {
|
|
||||||
return duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDuration(String duration) {
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备实体
|
|
||||||
*/
|
|
||||||
public static class DeviceEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备名称
|
|
||||||
*/
|
|
||||||
private String deviceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备编号
|
|
||||||
*/
|
|
||||||
private String deviceCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已关联
|
|
||||||
*/
|
|
||||||
private boolean bind;
|
|
||||||
|
|
||||||
public String getDeviceName() {
|
|
||||||
return deviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceName(String deviceName) {
|
|
||||||
this.deviceName = deviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceCode() {
|
|
||||||
return deviceCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceCode(String deviceCode) {
|
|
||||||
this.deviceCode = deviceCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBind() {
|
|
||||||
return bind;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBind(boolean bind) {
|
|
||||||
this.bind = bind;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -974,4 +974,18 @@ public class ZYTimeUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String[] WEEK_NAMES = {"周一", "周二", "周三", "周四", "周五", "周六", "周日"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据星期索引获取星期名称
|
||||||
|
* @param weekday 星期索引,0=周一,1=周二,...,6=周日
|
||||||
|
* @return 对应的星期名称
|
||||||
|
*/
|
||||||
|
public static String getWeekName(int weekday) {
|
||||||
|
if (weekday >= 0 && weekday < 7) {
|
||||||
|
return WEEK_NAMES[weekday];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
133
app/src/main/res/layout/plan_week_config_item.xml
Normal file
133
app/src/main/res/layout/plan_week_config_item.xml
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_20">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linear_week"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginHorizontal="@dimen/dp_20"
|
||||||
|
android:background="@drawable/shape_zhu_line_radiu_20button_bg">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_week_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingVertical="@dimen/dp_10"
|
||||||
|
android:paddingLeft="@dimen/dp_20"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/color_zhu"
|
||||||
|
android:text="星期一"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:layout_height="0dp"/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/checkbox"
|
||||||
|
android:layout_width="@dimen/dp_15"
|
||||||
|
android:layout_height="@dimen/dp_15"
|
||||||
|
android:layout_marginRight="@dimen/dp_20"
|
||||||
|
android:background="@drawable/select_radio"
|
||||||
|
android:checked="false"
|
||||||
|
android:button="@null"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:layout_marginHorizontal="@dimen/dp_20"
|
||||||
|
android:paddingHorizontal="@dimen/dp_20"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/shape_water_plan_time_bg">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/red"
|
||||||
|
android:text="*"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_4"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/color_222222"
|
||||||
|
android:text="@string/plan_start_time"
|
||||||
|
android:layout_marginVertical="@dimen/dp_13"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_select_time"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="9"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/color_222222"
|
||||||
|
android:layout_marginLeft="@dimen/dp_10"
|
||||||
|
android:hint="@string/select_water_time"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_24"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:src="@mipmap/icon_point_right_wt"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/color_d9d9d9"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/red"
|
||||||
|
android:text="*"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_4"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/color_222222"
|
||||||
|
android:text="@string/plan_time"
|
||||||
|
android:layout_marginVertical="@dimen/dp_13"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_plan_duration"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="9"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/color_222222"
|
||||||
|
android:layout_marginLeft="@dimen/dp_10"
|
||||||
|
android:hint="@string/input_water_plan_time"
|
||||||
|
android:inputType="number"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_time_unit"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:gravity="center_vertical|right"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/color_222222"
|
||||||
|
android:layout_marginLeft="@dimen/dp_10"
|
||||||
|
android:hint="min"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -28,6 +32,7 @@
|
|||||||
android:layout_marginVertical="@dimen/dp_13"/>
|
android:layout_marginVertical="@dimen/dp_13"/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
android:id="@+id/et_plan_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@@ -66,112 +71,11 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_week"
|
android:id="@+id/rv_week_config"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="@dimen/dp_12"
|
tools:listitem="@layout/plan_week_config_item"
|
||||||
android:layout_gravity="center"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
|
||||||
tools:listitem="@layout/plan_period_item"
|
|
||||||
tools:itemCount="7"
|
|
||||||
app:spanCount="7"/>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_15"
|
|
||||||
android:layout_marginHorizontal="@dimen/dp_20"
|
|
||||||
android:paddingHorizontal="@dimen/dp_20"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@drawable/shape_water_plan_time_bg">
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="@color/red"
|
|
||||||
android:text="*"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/dp_4"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="@color/color_222222"
|
|
||||||
android:text="@string/plan_start_time"
|
|
||||||
android:layout_marginVertical="@dimen/dp_13"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_select_time"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="9"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="@color/color_222222"
|
|
||||||
android:layout_marginLeft="@dimen/dp_10"
|
|
||||||
android:hint="@string/select_water_time"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/dp_24"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:src="@mipmap/icon_point_right_wt"/>
|
|
||||||
</LinearLayout>
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="@color/color_d9d9d9"/>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="@color/red"
|
|
||||||
android:text="*"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/dp_4"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="@color/color_222222"
|
|
||||||
android:text="@string/plan_time"
|
|
||||||
android:layout_marginVertical="@dimen/dp_13"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_plan_time"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="9"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="@color/color_222222"
|
|
||||||
android:background="@null"
|
|
||||||
android:layout_marginLeft="@dimen/dp_10"
|
|
||||||
android:hint="@string/input_water_plan_time"
|
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:inputType="number"/>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_time_unit"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="2"
|
|
||||||
android:gravity="center_vertical|right"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="@color/color_222222"
|
|
||||||
android:layout_marginLeft="@dimen/dp_10"
|
|
||||||
android:hint="min"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_commit"
|
android:id="@+id/tv_commit"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -183,5 +87,8 @@
|
|||||||
android:paddingVertical="@dimen/dp_10"
|
android:paddingVertical="@dimen/dp_10"
|
||||||
android:layout_marginHorizontal="@dimen/dp_20"
|
android:layout_marginHorizontal="@dimen/dp_20"
|
||||||
android:layout_marginTop="@dimen/dp_40"
|
android:layout_marginTop="@dimen/dp_40"
|
||||||
|
android:layout_marginBottom="@dimen/dp_20"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
@@ -96,6 +96,7 @@
|
|||||||
<string name="plan_time">浇水时长</string>
|
<string name="plan_time">浇水时长</string>
|
||||||
<string name="plan_start_time">开始时间</string>
|
<string name="plan_start_time">开始时间</string>
|
||||||
<string name="select_water_time">请选择浇水时间</string>
|
<string name="select_water_time">请选择浇水时间</string>
|
||||||
|
<string name="input_water_plan_time_error">浇水时长不能小于0</string>
|
||||||
<string name="input_water_plan_time">请输入浇水时长</string>
|
<string name="input_water_plan_time">请输入浇水时长</string>
|
||||||
<string name="device_status">状态</string>
|
<string name="device_status">状态</string>
|
||||||
<string name="button_delete">删除</string>
|
<string name="button_delete">删除</string>
|
||||||
|
|||||||
@@ -92,11 +92,14 @@
|
|||||||
<string name="water_device_bind">关联设备</string>
|
<string name="water_device_bind">关联设备</string>
|
||||||
<string name="add_water_plan_title">新增排程</string>
|
<string name="add_water_plan_title">新增排程</string>
|
||||||
<string name="plan_name_text">排程名称</string>
|
<string name="plan_name_text">排程名称</string>
|
||||||
|
<string name="plan_name_text_empty_hint">排程名称不能为空</string>
|
||||||
|
<string name="plan_week_empty_hint">请选择排程日期</string>
|
||||||
<string name="plan_period">浇水周期</string>
|
<string name="plan_period">浇水周期</string>
|
||||||
<string name="plan_time">浇水时长</string>
|
<string name="plan_time">浇水时长</string>
|
||||||
<string name="plan_start_time">开始时间</string>
|
<string name="plan_start_time">开始时间</string>
|
||||||
<string name="select_water_time">请选择浇水时间</string>
|
<string name="select_water_time">请选择浇水时间</string>
|
||||||
<string name="input_water_plan_time">请输入浇水时长</string>
|
<string name="input_water_plan_time">请输入浇水时长</string>
|
||||||
|
<string name="input_water_plan_time_error">浇水时长不能小于0</string>
|
||||||
<string name="device_status">状态</string>
|
<string name="device_status">状态</string>
|
||||||
<string name="button_delete">删除</string>
|
<string name="button_delete">删除</string>
|
||||||
<string name="button_edit">编辑</string>
|
<string name="button_edit">编辑</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user