wjc
2025-04-07 2661d1c7b0a4d77e59f828825246e3e8e3594aa6
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -1,13 +1,18 @@
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;
@@ -40,6 +45,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;
@@ -51,6 +57,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;
@@ -167,12 +174,6 @@
                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));
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
            }
        });
@@ -185,12 +186,6 @@
                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));
                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);
            }
        });
@@ -203,12 +198,6 @@
                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));
                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);
            }
        });
@@ -221,11 +210,6 @@
                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));
                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);
            }
        });
@@ -267,7 +251,6 @@
                        installedCapacityMinValue = min;//最小组串容量(装机容量)
                        installedCapacityMaxValue = max;//最大组串容量(装机容量)
                        screeningConditionStatus = state;//调试状态(全部;调试中;调试完成;已交付;授权调试)
                        getStatusOverview();
                        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                    }
                });
@@ -404,39 +387,32 @@
            }
        });
        //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) {
                boolean isSelected = !v.isSelected();
                screenIconState(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected);
                key = SortType.installedCapacitySort;
                key = SortType.homeNameSort;
                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) {
                boolean isSelected = !v.isSelected();
                screenIconState(viewBinding.stationPowerRl, viewBinding.stationPowerIv, isSelected);
                key = SortType.invPowerSort;
                key = SortType.powerSort;
                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;
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
            }
        });
@@ -448,7 +424,17 @@
                screenIconState(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);
            }
        });
@@ -567,11 +553,6 @@
        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));
@@ -684,7 +665,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())) {
@@ -765,7 +745,7 @@
     * 电站状态概览
     */
    private void getStatusOverview() {
        HdlResidenceLogic.getInstance().getStatusOverview(screeningConditionStatus,installedCapacityMinValue,installedCapacityMaxValue,new CloudCallBeak<StatusOverviewBean>() {
        HdlResidenceLogic.getInstance().getStatusOverview(new CloudCallBeak<StatusOverviewBean>() {
            @Override
            public void onSuccess(StatusOverviewBean statusOverviewBean) {
                if (statusOverviewBean == null) {
@@ -858,7 +838,7 @@
                        if (isRefreshing) {
                            hideLoading();
                        }
                        HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")");
                    }
                }, _mActivity, ShowErrorMode.YES);
            }
@@ -927,7 +907,6 @@
                        if (isRefreshing) {
                            hideLoading();
                        }
                        HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")");
                    }
                }, _mActivity, ShowErrorMode.YES);
            }
@@ -1060,8 +1039,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);
@@ -1111,4 +1090,4 @@
        }
    }
}
}