排程部分功能优化,
解绑,删除,绑定
This commit is contained in:
@@ -4,6 +4,7 @@ import static android.view.View.GONE;
|
|||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@@ -158,6 +159,17 @@ public class AddWaterPlanActivity extends BaseActivity<AddWaterPlanLayoutBinding
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!configFragment.isConfigSubmitted()) {
|
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,
|
showDialogtext(null, false, false, true,
|
||||||
"提示", "关联设备需要保存排程配置,是否继续?",
|
"提示", "关联设备需要保存排程配置,是否继续?",
|
||||||
getString(R.string.cancel_text), "继续", new BaseFragment.OnDialogClick() {
|
getString(R.string.cancel_text), "继续", new BaseFragment.OnDialogClick() {
|
||||||
|
|||||||
@@ -167,6 +167,13 @@ public class PlanBoundDeviceFragment extends BaseFragment<PlanBoundDeviceLayoutB
|
|||||||
ToastUtil.showShort(mContext, "解绑成功");
|
ToastUtil.showShort(mContext, "解绑成功");
|
||||||
mAdapter.notifyItemRemoved(position);
|
mAdapter.notifyItemRemoved(position);
|
||||||
mEditEntity.getDeviceIds().remove(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
|
@Override
|
||||||
|
|||||||
@@ -189,6 +189,35 @@ public class WaterConfigFragment_copy extends BaseFragment<WaterConfigFragmentLa
|
|||||||
return isConfigSubmitted;
|
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表示校验失败
|
* @return true表示校验通过并已提交保存,false表示校验失败
|
||||||
|
|||||||
6
app/src/main/res/drawable/shape_add_water_tab_bg.xml
Normal file
6
app/src/main/res/drawable/shape_add_water_tab_bg.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/white"/>
|
||||||
|
<stroke android:color="@color/color_zhu" android:width="@dimen/dp_1"/>
|
||||||
|
<corners android:radius="@dimen/dp_4"/>
|
||||||
|
</shape>
|
||||||
@@ -6,11 +6,5 @@
|
|||||||
<corners android:topLeftRadius="@dimen/dp_4" android:bottomLeftRadius="@dimen/dp_4" />
|
<corners android:topLeftRadius="@dimen/dp_4" android:bottomLeftRadius="@dimen/dp_4" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="@color/white" />
|
|
||||||
<stroke android:color="@color/color_zhu" android:width="@dimen/dp_1"/>
|
|
||||||
<corners android:topLeftRadius="@dimen/dp_4" android:bottomLeftRadius="@dimen/dp_4" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
</selector>
|
||||||
@@ -6,11 +6,4 @@
|
|||||||
<corners android:topRightRadius="@dimen/dp_4" android:bottomRightRadius="@dimen/dp_4" />
|
<corners android:topRightRadius="@dimen/dp_4" android:bottomRightRadius="@dimen/dp_4" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="@color/white" />
|
|
||||||
<stroke android:color="@color/color_zhu" android:width="@dimen/dp_1"/>
|
|
||||||
<corners android:bottomRightRadius="@dimen/dp_4" android:topRightRadius="@dimen/dp_4" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
</selector>
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dp_40"
|
android:layout_height="@dimen/dp_40"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_marginHorizontal="@dimen/dp_20">
|
android:layout_marginHorizontal="@dimen/dp_20"
|
||||||
|
android:background="@drawable/shape_add_water_tab_bg">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_config"
|
android:id="@+id/tv_config"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
Reference in New Issue
Block a user