From 6f4e4bc481ca1ef264e6a3795033a31d3e709f77 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 07 四月 2025 20:22:20 +0800 Subject: [PATCH] 2025-04-07 20:22:08 加载效果 --- app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 123 ++++++++++++++++++++++++---------------- 1 files changed, 73 insertions(+), 50 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 f4a5ad6..ac38b08 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,18 +1,13 @@ 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.Bundle; -import android.os.SystemClock; import android.provider.Settings; -import android.util.Log; import android.view.View; -import android.view.Window; import android.widget.ImageView; import android.widget.RelativeLayout; @@ -31,6 +26,7 @@ import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.databinding.FragmentHouseListBinding; import com.hdl.photovoltaic.base.CustomBaseFragment; +import com.hdl.photovoltaic.enums.DebugStatus; import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.enums.LowerTagType; import com.hdl.photovoltaic.enums.PowerStationStatus; @@ -44,7 +40,6 @@ 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,7 +51,6 @@ 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; @@ -102,7 +96,7 @@ private String value = SortValue.all;//descending:闄嶅簭,ascending:鍗囧簭 private String installedCapacityMinValue = "";//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺) private String installedCapacityMaxValue = "";//鏈�澶х粍涓插閲�(瑁呮満瀹归噺) - private String gridTypeValue = "";//骞剁綉鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,FULL_GRID:骞剁綉,OFFLINE:绂荤綉) + private String screeningConditionStatus = DebugStatus.All;//绛涢�夋潯浠剁姸鎬� private String powerStationStatusValue = PowerStationStatus.All;//鐢电珯鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,1:姝e父(杩愯),2:绂荤嚎,3:寰呮帴鍏�,4:鏁呴殰) private final long pageSize = 20;//椤垫暟 @@ -115,7 +109,7 @@ value = SortValue.all; installedCapacityMinValue = ""; installedCapacityMaxValue = ""; - gridTypeValue = ""; + screeningConditionStatus = DebugStatus.All; powerStationStatusValue = PowerStationStatus.All; } @@ -148,7 +142,7 @@ selectedTitleLabelStyle(); initializationState(); getStatusOverview(); - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); @@ -173,7 +167,13 @@ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + + viewBinding.allDesTv.setTextColor(getResources().getColor(R.color.text_FFACACAC)); + viewBinding.faultsDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.offlineDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.connectedDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); //鏁呴殰 @@ -185,7 +185,13 @@ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff)); viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + + viewBinding.allDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.faultsDesTv.setTextColor(getResources().getColor(R.color.text_FFACACAC)); + viewBinding.offlineDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.connectedDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); //绂荤嚎 @@ -197,7 +203,13 @@ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff)); viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + + viewBinding.allDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.faultsDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.offlineDesTv.setTextColor(getResources().getColor(R.color.text_FFACACAC)); + viewBinding.connectedDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); //寰呮帴鍏� @@ -209,7 +221,12 @@ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff)); - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + viewBinding.allDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.faultsDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.offlineDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.connectedDesTv.setTextColor(getResources().getColor(R.color.text_FFACACAC)); + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); @@ -243,14 +260,15 @@ public void onClick(View v) { DefaultFilteringDialog defaultFilteringDialog = new DefaultFilteringDialog(_mActivity); defaultFilteringDialog.show(); - defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue); + defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus); defaultFilteringDialog.setOnClickListener(new DefaultFilteringDialog.OnClickListener() { @Override public void confirm(String min, String max, String state) { installedCapacityMinValue = min;//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺) installedCapacityMaxValue = max;//鏈�澶х粍涓插閲�(瑁呮満瀹归噺) - gridTypeValue = state;//骞剁綉鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,FULL_GRID:骞剁綉,OFFLINE:绂荤綉) - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + screeningConditionStatus = state;//璋冭瘯鐘舵��(鍏ㄩ儴;璋冭瘯涓�;璋冭瘯瀹屾垚;宸蹭氦浠�;鎺堟潈璋冭瘯) + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); } @@ -263,7 +281,7 @@ @Override public void onRefresh() { viewBinding.fragmentHouseSrl.setRefreshing(false); - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); getStatusOverview(); } }); @@ -284,7 +302,7 @@ if (!isHouseLoadingMore) { // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔 HdlLogLogic.print("---婊戝姩鍒颁簡搴曢儴"); - loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, ++currentHouseListPage, false); + loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, ++currentHouseListPage, false); } } } @@ -386,33 +404,40 @@ } }); - //鐢电珯缂栬緫鎸夐挳 - viewBinding.editIv.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivity(HouseListEditActivity.class); - } - }); - //鐢电珯鍚嶇О绛涢�� + //PV绛涢�� viewBinding.stationNameRl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean isSelected = !v.isSelected(); screenIconState(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected); - key = SortType.homeNameSort; + key = SortType.installedCapacitySort; value = isSelected ? SortValue.ascending : SortValue.descending; - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); - //鐢电珯鍙戠數鍔熺巼绛涢�� + //棰濆畾鍔熺巼绛涢�� viewBinding.stationPowerRl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean isSelected = !v.isSelected(); screenIconState(viewBinding.stationPowerRl, viewBinding.stationPowerIv, isSelected); - key = SortType.powerSort; + key = SortType.invPowerSort; value = isSelected ? SortValue.ascending : SortValue.descending; - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + 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; + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); //鐢电珯褰撴棩鍙戠數閲忕瓫閫� @@ -423,18 +448,8 @@ screenIconState(viewBinding.stationDayRl, viewBinding.stationDayIv, isSelected); key = SortType.todayElectricitySort; value = isSelected ? SortValue.ascending : SortValue.descending; - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, 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.monthElectricitySort; - value = isSelected ? SortValue.ascending : SortValue.descending; - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + getStatusOverview(); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } }); //璁惧鐐瑰嚮 @@ -552,6 +567,11 @@ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); + + viewBinding.allDesTv.setTextColor(getResources().getColor(R.color.text_FFACACAC)); + viewBinding.faultsDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.offlineDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); + viewBinding.connectedDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); //鐢电珯鏍囩 houseInfoAdapter = new HouseInfoAdapter(_mActivity); viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity)); @@ -620,7 +640,7 @@ // 鍙栨秷绮樻�т簨浠� EventBus.getDefault().removeStickyEvent(eventBus); //uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡 - loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); if (eventBus.getData() != null) { Gson gson = new Gson(); String json = eventBus.getData().toString(); @@ -664,7 +684,8 @@ // if (MqttRecvClient.getInstance() != null) { // MqttRecvClient.getInstance().removeAllTopic(); // } - loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + + loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) { // 鍙栨秷绮樻�т簨浠� @@ -706,7 +727,7 @@ selectedTitleLabelStyle(); initializationState(); getStatusOverview(); - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); } else if (eventBus.getType().equals(ConstantManage.station_page)) { //閫氳繃棣栭〉鐢电珯杩涙潵鐨� if (eventBus.getData().equals(PowerStationStatus.All)) { @@ -744,7 +765,7 @@ * 鐢电珯鐘舵�佹瑙� */ private void getStatusOverview() { - HdlResidenceLogic.getInstance().getStatusOverview(new CloudCallBeak<StatusOverviewBean>() { + HdlResidenceLogic.getInstance().getStatusOverview(screeningConditionStatus,installedCapacityMinValue,installedCapacityMaxValue,new CloudCallBeak<StatusOverviewBean>() { @Override public void onSuccess(StatusOverviewBean statusOverviewBean) { if (statusOverviewBean == null) { @@ -771,11 +792,12 @@ * @param key 鍙戠數鍔熺巼鎺掑簭(powerSort); * 浠婃棩鍙戠數閲忔帓搴�(todayElectricitySort); * 鍒涘缓鏃堕棿鎺掑簭(createTimeSort); + * 鐢垫睜瀹归噺鎺掑簭(batteryCapacitySort); * @param keyValue (descending:闄嶅簭 * ascending:鍗囧簭), * @param installedCapacityMin 鏈�灏忕粍涓插閲�(瑁呮満瀹归噺) * @param installedCapacityMax 鏈�澶х粍涓插閲�(瑁呮満瀹归噺) - * @param gridType 骞剁綉鐘舵�� (鍏ㄩ儴 锛�"";FULL_GRID 锛� 骞剁綉;OFFLINE 锛氱缃�) + * @param gridType 璋冭瘯鐘舵��(鍏ㄩ儴;璋冭瘯涓�;璋冭瘯瀹屾垚;宸蹭氦浠�;鎺堟潈璋冭瘯) * @param powerStationStatus 鐢电珯鐘舵�� (鍏ㄩ儴 锛�"";1 锛� 姝e父;2 锛� 绂荤嚎; 3 锛� 寰呮帴鍏�;4 锛� 鏁呴殰) * @param pageNo 椤电爜 * @param isClear 鏄惁娓呴櫎鏁版嵁 @@ -836,7 +858,7 @@ if (isRefreshing) { hideLoading(); } - + HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")"); } }, _mActivity, ShowErrorMode.YES); } @@ -905,6 +927,7 @@ if (isRefreshing) { hideLoading(); } + HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")"); } }, _mActivity, ShowErrorMode.YES); } -- Gitblit v1.8.0