| | |
| | | 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.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.view.Window; |
| | | import android.widget.ImageView; |
| | | import android.widget.RelativeLayout; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.bean.PageNumberObject; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | 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; |
| | |
| | | import com.hdl.photovoltaic.enums.SortValue; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.listener.LinkCallBack; |
| | | import com.hdl.photovoltaic.listener.OnCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | 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; |
| | |
| | | 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.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; |
| | | import com.hdl.photovoltaic.widget.DelayedConfirmationCancelDialog; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkException; |
| | |
| | | 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:正常(运行),2:离线,3:待接入,4:故障) |
| | | |
| | | private final long pageSize = 20;//页数 |
| | |
| | | /** |
| | | * 还原条件的初始化状态 |
| | | */ |
| | | private void InitializationState() { |
| | | private void initializationState() { |
| | | key = SortValue.all; |
| | | value = SortValue.all; |
| | | installedCapacityMinValue = ""; |
| | | installedCapacityMaxValue = ""; |
| | | gridTypeValue = ""; |
| | | screeningConditionStatus = DebugStatus.All; |
| | | powerStationStatusValue = PowerStationStatus.All; |
| | | } |
| | | |
| | |
| | | } |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | InitializationState(); |
| | | initializationState(); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | |
| | | } |
| | | }); |
| | |
| | | } |
| | | }); |
| | | //全部 |
| | | viewBinding.powerStationAllIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.allLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | powerStationStatusValue = PowerStationStatus.All; |
| | | selectedStationStateStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff)); |
| | | 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, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //故障 |
| | | viewBinding.powerStationFaultsIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.faultsLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | powerStationStatusValue = PowerStationStatus.malfunction; |
| | | selectedStationStateStyle(viewBinding.powerStationFaultsIl.parentLl, viewBinding.powerStationFaultsIl.stationTotalTv, viewBinding.powerStationFaultsIl.stationTitleTv, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); |
| | | 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, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //离线 |
| | | viewBinding.powerStationOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.offlineLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | powerStationStatusValue = PowerStationStatus.off; |
| | | selectedStationStateStyle(viewBinding.powerStationOfflineIl.parentLl, viewBinding.powerStationOfflineIl.stationTotalTv, viewBinding.powerStationOfflineIl.stationTitleTv, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); |
| | | 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, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //待接入 |
| | | viewBinding.powerStationConnectedIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.connectedLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | powerStationStatusValue = PowerStationStatus.connecting; |
| | | selectedStationStateStyle(viewBinding.powerStationConnectedIl.parentLl, viewBinding.powerStationConnectedIl.stationTotalTv, viewBinding.powerStationConnectedIl.stationTitleTv, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); |
| | | 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, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | |
| | |
| | | viewBinding.addIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | |
| | | requestPermissions(new OnCallBeak() { |
| | | @Override |
| | | public void onClickCallBeak() { |
| | | // UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | // HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | |
| | | 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;//调试状态(全部;调试中;调试完成;已交付;授权调试) |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | } |
| | |
| | | @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(); |
| | | } |
| | | }); |
| | |
| | | if (!isHouseLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | HdlLogLogic.print("---滑动到了底部"); |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, ++currentHouseListPage, false); |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, ++currentHouseListPage, false); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public void onClick(int position, HouseIdBean houseIdBean) { |
| | | //点击住宅详情 |
| | | HdlLogLogic.print("点击住宅详情---" + new Gson().toJson(houseIdBean), false); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(0); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | |
| | | HdlLogLogic.print("点击住宅详情---" + new Gson().toJson(houseIdBean), false); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | } |
| | | }); |
| | | //电站编辑按钮 |
| | | viewBinding.editIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | startActivity(HouseListEditActivity.class); |
| | | } |
| | | }); |
| | | // //电站编辑按钮 |
| | | // 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(); |
| | | viewBinding.stationNameRl.setSelected(isSelected); |
| | | viewBinding.stationNameIv.setSelected(isSelected); |
| | | screenIconState(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected); |
| | | key = SortType.homeNameSort; |
| | | value = isSelected ? SortValue.ascending : SortValue.descending; |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //电站发电功率筛选 |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | boolean isSelected = !v.isSelected(); |
| | | viewBinding.stationPowerRl.setSelected(isSelected); |
| | | viewBinding.stationPowerIv.setSelected(isSelected); |
| | | screenIconState(viewBinding.stationPowerRl, viewBinding.stationPowerIv, isSelected); |
| | | key = SortType.powerSort; |
| | | value = isSelected ? SortValue.ascending : SortValue.descending; |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //电站当日发电量筛选 |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | boolean isSelected = !v.isSelected(); |
| | | viewBinding.stationDayRl.setSelected(isSelected); |
| | | viewBinding.stationDayIv.setSelected(isSelected); |
| | | 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); |
| | | 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(); |
| | | viewBinding.stationMonthRl.setSelected(isSelected); |
| | | viewBinding.stationMonthIv.setSelected(isSelected); |
| | | key = SortType.monthElectricitySort; |
| | | screenIconState(viewBinding.stationMonthRl, viewBinding.stationMonthIv, isSelected); |
| | | key = SortType.batteryCapacitySort; |
| | | value = isSelected ? SortValue.ascending : SortValue.descending; |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //设备点击 |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 更新筛选条件状态 |
| | | * |
| | | * @param relativeLayout 组件名称 |
| | | * @param imageView 组件名称 |
| | | * @param isSelected 状态 |
| | | */ |
| | | private void screenIconState(RelativeLayout relativeLayout, ImageView imageView, boolean isSelected) { |
| | | viewBinding.stationNameRl.setSelected(false); |
| | | viewBinding.stationNameIv.setSelected(false); |
| | | viewBinding.stationPowerRl.setSelected(false); |
| | | viewBinding.stationPowerIv.setSelected(false); |
| | | viewBinding.stationDayRl.setSelected(false); |
| | | viewBinding.stationDayIv.setSelected(false); |
| | | viewBinding.stationMonthRl.setSelected(false); |
| | | viewBinding.stationMonthIv.setSelected(false); |
| | | relativeLayout.setSelected(isSelected); |
| | | imageView.setSelected(isSelected); |
| | | } |
| | | |
| | | private void initView() { |
| | | viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE); |
| | | viewBinding.deviceLabelParent.setVisibility(View.GONE); |
| | | |
| | | viewBinding.powerStationAllIl.stationTitleTv.setText(getString(R.string.message_all)); |
| | | viewBinding.powerStationFaultsIl.stationTitleTv.setText(getString(R.string.my_power_station_malfunction)); |
| | | viewBinding.powerStationOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line)); |
| | | viewBinding.powerStationConnectedIl.stationTitleTv.setText(getString(R.string.to_be_added)); |
| | | |
| | | selectedStationStateStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true); |
| | | viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff)); |
| | | 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)); |
| | | //电站标签 |
| | | houseInfoAdapter = new HouseInfoAdapter(_mActivity); |
| | | viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity)); |
| | |
| | | deviceInfoAdapter = new DeviceInfoAdapter(_mActivity); |
| | | viewBinding.fragmentDeviceSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity)); |
| | | viewBinding.fragmentDeviceSrlListRc.setAdapter(deviceInfoAdapter); |
| | | this.nullDataUpdateUi(); |
| | | // this.nullDataUpdateUi(); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | private void selectedTitleLabelStyle() { |
| | | if (isClickPowerStationLabel) { |
| | | viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style); |
| | | viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style); |
| | | viewBinding.powerStationLabel.setTextAppearance(R.style.Text18Style); |
| | | viewBinding.deviceLabel.setTextAppearance(R.style.Text14Style); |
| | | // viewBinding.editIv.setVisibility(View.VISIBLE);//编辑图标隐藏 |
| | | viewBinding.addIv.setVisibility(View.VISIBLE);//添加图标隐藏 |
| | | viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示 |
| | |
| | | viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | | } |
| | | } else { |
| | | viewBinding.deviceLabel.setTextAppearance(R.style.Text20Style); |
| | | viewBinding.powerStationLabel.setTextAppearance(R.style.Text16Style); |
| | | viewBinding.deviceLabel.setTextAppearance(R.style.Text18Style); |
| | | viewBinding.powerStationLabel.setTextAppearance(R.style.Text14Style); |
| | | // viewBinding.editIv.setVisibility(View.GONE);//编辑图标隐藏 |
| | | viewBinding.addIv.setVisibility(View.GONE);//添加图标隐藏 |
| | | viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏 |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 显示选中状态样式 |
| | | * |
| | | * @param linearLayout 组件 |
| | | * @param numberTv 组件 |
| | | * @param titleTv 组件 |
| | | * @param isShowSelectedStatus 是否显示状态样式 |
| | | */ |
| | | private void selectedStationStateStyle(LinearLayout linearLayout, TextView numberTv, TextView titleTv, boolean isShowSelectedStatus) { |
| | | viewBinding.powerStationAllIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); |
| | | viewBinding.powerStationFaultsIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); |
| | | viewBinding.powerStationOfflineIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); |
| | | viewBinding.powerStationConnectedIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff)); |
| | | |
| | | viewBinding.powerStationAllIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.powerStationAllIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null)); |
| | | |
| | | viewBinding.powerStationFaultsIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.powerStationFaultsIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null)); |
| | | |
| | | viewBinding.powerStationOfflineIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.powerStationOfflineIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null)); |
| | | |
| | | viewBinding.powerStationConnectedIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.powerStationConnectedIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null)); |
| | | |
| | | |
| | | if (isShowSelectedStatus) { |
| | | linearLayout.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.selected_8_38c494)); |
| | | numberTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null)); |
| | | titleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null)); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void initData() { |
| | | if (isClickPowerStationLabel) { |
| | |
| | | // 取消粘性事件 |
| | | 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(); |
| | | HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true); |
| | | |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) { |
| | |
| | | // 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())) { |
| | | // 取消粘性事件 |
| | |
| | | |
| | | |
| | | } else if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) { |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | //接收外部点击事件 |
| | | if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) { |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | HdlLogLogic.print("正在点击【电站】"); |
| | | // if (!isReadData) { |
| | | // //1,从首页-故障-进来-电站(不读取) |
| | |
| | | //2024年06月24日14:34:01 产品经理要求进去电站列表都要读取 且默认进去都是默认电站标签 |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | InitializationState(); |
| | | initializationState(); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | |
| | | |
| | | } else if (eventBus.getType().equals(PowerStationStatus.All)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationAllIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationFaultsIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.off)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationOfflineIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.connecting)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.powerStationConnectedIl.parentLl.performClick(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } else if (eventBus.getType().equals(ConstantManage.station_page)) { |
| | | //通过首页电站进来的 |
| | | if (eventBus.getData().equals(PowerStationStatus.All)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.allLl.performClick(); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.malfunction)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.faultsLl.performClick(); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.off)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.offlineLl.performClick(); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.connecting)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.connectedLl.performClick(); |
| | | } |
| | | } else if (eventBus.getType().equals(ConstantManage.station_edit)) { |
| | | //编辑后更新一下住宅列表 |
| | | //loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | |
| | | if (statusOverviewBean == null) { |
| | | return; |
| | | } |
| | | viewBinding.powerStationAllIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal())); |
| | | viewBinding.powerStationFaultsIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault())); |
| | | viewBinding.powerStationOfflineIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline())); |
| | | viewBinding.powerStationConnectedIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting())); |
| | | viewBinding.allTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal())); |
| | | viewBinding.faultsTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault())); |
| | | viewBinding.offlineTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline())); |
| | | viewBinding.connectedTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | * @param key 发电功率排序(powerSort); |
| | | * 今日发电量排序(todayElectricitySort); |
| | | * 创建时间排序(createTimeSort); |
| | | * 电池容量排序(batteryCapacitySort); |
| | | * @param keyValue (descending:降序 |
| | | * ascending:升序), |
| | | * @param installedCapacityMin 最小组串容量(装机容量) |
| | | * @param installedCapacityMax 最大组串容量(装机容量) |
| | | * @param gridType 并网状态 (全部 :"";FULL_GRID : 并网;OFFLINE :离网) |
| | | * @param gridType 调试状态(全部;调试中;调试完成;已交付;授权调试) |
| | | * @param powerStationStatus 电站状态 (全部 :"";1 : 正常;2 : 离线; 3 : 待接入;4 : 故障) |
| | | * @param pageNo 页码 |
| | | * @param isClear 是否清除数据 |
| | |
| | | if (requestCode == PermissionUtils.STATUS_SUCCESS) { |
| | | for (int i = 0; i < permissions.length; i++) { |
| | | if (grantResults[i] == PackageManager.PERMISSION_GRANTED) { |
| | | if (mPermissionsResultCallback != null) { |
| | | mPermissionsResultCallback.succeed(); |
| | | switch (permissions[i]) { |
| | | case Manifest.permission.ACCESS_FINE_LOCATION: { |
| | | UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | locationUpdates(); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } else { |
| | | if (mPermissionsResultCallback != null) { |
| | | mPermissionsResultCallback.failing(); |
| | | } |
| | | HdlDialogLogic.getInstance().showSettingPermissionDialog(_mActivity, _mActivity.getString(R.string.set_location_permissions)); |
| | | break; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public void requestPermissions(OnCallBeak onCallBeak) { |
| | | |
| | | private PermissionsResultCallback mPermissionsResultCallback; |
| | | //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); |
| | | } else { |
| | | |
| | | public interface PermissionsResultCallback { |
| | | UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | locationUpdates(); |
| | | |
| | | void succeed(); |
| | | |
| | | void failing(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 初始化【开启定位】和【位置信息】权限 |
| | | */ |
| | | private void locationUpdates() { |
| | | // 初始化LocationManager对象 |
| | | LocationManager locationManager = (LocationManager) _mActivity.getSystemService(Context.LOCATION_SERVICE); |
| | | GPSManagerUtils.getInstance().getLocation(_mActivity); |
| | | // 判断设备是否支持定位功能 |
| | | if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { |
| | | // 提示用户打开定位功能或者引导用户去系统设置页面打开定位功能 |
| | | ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(_mActivity); |
| | | confirmationCancelDialog.setContent(getString(R.string.system_positioning_switch)); |
| | | confirmationCancelDialog.setConfirmation(getString(R.string.go_to_settings)); |
| | | confirmationCancelDialog.show(); |
| | | confirmationCancelDialog.isHideTitle(true); |
| | | confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { |
| | | @Override |
| | | public void Confirm() { |
| | | confirmationCancelDialog.dismiss(); |
| | | Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | HDLApp.getInstance().startActivity(intent); |
| | | |
| | | } |
| | | } |
| | | }); |
| | | confirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { |
| | | @Override |
| | | public void Cancel() { |
| | | confirmationCancelDialog.dismiss(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |