From 7807eab462ad7c008ebe93af151f5520fdb3159a Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 15 十月 2024 10:51:59 +0800
Subject: [PATCH] 2024年10月15日10:51:57
---
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 81 +++++++++++++++++++++++-----------------
1 files changed, 46 insertions(+), 35 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
index 3c5872b..e1ab804 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -18,7 +18,6 @@
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;
@@ -94,7 +93,7 @@
/**
* 杩樺師鏉′欢鐨勫垵濮嬪寲鐘舵��
*/
- private void InitializationState() {
+ private void initializationState() {
key = SortValue.all;
value = SortValue.all;
installedCapacityMinValue = "";
@@ -130,7 +129,7 @@
}
isClickPowerStationLabel = true;
selectedTitleLabelStyle();
- InitializationState();
+ initializationState();
getStatusOverview();
loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
@@ -516,7 +515,6 @@
viewBinding.fragmentDeviceSrlListRc.setAdapter(deviceInfoAdapter);
this.nullDataUpdateUi();
-
}
/**
@@ -526,7 +524,7 @@
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);//璁惧鏍囩銆愮埗瀹瑰櫒銆戦殣钘�
@@ -536,7 +534,7 @@
} 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);//璁惧鏍囩銆愮埗瀹瑰櫒銆戞樉绀�
@@ -647,10 +645,10 @@
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())) {
@@ -659,19 +657,28 @@
// 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();
//瀛楃涓叉槸鑷繁鎸夎鍒欐嫾鎺ョ殑,閲岄潰娉ㄥ唽涓婚鏃朵細瑙f瀽瀛楃涓�,鍙嬁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("姝e湪鐐瑰嚮銆愮數绔欍��");
// if (!isReadData) {
// //1锛屼粠棣栭〉-鏁呴殰-杩涙潵-鐢电珯锛堜笉璇诲彇锛�
@@ -679,27 +686,31 @@
// 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);
--
Gitblit v1.8.0