排程部分功能优化,
解绑,删除,绑定
This commit is contained in:
@@ -4,6 +4,7 @@ import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -158,6 +159,17 @@ public class AddWaterPlanActivity extends BaseActivity<AddWaterPlanLayoutBinding
|
||||
}
|
||||
|
||||
if (!configFragment.isConfigSubmitted()) {
|
||||
// 校验新增排程的配置
|
||||
if (!mIsEditMode) {
|
||||
if (TextUtils.isEmpty(configFragment.getPlanName())) {
|
||||
ToastUtil.showShort(mContext, getString(R.string.plan_name_text_empty_hint));
|
||||
return;
|
||||
}
|
||||
if (!configFragment.hasTimeConfig()) {
|
||||
ToastUtil.showShort(mContext, "请至少配置一天的时间");
|
||||
return;
|
||||
}
|
||||
}
|
||||
showDialogtext(null, false, false, true,
|
||||
"提示", "关联设备需要保存排程配置,是否继续?",
|
||||
getString(R.string.cancel_text), "继续", new BaseFragment.OnDialogClick() {
|
||||
|
||||
@@ -167,6 +167,13 @@ public class PlanBoundDeviceFragment extends BaseFragment<PlanBoundDeviceLayoutB
|
||||
ToastUtil.showShort(mContext, "解绑成功");
|
||||
mAdapter.notifyItemRemoved(position);
|
||||
mEditEntity.getDeviceIds().remove(position);
|
||||
if (mAdapter.getItemCount() != 0) {
|
||||
viewBinding.relNoresult.setVisibility(View.GONE);
|
||||
viewBinding.linearContent.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewBinding.relNoresult.setVisibility(View.VISIBLE);
|
||||
viewBinding.linearContent.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -189,6 +189,35 @@ public class WaterConfigFragment_copy extends BaseFragment<WaterConfigFragmentLa
|
||||
return isConfigSubmitted;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前排程名称
|
||||
* @return 排程名称
|
||||
*/
|
||||
public String getPlanName() {
|
||||
if (mLocalEntity != null) {
|
||||
return mLocalEntity.getName();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否至少配置了一天的时间
|
||||
* @return true表示有时间配置,false表示没有配置任何时间
|
||||
*/
|
||||
public boolean hasTimeConfig() {
|
||||
for (WaterPlanWeekEntity.DetailsBean dayBean : weekList) {
|
||||
List<WaterPlanWeekEntity.TimeDataBean> timeDataList = dayBean.getTimeData();
|
||||
if (timeDataList != null && !timeDataList.isEmpty()) {
|
||||
for (WaterPlanWeekEntity.TimeDataBean timeData : timeDataList) {
|
||||
if (!TextUtils.isEmpty(timeData.getStartTime()) && timeData.getDurationMin() > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并保存配置(供外部调用)
|
||||
* @return true表示校验通过并已提交保存,false表示校验失败
|
||||
|
||||
Reference in New Issue
Block a user