From 7fdae87bc3de46b5b012f8987c6902cd8b054323 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 16 五月 2024 18:17:11 +0800 Subject: [PATCH] 2024年05月16日18:17:09 --- app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | 141 +++++++++++++++++++++++++++------------------- 1 files changed, 82 insertions(+), 59 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 b4e83d1..0fa9abd 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 @@ -34,6 +34,7 @@ import com.hdl.photovoltaic.ui.adapter.HouseInfoAdapter; import com.hdl.photovoltaic.ui.bean.DeviceBean; import com.hdl.photovoltaic.ui.bean.HouseIdBean; +import com.hdl.photovoltaic.ui.bean.StatusOverviewBean; import com.hdl.photovoltaic.uni.HDLUniMP; import com.hdl.photovoltaic.utils.PermissionUtils; import com.hdl.photovoltaic.widget.DefaultFilteringDialog; @@ -87,6 +88,9 @@ @Override public void onBindView(Bundle savedInstanceState) { + //鏀惧湪杩欓噷涔熷锛岃繖閲屽彧鏄鍒涘缓涓�娆� +// loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); +// getStatusOverview(); initData(); //鍒濆鍖� initView(); @@ -106,6 +110,8 @@ isClickPowerStationLabel = true; viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style); viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style); + viewBinding.editIv.setVisibility(View.VISIBLE);//缂栬緫鍥炬爣闅愯棌 + viewBinding.addIv.setVisibility(View.VISIBLE);//娣诲姞鍥炬爣闅愯棌 viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//鐢电珯鏍囩銆愮埗瀹瑰櫒銆戞樉绀� viewBinding.deviceLabelParent.setVisibility(View.GONE);//璁惧鏍囩銆愮埗瀹瑰櫒銆戦殣钘� loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); @@ -191,7 +197,7 @@ if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) { if (!isHouseLoadingMore) { // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔 - HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴"); + HdlLogLogic.print("---婊戝姩鍒颁簡搴曢儴"); loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, ++currentHouseListPage, false); } } @@ -202,7 +208,7 @@ @Override public void onClick(int position, HouseIdBean houseIdBean) { //鐐瑰嚮浣忓畢璇︽儏 - HdlLogLogic.print("鐐瑰嚮浣忓畢璇︽儏--->" + new Gson().toJson(houseIdBean), false); + HdlLogLogic.print("鐐瑰嚮浣忓畢璇︽儏---" + new Gson().toJson(houseIdBean), false); HdlResidenceLogic.getInstance().switchHouse(houseIdBean); String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); HdlUniLogic.getInstance().openUniMP(path, null); @@ -377,7 +383,7 @@ if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) { if (!isDeviceLoadingMore) { // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔 - HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴"); + HdlLogLogic.print("---婊戝姩鍒颁簡搴曢儴"); loadNextPageDeviceList(false, ++currentDeviceListPage, false); } } @@ -422,6 +428,8 @@ this.deviceInfoList.add(new DeviceBean()); // this.deviceInfoList.addAll(HdlDeviceLogic.getInstance().getListDevice()); } + + } /** @@ -489,9 +497,39 @@ //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢 if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) { HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��"); +// HdlThreadLogic.runSubThread(new Runnable() { +// @Override +// public void run() { loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + getStatusOverview(); +// } +// }); + } } + } + + /** + * 鐢电珯鐘舵�佹瑙� + */ + private void getStatusOverview() { + HdlResidenceLogic.getInstance().getStatusOverview(new CloudCallBeak<StatusOverviewBean>() { + @Override + public void onSuccess(StatusOverviewBean statusOverviewBean) { + if (statusOverviewBean == null) { + return; + } + viewBinding.screeningConditionNumber1Tv.setText(statusOverviewBean.getTotal()); + viewBinding.screeningConditionNumber2Tv.setText(statusOverviewBean.getFault()); + viewBinding.screeningConditionNumber3Tv.setText(statusOverviewBean.getOffline()); + viewBinding.screeningConditionNumber4Tv.setText(statusOverviewBean.getConnecting()); + } + + @Override + public void onFailure(HDLException e) { + + } + }); } @@ -511,15 +549,7 @@ * @param pageNo 椤电爜 * @param isClear 鏄惁娓呴櫎鏁版嵁 */ - private void loadNextPageHouseList(boolean isRefreshing, - String key, - String keyValue, - String installedCapacityMin, - String installedCapacityMax, - String gridType, - String powerStationStatus, - long pageNo, - boolean isClear) { + private void loadNextPageHouseList(boolean isRefreshing, String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String gridType, String powerStationStatus, long pageNo, boolean isClear) { if (isClear) { clearData(); } @@ -535,57 +565,50 @@ } //鑾峰彇浣忓畢(鐢电珯)ID鍒楄〃 - HdlResidenceLogic.getInstance().getResidenceIdList( - key, - keyValue, - installedCapacityMin, - installedCapacityMax, - gridType, - powerStationStatus, - pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() { + HdlResidenceLogic.getInstance().getResidenceIdList(key, keyValue, installedCapacityMin, installedCapacityMax, gridType, powerStationStatus, pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() { + @Override + public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) { + HdlThreadLogic.runMainThread(new Runnable() { @Override - public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) { - HdlThreadLogic.runMainThread(new Runnable() { - @Override - public void run() { - if (isRefreshing) { - hideLoading(); - } - isHouseLoadingMore = false; - if (houseBeanClass != null) { - currentHouseListTotal = (int) houseBeanClass.getTotalPage(); - currentHouseListPage = (int) houseBeanClass.getPageNo(); - //鏇存柊缂撳瓨 - HdlResidenceLogic.getInstance().setHouseIdList(houseBeanClass.getList()); - if (houseInfoAdapter != null) { - initData(); - //鏇存柊UI - houseInfoAdapter.setList(houseListBeanIDList); - } - } - nullDataUpdateUi(); + public void run() { + if (isRefreshing) { + hideLoading(); + } + isHouseLoadingMore = false; + if (houseBeanClass != null) { + currentHouseListTotal = (int) houseBeanClass.getTotalPage(); + currentHouseListPage = (int) houseBeanClass.getPageNo(); + //鏇存柊缂撳瓨 + HdlResidenceLogic.getInstance().setHouseIdList(houseBeanClass.getList()); + if (houseInfoAdapter != null) { + initData(); + //鏇存柊UI + houseInfoAdapter.setList(houseListBeanIDList); } - }, _mActivity, ShowErrorMode.YES); + } + nullDataUpdateUi(); + } + }, _mActivity, ShowErrorMode.YES); + + } + + @Override + public void onFailure(HDLException e) { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + if (currentHouseListPage > 1) { + --currentHouseListPage; + } + isHouseLoadingMore = false; + if (isRefreshing) { + hideLoading(); + } } - - @Override - public void onFailure(HDLException e) { - HdlThreadLogic.runMainThread(new Runnable() { - @Override - public void run() { - if (currentHouseListPage > 1) { - --currentHouseListPage; - } - isHouseLoadingMore = false; - if (isRefreshing) { - hideLoading(); - } - - } - }, _mActivity, ShowErrorMode.YES); - } - }); + }, _mActivity, ShowErrorMode.YES); + } + }); } /** -- Gitblit v1.8.0