| | |
| | | * 电站和设备-界面 |
| | | */ |
| | | public class HouseAndDeviceFragment extends CustomBaseFragment { |
| | | |
| | | private boolean isReadData = false; |
| | | private FragmentHouseListBinding viewBinding; |
| | | private HouseInfoAdapter houseInfoAdapter; |
| | | |
| | |
| | | |
| | | private List<HouseIdBean> houseListBeanIDList; |
| | | private List<DeviceBean> deviceInfoList; |
| | | |
| | | |
| | | private int currentHouseListPage = 0; // 当前电站列表页码 |
| | | private int currentHouseListTotal = 0; // 电站列表总页码 |
| | | private boolean isHouseLoadingMore = false; // 标记电站列表正在加载更多数据 |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | //放在这里也对,这里只是被创建一次 |
| | | // loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | // getStatusOverview(); |
| | | initData(); |
| | | //初始化 |
| | | initView(); |
| | |
| | | viewBinding.addIv.setVisibility(View.VISIBLE);//添加图标隐藏 |
| | | viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示 |
| | | viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏 |
| | | if (viewBinding.deviceNullDataIc.getRoot().getVisibility() == View.VISIBLE) { |
| | | viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | | } |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | } |
| | | }); |
| | | //设备标签 |
| | |
| | | viewBinding.addIv.setVisibility(View.GONE);//添加图标隐藏 |
| | | viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏 |
| | | viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示 |
| | | if (viewBinding.homeNullDataIc.getRoot().getVisibility() == View.VISIBLE) { |
| | | viewBinding.homeNullDataIc.getRoot().setVisibility(View.GONE); |
| | | } |
| | | loadNextPageDeviceList(true, 1, true); |
| | | } |
| | | }); |
| | |
| | | } |
| | | }); |
| | | //离线 |
| | | viewBinding.hpowerStationOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.powerStationOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | powerStationStatusValue = PowerStationStatus.off; |
| | | selectedStationStyle(viewBinding.hpowerStationOfflineIl.parentLl, viewBinding.hpowerStationOfflineIl.stationTotalTv, viewBinding.hpowerStationOfflineIl.stationTitleTv, true); |
| | | selectedStationStyle(viewBinding.powerStationOfflineIl.parentLl, viewBinding.powerStationOfflineIl.stationTotalTv, viewBinding.powerStationOfflineIl.stationTitleTv, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | |
| | | public void onRefresh() { |
| | | viewBinding.fragmentHouseSrl.setRefreshing(false); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | } |
| | | }); |
| | | //电站上拉读取 |
| | |
| | | } |
| | | } |
| | | }); |
| | | //设备添搜索 |
| | | //设备搜索 |
| | | viewBinding.deviceSearchCl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | |
| | | viewBinding.powerStationAllIl.stationTitleTv.setText(getString(R.string.message_all)); |
| | | viewBinding.powerStationFaultsIl.stationTitleTv.setText(getString(R.string.my_power_station_malfunction)); |
| | | viewBinding.hpowerStationOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line)); |
| | | viewBinding.powerStationOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line)); |
| | | viewBinding.powerStationConnectedIl.stationTitleTv.setText(getString(R.string.to_be_added)); |
| | | |
| | | selectedStationStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true); |
| | |
| | | private void selectedStationStyle(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.hpowerStationOfflineIl.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.powerStationFaultsIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.powerStationFaultsIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null)); |
| | | |
| | | viewBinding.hpowerStationOfflineIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.hpowerStationOfflineIl.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)); |
| | |
| | | this.houseListBeanIDList.addAll(HdlResidenceLogic.getInstance().getHouseIdList()); |
| | | } else { |
| | | this.deviceInfoList = new ArrayList<>(); |
| | | this.deviceInfoList.add(new DeviceBean()); |
| | | // this.deviceInfoList.addAll(HdlDeviceLogic.getInstance().getListDevice()); |
| | | this.deviceInfoList.addAll(HdlDeviceLogic.getInstance().getDeviceList()); |
| | | } |
| | | |
| | | |
| | |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | HdlLogLogic.print("正在点击【电站】"); |
| | | // HdlThreadLogic.runSubThread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | // } |
| | | // }); |
| | | |
| | | if (!isReadData) { |
| | | //1,从首页-故障-进来-电站(不读取) |
| | | //1,从电站-进来-电站(读取一次,后面进来不在读取) |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | } |
| | | } else if (eventBus.getType().equals(PowerStationStatus.All)) { |
| | | viewBinding.powerStationAllIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) { |
| | | viewBinding.powerStationFaultsIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.off)) { |
| | | viewBinding.powerStationOfflineIl.parentLl.performClick(); |
| | | } else if (eventBus.getType().equals(PowerStationStatus.connecting)) { |
| | | viewBinding.powerStationConnectedIl.parentLl.performClick(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | viewBinding.powerStationAllIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal())); |
| | | viewBinding.powerStationFaultsIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault())); |
| | | viewBinding.hpowerStationOfflineIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline())); |
| | | viewBinding.powerStationOfflineIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline())); |
| | | viewBinding.powerStationConnectedIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting())); |
| | | } |
| | | |
| | |
| | | * @param isClear 是否清除数据 |
| | | */ |
| | | private void loadNextPageHouseList(boolean isRefreshing, String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String gridType, String powerStationStatus, long pageNo, boolean isClear) { |
| | | isReadData = true; |
| | | if (isClear) { |
| | | clearData(); |
| | | } |
| | |
| | | if (isClickPowerStationLabel) { |
| | | is_data = houseListBeanIDList != null && houseListBeanIDList.size() > 0; |
| | | tipText = getString(R.string.my_power_station_data_null); |
| | | HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.homeNullDataIc.getRoot(), viewBinding.homeNullDataIc.nullDataGifAnimationIv, viewBinding.homeNullDataIc.nullDataTv, tipText, is_data); |
| | | |
| | | } else { |
| | | is_data = deviceInfoList != null && deviceInfoList.size() > 0; |
| | | tipText = getString(R.string.no_equipment); |
| | | |
| | | HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.deviceNullDataIc.getRoot(), viewBinding.deviceNullDataIc.nullDataGifAnimationIv, viewBinding.deviceNullDataIc.nullDataTv, tipText, is_data); |
| | | |
| | | } |
| | | HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, tipText, is_data); |
| | | } |
| | | |
| | | /** |