| | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.bean.PageNumberObject; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.FragmentHouseListBinding; |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; |
| | |
| | | /** |
| | | * 还原条件的初始化状态 |
| | | */ |
| | | private void InitializationState() { |
| | | private void initializationState() { |
| | | key = SortValue.all; |
| | | value = SortValue.all; |
| | | installedCapacityMinValue = ""; |
| | |
| | | } |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | InitializationState(); |
| | | initializationState(); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | |
| | |
| | | public void onClick(int position, HouseIdBean houseIdBean) { |
| | | //点击住宅详情 |
| | | HdlLogLogic.print("点击住宅详情---" + new Gson().toJson(houseIdBean), false); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean,true); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | |
| | |
| | | viewBinding.fragmentDeviceSrlListRc.setAdapter(deviceInfoAdapter); |
| | | this.nullDataUpdateUi(); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | if (isClickPowerStationLabel) { |
| | | viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style); |
| | | viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style); |
| | | viewBinding.editIv.setVisibility(View.VISIBLE);//编辑图标隐藏 |
| | | // viewBinding.editIv.setVisibility(View.VISIBLE);//编辑图标隐藏 |
| | | viewBinding.addIv.setVisibility(View.VISIBLE);//添加图标隐藏 |
| | | viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示 |
| | | viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏 |
| | |
| | | } else { |
| | | viewBinding.deviceLabel.setTextAppearance(R.style.Text20Style); |
| | | viewBinding.powerStationLabel.setTextAppearance(R.style.Text16Style); |
| | | viewBinding.editIv.setVisibility(View.GONE);//编辑图标隐藏 |
| | | // viewBinding.editIv.setVisibility(View.GONE);//编辑图标隐藏 |
| | | viewBinding.addIv.setVisibility(View.GONE);//添加图标隐藏 |
| | | viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏 |
| | | viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示 |
| | |
| | | Gson gson = new Gson(); |
| | | String json = eventBus.getData().toString(); |
| | | HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean,true); |
| | | |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) { |
| | |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | //是在(电站)模块且在(电站)标签页才进来这里 |
| | | if (HdlCommonLogic.lowerTagType == LowerTagType.power_station && isClickPowerStationLabel) { |
| | | //uin关闭住宅详情界面通知 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().removeAllTopic(); |
| | | } |
| | | // //uin关闭住宅详情界面通知 |
| | | // if (MqttRecvClient.getInstance() != null) { |
| | | // MqttRecvClient.getInstance().removeAllTopic(); |
| | | // } |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) { |
| | |
| | | // if (!isClickPowerStationLabel) { |
| | | // return; |
| | | // } |
| | | //先清空订阅主题 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().removeAllTopic(); |
| | | } |
| | | String homeId = eventBus.getData().toString(); |
| | | //进去住宅详情uni读取逆变器列表成功后通知 |
| | | for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).size(); i++) { |
| | | String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).get(i).getGatewayId(); |
| | | for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) { |
| | | String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId(); |
| | | //字符串是自己按规则拼接的,里面注册主题时会解析字符串,只拿getGatewayId()值; |
| | | String topic = "/user/" + gatewayId + "/#"; |
| | | //进去住宅详情开始订阅主题 |
| | | MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topic); |
| | | MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topic);//订阅【逆变器】消息 |
| | | } |
| | | String topicHome = "/user/" + homeId + "/#"; |
| | | MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topicHome);//订阅【电站】消息 |
| | | |
| | | |
| | | } else if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) { |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | //接收外部点击事件 |
| | | if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) { |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | HdlLogLogic.print("正在点击【电站】"); |
| | | // if (!isReadData) { |
| | | // //1,从首页-故障-进来-电站(不读取) |
| | |
| | | // loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | // getStatusOverview(); |
| | | // } |
| | | //2024年06月24日14:34:01 产品经理要求进去电站列表都要读取 |
| | | InitializationState(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | //2024年06月24日14:34:01 产品经理要求进去电站列表都要读取 且默认进去都是默认电站标签 |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | initializationState(); |
| | | getStatusOverview(); |
| | | |
| | | } else if (eventBus.getType().equals(PowerStationStatus.All)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationAllIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationFaultsIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.off)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationOfflineIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.connecting)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationConnectedIl.parentLl.performClick(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | } else if (eventBus.getType().equals(ConstantManage.station_page)) { |
| | | //通过首页电站进来的 |
| | | if (eventBus.getData().equals(PowerStationStatus.All)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationAllIl.parentLl.performClick(); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.malfunction)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationFaultsIl.parentLl.performClick(); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.off)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationOfflineIl.parentLl.performClick(); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.connecting)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationConnectedIl.parentLl.performClick(); |
| | | } |
| | | } else if (eventBus.getType().equals(ConstantManage.station_edit)) { |
| | | //编辑后更新一下住宅列表 |
| | | //loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |