From 4f12f1e3543fce41e71ae9e21a782f8d9cb41947 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 07 七月 2025 10:45:11 +0800 Subject: [PATCH] Merge branch '1.3.1' into dev --- app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 75 +++++++++++++++++++++++-------------- 1 files changed, 47 insertions(+), 28 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 2e32f2d..4156922 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 @@ -1,16 +1,19 @@ package com.hdl.photovoltaic.ui.powerstation; import android.Manifest; +import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; +import android.os.SystemClock; import android.provider.Settings; import android.text.TextUtils; -import android.util.Log; import android.view.View; +import android.view.Window; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; @@ -19,8 +22,6 @@ import androidx.annotation.NonNull; import androidx.appcompat.content.res.AppCompatResources; import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.google.gson.Gson; import com.hdl.linkpm.sdk.core.exception.HDLException; @@ -45,6 +46,7 @@ import com.hdl.photovoltaic.other.HdlDeviceLogic; import com.hdl.photovoltaic.other.HdlDialogLogic; import com.hdl.photovoltaic.other.HdlLogLogic; +import com.hdl.photovoltaic.other.HdlOtaLogic; import com.hdl.photovoltaic.other.HdlResidenceLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; import com.hdl.photovoltaic.other.HdlUniLogic; @@ -56,6 +58,7 @@ import com.hdl.photovoltaic.uni.HDLUniMP; import com.hdl.photovoltaic.utils.GPSManagerUtils; import com.hdl.photovoltaic.utils.PermissionUtils; +import com.hdl.photovoltaic.utils.ProcessManagerUtils; import com.hdl.photovoltaic.utils.URLEncodingUtils; import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; import com.hdl.photovoltaic.widget.DefaultFilteringDialog; @@ -255,7 +258,6 @@ installedCapacityMinValue = min;//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺) installedCapacityMaxValue = max;//鏈�澶х粍涓插閲�(瑁呮満瀹归噺) screeningConditionStatus = state;//璋冭瘯鐘舵��(鍏ㄩ儴;璋冭瘯涓�;璋冭瘯瀹屾垚;宸蹭氦浠�;鎺堟潈璋冭瘯) - getStatusOverview(); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); @@ -358,7 +360,14 @@ } }); - //PV绛涢�� +// //鐢电珯缂栬緫鎸夐挳 +// viewBinding.editIv.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// startActivity(HouseListEditActivity.class); +// } +// }); + //鐢电珯鍚嶇О绛涢�� viewBinding.stationNameRl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -366,11 +375,10 @@ screeningConditionStyle(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected); key = SortType.installedCapacitySort; value = isSelected ? SortValue.ascending : SortValue.descending; - getStatusOverview(); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); - //棰濆畾鍔熺巼绛涢�� + //鐢电珯鍙戠數鍔熺巼绛涢�� viewBinding.stationPowerRl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -402,7 +410,17 @@ screeningConditionStyle(viewBinding.stationDayRl, viewBinding.stationDayIv, isSelected); key = SortType.todayElectricitySort; value = isSelected ? SortValue.ascending : SortValue.descending; - getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); + } + }); + //鐢电珯鐢垫睜瀹归噺绛涢�� + viewBinding.stationMonthRl.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + boolean isSelected = !v.isSelected(); + screenIconState(viewBinding.stationMonthRl, viewBinding.stationMonthIv, isSelected); + key = SortType.batteryCapacitySort; + value = isSelected ? SortValue.ascending : SortValue.descending; loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); @@ -445,7 +463,7 @@ } if (TextUtils.isEmpty(newGatewayBean.getGatewayId()) || TextUtils.isEmpty(newGatewayBean.getAesKey())) { //杩欓噷鍙敮鎸佽繙绋嬭皟璇曪紝杩滅▼鎷夸笉鍒癿qtt閫氳绉橀挜浠ュ強gatewayId锛� - HdlThreadLogic.toast(_mActivity, getString(R.string.Device_failed_to_certificate) + "(124004)"); + HdlThreadLogic.toast(_mActivity, getString(R.string.device_failed_to_certificate) + "(124004)"); return; } String jsonEncryption = URLEncodingUtils.encodeURIComponent(new Gson().toJson(newGatewayBean)); @@ -592,15 +610,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); @@ -637,7 +658,6 @@ // if (MqttRecvClient.getInstance() != null) { // MqttRecvClient.getInstance().removeAllTopic(); // } - loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) { @@ -652,8 +672,8 @@ } String homeId = eventBus.getData().toString(); //杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡 - for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).size(); i++) { - String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).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 + "/#"; //杩涘幓浣忓畢璇︽儏寮�濮嬭闃呬富棰� @@ -811,7 +831,7 @@ if (isRefreshing) { hideLoading(); } - HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")"); + } }, _mActivity, ShowErrorMode.YES); } @@ -880,7 +900,6 @@ if (isRefreshing) { hideLoading(); } - HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")"); } }, _mActivity, ShowErrorMode.YES); } @@ -969,7 +988,7 @@ @Override public void onSuccess(Boolean obj) { hideLoading(); - initializeInverter(list); //鍙戣捣鍒濆鍖栨寚浠ょ粰閫嗗彉鍣�;锛堟敞鎰�:鍙兘鏄湰鍦板彂閫佷簡(瑕佹悳绱㈠眬鍩熺綉閫嗗彉鍣ㄥ垪琛紝寤虹珛鏈湴閫氳閫氶亾),鍒犻櫎鐢电珯鎴愬姛鍚�,浜戠瑙g粦閫嗗彉鍣ㄧ殑鍏崇郴锛� + initializeInverter(list); //鍙戣捣鍒濆鍖栨寚浠ょ粰閫嗗彉鍣�;锛堟敞鎰�:鍓嶉潰宸插厛瑙g粦浜戠閫嗗彉鍣紝mqtt閫氶亾宸叉柇寮�锛屽垵濮嬪寲鍙兘鏄湰鍦板彂閫�(鍏堟悳绱㈠眬鍩熺綉閫嗗彉鍣ㄥ垪琛紝寤虹珛鏈湴閫氳閫氶亾)锛� HdlResidenceLogic.getInstance().delHouseId(homeId);//鍒犻櫎鐢电珯缂撳瓨 initData();//鍒濆鍖栫紦瀛樻暟鎹� houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//閲嶆柊鍒锋柊鍒楄〃 @@ -1013,8 +1032,8 @@ public void requestPermissions(OnCallBeak onCallBeak) { - //ACCESS_FINE_LOCATION 鍏佽浣跨敤GPS瀹氫綅 - //ACCESS_COARSE_LOCATION 鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣� + //ACCESS_FINE_LOCATION 鍏佽浣跨敤GPS瀹氫綅 + //ACCESS_COARSE_LOCATION 鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣� String[] ary = PermissionUtils.checkPermission(_mActivity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}); if (ary.length > 0) { this.requestPermissions(ary, PermissionUtils.STATUS_SUCCESS); @@ -1090,7 +1109,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(); @@ -1153,7 +1172,7 @@ @Override protected void onPostExecute(Void aVoid) { viewBinding.fragmentDeviceSrl.endRefreshing(); - loadNextPageDeviceList(true, 1, true); + loadNextPageDeviceList(false, 1, true); } }.execute(); } -- Gitblit v1.8.0