From 637e3152e3bfea430ca774c7dd178b4b9696c37f Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期二, 26 十二月 2023 17:11:58 +0800 Subject: [PATCH] 2023年12月26日17:11:48 --- app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | 62 ++++++++++++++++++++---------- 1 files changed, 41 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java index 2d5e97f..692627b 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java @@ -21,6 +21,7 @@ import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.databinding.FragmentHouseListBinding; import com.hdl.photovoltaic.base.CustomBaseFragment; +import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.enums.ShowErrorMode; import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlCommonLogic; @@ -140,6 +141,9 @@ viewBinding.fragmentHouseSrlListRc.setAdapter(houseInfoAdapter); + this.nullDataUpdateUi(houseListBeanIDList); + + } private void initData() { @@ -167,27 +171,28 @@ } } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) { + //todo 鐜板湪榛樿鍒锋柊鍏ㄩ儴 //uin缂栬緫浣忓畢閫氱煡 - String homeId = HdlUniLogic.getInstance().getKeyValue("homeId", eventBus.getData()); - String home_name = HdlUniLogic.getInstance().getKeyValue("powerStationName", eventBus.getData()); - if (TextUtils.isEmpty(homeId) || TextUtils.isEmpty(home_name)) { - return; - } - int index = -1; - for (int i = 0; i < houseListBeanIDList.size(); i++) { - HouseIdBean houseIdBean = houseListBeanIDList.get(i); - if (houseIdBean.getHomeId().equals(homeId)) { - index = i; - houseIdBean.setHomeName(home_name); - break; - } - } - if (index > -1) { - if (houseInfoAdapter != null) { - //鏇存柊鍗曚釜鏁版嵁 - houseInfoAdapter.notifyItemChanged(index); - } - } +// String homeId = HdlUniLogic.getInstance().getKeyValue("homeId", eventBus.getData()); +// String home_name = HdlUniLogic.getInstance().getKeyValue("powerStationName", eventBus.getData()); +// if (TextUtils.isEmpty(homeId) || TextUtils.isEmpty(home_name)) { +// return; +// } +// int index = -1; +// for (int i = 0; i < houseListBeanIDList.size(); i++) { +// HouseIdBean houseIdBean = houseListBeanIDList.get(i); +// if (houseIdBean.getHomeId().equals(homeId)) { +// index = i; +// houseIdBean.setHomeName(home_name); +// break; +// } +// } +// if (index > -1) { +// if (houseInfoAdapter != null) { +// //鏇存柊鍗曚釜鏁版嵁 +// houseInfoAdapter.notifyItemChanged(index); +// } +// } } @@ -196,6 +201,8 @@ if (MqttRecvClient.getInstance() != null) { MqttRecvClient.getInstance().removeAllTopic(); } + updateUIData(false); + } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) { //杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡 for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList().size(); i++) { @@ -207,7 +214,7 @@ } } else if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) { //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢 - if (eventBus.getType().equals(HdlCommonLogic.HomepageTitleTabSwitch.powerstation.toString())) { + if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) { HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��"); } } @@ -240,6 +247,7 @@ } } + nullDataUpdateUi(list); } }, _mActivity, ShowErrorMode.YES); @@ -310,4 +318,16 @@ } + /** + * 娌℃湁鐢电珯鍒楄〃鐨勬牱寮� + */ + private void nullDataUpdateUi(List<HouseIdBean> list) { + if (list != null && list.size() > 0) { + viewBinding.nullListTv.setVisibility(View.GONE); + } else { + viewBinding.nullListTv.setVisibility(View.VISIBLE); + } + } + + } -- Gitblit v1.8.0