更新后新增排程提交
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.ckkj.water.plan;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
@@ -67,11 +70,14 @@ public class AddWaterPlanActivity extends BaseActivity<AddWaterPlanLayoutBinding
|
||||
// 根据模式设置标题
|
||||
if (mIsEditMode) {
|
||||
viewBinding.includedTitle.tvTitle.setText(R.string.edit_water_plan_title);
|
||||
viewBinding.tvBound.setVisibility(VISIBLE);
|
||||
} else {
|
||||
viewBinding.includedTitle.tvTitle.setText(R.string.add_water_plan_title);
|
||||
viewBinding.tvBound.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mFragmentList.add(new WaterConfigFragment_copy());
|
||||
mFragmentList.add(new PlanBoundDeviceFragment());
|
||||
mFragmentList.add(new BindDeviceFragment());
|
||||
ViewPagerAdapter adapter = new ViewPagerAdapter(mContext, mFragmentList);
|
||||
viewBinding.viewpage.setAdapter(adapter);
|
||||
@@ -95,6 +101,7 @@ public class AddWaterPlanActivity extends BaseActivity<AddWaterPlanLayoutBinding
|
||||
private void initListener() {
|
||||
setClick(viewBinding.includedTitle.imgBack);
|
||||
setClick(viewBinding.tvConfig);
|
||||
setClick(viewBinding.tvBound);
|
||||
setClick(viewBinding.tvBind);
|
||||
}
|
||||
|
||||
@@ -111,9 +118,17 @@ public class AddWaterPlanActivity extends BaseActivity<AddWaterPlanLayoutBinding
|
||||
case R.id.tv_config:
|
||||
viewBinding.tvConfig.setSelected(true);
|
||||
viewBinding.tvBind.setSelected(false);
|
||||
viewBinding.tvBound.setSelected(false);
|
||||
viewBinding.viewpage.setCurrentItem(0);
|
||||
break;
|
||||
|
||||
case R.id.tv_bound:
|
||||
viewBinding.tvConfig.setSelected(false);
|
||||
viewBinding.tvBound.setSelected(true);
|
||||
viewBinding.tvBind.setSelected(false);
|
||||
viewBinding.viewpage.setCurrentItem(1);
|
||||
break;
|
||||
|
||||
case R.id.tv_bind:
|
||||
WaterConfigFragment_copy configFragment = (WaterConfigFragment_copy) mFragmentList.get(0);
|
||||
|
||||
@@ -170,11 +185,12 @@ public class AddWaterPlanActivity extends BaseActivity<AddWaterPlanLayoutBinding
|
||||
return;
|
||||
}
|
||||
viewBinding.tvConfig.setSelected(false);
|
||||
viewBinding.tvBound.setSelected(false);
|
||||
viewBinding.tvBind.setSelected(true);
|
||||
viewBinding.viewpage.setCurrentItem(1);
|
||||
viewBinding.viewpage.setCurrentItem(2);
|
||||
|
||||
// 传递排程数据给 BindDeviceFragment
|
||||
BindDeviceFragment bindDeviceFragment = (BindDeviceFragment) mFragmentList.get(1);
|
||||
BindDeviceFragment bindDeviceFragment = (BindDeviceFragment) mFragmentList.get(2);
|
||||
bindDeviceFragment.setPlanEntity(entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,13 @@ public class BindDeviceFragment extends BaseFragment<PlanBindDeviceLayoutBinding
|
||||
if(mAdapter != null){
|
||||
mDeviceList = bean.getDeviceList();
|
||||
mAdapter.setNewData(mDeviceList);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.ckkj.water.plan;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.ckkj.water.base.BaseFragment;
|
||||
import com.ckkj.water.databinding.PlanBoundDeviceLayoutBinding;
|
||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.plan.entity.WaterPlanWeekEntity;
|
||||
import com.ckkj.water.plan.mvp.WaterPlanContract;
|
||||
import com.ckkj.water.plan.mvp.WaterPlanImpl;
|
||||
import com.ckkj.water.plan.mvp.WaterPlanPresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fengxiaoyang
|
||||
* @date 2026/5/29
|
||||
* @description 已绑定的设备列表
|
||||
*/
|
||||
public class PlanBoundDeviceFragment extends BaseFragment<PlanBoundDeviceLayoutBinding, WaterPlanPresenter>
|
||||
implements WaterPlanContract.WaterPlanView{
|
||||
@Override
|
||||
public void initData(Bundle state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaterPlanPresenter createPresenter() {
|
||||
return new WaterPlanPresenter(new WaterPlanImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWaterConfigListSuccess(List<WaterPlanWeekEntity> list, int total) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfigSuccess(WaterPlanWeekEntity entity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSuccess(WaterPlanWeekEntity entity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlanStatusSuccess(BaseBean bean, String status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPlanDetailInfo(WaterPlanWeekEntity entity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPlanBindDeviceList(WaterDeviceEntity bean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void planBindDeviceSuccess(BaseBean bean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanSuccess(BaseBean bean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetChange(int netModel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logOut(BaseBean bean) {
|
||||
|
||||
}
|
||||
}
|
||||
14
app/src/main/res/drawable/tab_selector_bg_center.xml
Normal file
14
app/src/main/res/drawable/tab_selector_bg_center.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/color_zhu" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white" />
|
||||
<stroke android:color="@color/color_zhu" android:width="@dimen/dp_1"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -27,6 +27,16 @@
|
||||
android:textSize="14sp"
|
||||
android:textColor="@drawable/tab_selector_text"
|
||||
android:text="@string/water_device_config"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_bound"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/tab_selector_bg_center"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@drawable/tab_selector_text"
|
||||
android:text="@string/water_bound_device"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_bind"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@@ -6,14 +6,20 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/dp_20">
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_devices"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listitem="@layout/plan_bind_device_item"
|
||||
tools:itemCount="3"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
|
||||
<TextView
|
||||
@@ -29,4 +35,16 @@
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:gravity="center"/>
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rel_noresult"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:visibility="gone">
|
||||
<include
|
||||
android:id="@+id/included_noresult"
|
||||
layout="@layout/include_no_result_layout"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
80
app/src/main/res/layout/plan_bound_device_item.xml
Normal file
80
app/src/main/res/layout/plan_bound_device_item.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/dp_10"
|
||||
android:layout_marginVertical="@dimen/dp_5"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="4dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="@dimen/dp_12">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/dp_10">
|
||||
|
||||
<!-- 设备名称 -->
|
||||
<TextView
|
||||
android:id="@+id/tv_device_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="智能浇水设备A1"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- 设备序列号 -->
|
||||
<TextView
|
||||
android:id="@+id/tv_device_serial"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:text="YA226641000107"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<!-- 电量信息 -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_4"
|
||||
android:layout_height="@dimen/dp_4"
|
||||
android:background="@drawable/shape_green_circle"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_battery_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:text="已绑定"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/img_delete"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:src="@mipmap/icon_delete"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
38
app/src/main/res/layout/plan_bound_device_layout.xml
Normal file
38
app/src/main/res/layout/plan_bound_device_layout.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/dp_20">
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_devices"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listitem="@layout/plan_bound_device_item"
|
||||
tools:itemCount="3"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rel_noresult"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:visibility="gone">
|
||||
<include
|
||||
android:id="@+id/included_noresult"
|
||||
layout="@layout/include_no_result_layout"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
@@ -89,6 +89,7 @@
|
||||
<string name="add_water_plan">+新增排程</string>
|
||||
<string name="plan_title">排程</string>
|
||||
<string name="water_device_config">浇水配置</string>
|
||||
<string name="water_bound_device">已关联设备</string>
|
||||
<string name="water_device_bind">关联设备</string>
|
||||
<string name="add_water_plan_title">新增排程</string>
|
||||
<string name="edit_water_plan_title">Edit Plan</string>
|
||||
|
||||
@@ -90,7 +90,8 @@
|
||||
<string name="add_water_plan">+新增排程</string>
|
||||
<string name="plan_title">排程</string>
|
||||
<string name="water_device_config">浇水配置</string>
|
||||
<string name="water_device_bind">关联设备</string>
|
||||
<string name="water_bound_device">已关联设备</string>
|
||||
<string name="water_device_bind">可关联设备</string>
|
||||
<string name="add_water_plan_title">新增排程</string>
|
||||
<string name="edit_water_plan_title">编辑排程</string>
|
||||
<string name="plan_name_text">排程名称</string>
|
||||
|
||||
Reference in New Issue
Block a user