From 80f2ca2df62ff1cd03046864af504245be078eb2 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 05 六月 2025 10:37:28 +0800 Subject: [PATCH] 2025年06月05日10:37:26 --- app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 73 ++++++++++++++++++++++-------------- 1 files changed, 44 insertions(+), 29 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 f1fe445..f449908 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 @@ -8,6 +8,8 @@ import android.os.AsyncTask; import android.os.Bundle; import android.provider.Settings; +import android.text.TextUtils; +import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; @@ -126,7 +128,7 @@ @Override public void onBindView(Bundle savedInstanceState) { - getStatusOverview(); +// getStatusOverview(); initData(); //鍒濆鍖� initView(); @@ -171,7 +173,7 @@ return; } powerStationStatusValue = PowerStationStatus.All; - stationStatusStyle(viewBinding.allLl,viewBinding.allDesTv); + stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); getStatusOverview(); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } @@ -184,7 +186,7 @@ return; } powerStationStatusValue = PowerStationStatus.malfunction; - stationStatusStyle(viewBinding.faultsLl,viewBinding.faultsDesTv); + stationStatusStyle(viewBinding.faultsLl, viewBinding.faultsDesTv); getStatusOverview(); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } @@ -197,7 +199,7 @@ return; } powerStationStatusValue = PowerStationStatus.off; - stationStatusStyle(viewBinding.offlineLl,viewBinding.offlineDesTv); + stationStatusStyle(viewBinding.offlineLl, viewBinding.offlineDesTv); getStatusOverview(); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } @@ -210,7 +212,7 @@ return; } powerStationStatusValue = PowerStationStatus.connecting; - stationStatusStyle(viewBinding.connectedLl,viewBinding.connectedDesTv); + stationStatusStyle(viewBinding.connectedLl, viewBinding.connectedDesTv); getStatusOverview(); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } @@ -435,7 +437,17 @@ HdlDeviceLogic.getInstance().setDeviceRemoteInfo(newList, deviceBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() { @Override public void onSuccess(List<GatewayBean> obj) { + GatewayBean newGatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(deviceBean.getOsn()); + if (newGatewayBean == null) { + HdlThreadLogic.toast(_mActivity, getString(R.string.device_off)); + return; + } + if (TextUtils.isEmpty(newGatewayBean.getGatewayId()) || TextUtils.isEmpty(newGatewayBean.getAesKey())) { + //杩欓噷鍙敮鎸佽繙绋嬭皟璇曪紝杩滅▼鎷夸笉鍒癿qtt閫氳绉橀挜浠ュ強gatewayId锛� + HdlThreadLogic.toast(_mActivity, getString(R.string.Device_failed_to_certificate) + "(124004)"); + return; + } String jsonEncryption = URLEncodingUtils.encodeURIComponent(new Gson().toJson(newGatewayBean)); String path = HDLUniMP.UNI_EVENT_OPEN_DEVICE_DETAILS + "?inverterInfo=" + jsonEncryption; HdlUniLogic.getInstance().openUniMP(path, null); @@ -507,7 +519,7 @@ viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE); viewBinding.deviceLabelParent.setVisibility(View.GONE); - stationStatusStyle(viewBinding.allLl,viewBinding.allDesTv); + stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); //鐢电珯鏍囩 houseInfoAdapter = new HouseInfoAdapter(_mActivity); viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity)); @@ -580,15 +592,18 @@ if (HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION.equals(eventBus.getType())) { // 鍙栨秷绮樻�т簨浠� EventBus.getDefault().removeStickyEvent(eventBus); - //uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡 - loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); - if (eventBus.getData() != null) { - Gson gson = new Gson(); - String json = eventBus.getData().toString(); - HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class); - HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true); - - } +// HdlLogLogic.print("杩涙潵浜�---11111" + eventBus.getData().toString()); +// //uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡 +// loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); +// if (eventBus.getData() != null) { +// HdlLogLogic.print("杩涙潵浜�---" + eventBus.getData().toString()); +// Gson gson = new Gson(); +// String json = eventBus.getData().toString(); +// HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class); +// HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true); +// HdlLogLogic.print("杩涙潵浜�---缁撴潫" + eventBus.getData().toString()); +// +// } } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) { // 鍙栨秷绮樻�т簨浠� EventBus.getDefault().removeStickyEvent(eventBus); @@ -667,27 +682,27 @@ isClickPowerStationLabel = true; selectedTitleLabelStyle(); initializationState(); + stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); getStatusOverview(); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } else if (eventBus.getType().equals(ConstantManage.station_page)) { + // 鍙栨秷绮樻�т簨浠� + EventBus.getDefault().removeStickyEvent(eventBus); + isClickPowerStationLabel = true; + selectedTitleLabelStyle(); + powerStationStatusValue = eventBus.getData() == null ? "" : eventBus.getData().toString(); //閫氳繃棣栭〉鐢电珯杩涙潵鐨� if (eventBus.getData().equals(PowerStationStatus.All)) { - isClickPowerStationLabel = true; - selectedTitleLabelStyle(); - viewBinding.allLl.performClick(); + stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); } else if (eventBus.getData().equals(PowerStationStatus.malfunction)) { - isClickPowerStationLabel = true; - selectedTitleLabelStyle(); - viewBinding.faultsLl.performClick(); + stationStatusStyle(viewBinding.faultsLl, viewBinding.faultsDesTv); } else if (eventBus.getData().equals(PowerStationStatus.off)) { - isClickPowerStationLabel = true; - selectedTitleLabelStyle(); - viewBinding.offlineLl.performClick(); + stationStatusStyle(viewBinding.offlineLl, viewBinding.offlineDesTv); } else if (eventBus.getData().equals(PowerStationStatus.connecting)) { - isClickPowerStationLabel = true; - selectedTitleLabelStyle(); - viewBinding.connectedLl.performClick(); + stationStatusStyle(viewBinding.connectedLl, viewBinding.connectedDesTv); } + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } else if (eventBus.getType().equals(ConstantManage.station_edit)) { //缂栬緫鍚庢洿鏂颁竴涓嬩綇瀹呭垪琛� //loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); @@ -1078,7 +1093,7 @@ // 鎵ц浠诲姟锛堝鏇存柊UI銆佽烦杞瓑锛� viewBinding.fragmentHouseSrl.endRefreshing(); //鍔犺浇鏈�鏂版暟鎹畬鎴� - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); + loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); getStatusOverview(); } }.execute(); @@ -1141,7 +1156,7 @@ @Override protected void onPostExecute(Void aVoid) { viewBinding.fragmentDeviceSrl.endRefreshing(); - loadNextPageDeviceList(true, 1, true); + loadNextPageDeviceList(false, 1, true); } }.execute(); } -- Gitblit v1.8.0