| | |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.location.LocationManager; |
| | | import android.os.AsyncTask; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.RelativeLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.photovoltaic.widget.DefaultFilteringDialog; |
| | | import com.hdl.photovoltaic.widget.DelayedConfirmationCancelDialog; |
| | | import com.hdl.photovoltaic.widget.refreshlayout.BGARefreshLayout; |
| | | import com.hdl.photovoltaic.widget.refreshlayout.HDLRefreshViewHolder; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkException; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | | import com.hdl.sdk.link.core.bean.gateway.GatewayBean; |
| | |
| | | private String screeningConditionStatus = DebugStatus.All;//筛选条件状态 |
| | | private String powerStationStatusValue = PowerStationStatus.All;//电站状态(全部 不传该过滤参数,1:正常(运行),2:离线,3:待接入,4:故障) |
| | | |
| | | private final long pageSize = 20;//页数 |
| | | private final long pageSize = 100;//一页大小 |
| | | |
| | | /** |
| | | * 还原条件的初始化状态 |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | getStatusOverview(); |
| | | // getStatusOverview(); |
| | | initData(); |
| | | //初始化 |
| | | initView(); |
| | |
| | | viewBinding.allLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (powerStationStatusValue.equals(PowerStationStatus.All)) { |
| | | return; |
| | | } |
| | | powerStationStatusValue = PowerStationStatus.All; |
| | | 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)); |
| | | |
| | | 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)); |
| | | stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | |
| | | viewBinding.faultsLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (powerStationStatusValue.equals(PowerStationStatus.malfunction)) { |
| | | return; |
| | | } |
| | | powerStationStatusValue = PowerStationStatus.malfunction; |
| | | 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)); |
| | | |
| | | 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)); |
| | | stationStatusStyle(viewBinding.faultsLl, viewBinding.faultsDesTv); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | |
| | | viewBinding.offlineLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (powerStationStatusValue.equals(PowerStationStatus.off)) { |
| | | return; |
| | | } |
| | | powerStationStatusValue = PowerStationStatus.off; |
| | | 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)); |
| | | |
| | | 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)); |
| | | stationStatusStyle(viewBinding.offlineLl, viewBinding.offlineDesTv); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | |
| | | viewBinding.connectedLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (powerStationStatusValue.equals(PowerStationStatus.connecting)) { |
| | | return; |
| | | } |
| | | powerStationStatusValue = PowerStationStatus.connecting; |
| | | 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)); |
| | | 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)); |
| | | stationStatusStyle(viewBinding.connectedLl, viewBinding.connectedDesTv); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | //电站设置下拉箭头颜色 |
| | | viewBinding.fragmentHouseSrl.setColorSchemeResources(R.color.text_FF245EC3); |
| | | //电站下拉读取 |
| | | viewBinding.fragmentHouseSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | viewBinding.fragmentHouseSrl.setRefreshing(false); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | } |
| | | }); |
| | | //电站上拉读取 |
| | | viewBinding.fragmentHouseSrlListRc.addOnScrollListener(new RecyclerView.OnScrollListener() { |
| | | @Override |
| | | public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { |
| | | // super.onScrolled(recyclerView, dx, dy); |
| | | |
| | | LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); |
| | | if (layoutManager == null) { |
| | | return; |
| | | } |
| | | int visibleItemCount = layoutManager.getChildCount(); |
| | | int totalItemCount = layoutManager.getItemCount(); |
| | | int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition(); |
| | | if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) { |
| | | if (!isHouseLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | HdlLogLogic.print("---滑动到了底部"); |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, ++currentHouseListPage, false); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | //电站详情进入,删除电站,移动电站位置 |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | boolean isSelected = !v.isSelected(); |
| | | screenIconState(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected); |
| | | screeningConditionStyle(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected); |
| | | key = SortType.installedCapacitySort; |
| | | value = isSelected ? SortValue.ascending : SortValue.descending; |
| | | getStatusOverview(); |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | boolean isSelected = !v.isSelected(); |
| | | screenIconState(viewBinding.stationPowerRl, viewBinding.stationPowerIv, isSelected); |
| | | screeningConditionStyle(viewBinding.stationPowerRl, viewBinding.stationPowerIv, isSelected); |
| | | key = SortType.invPowerSort; |
| | | value = isSelected ? SortValue.ascending : SortValue.descending; |
| | | getStatusOverview(); |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | boolean isSelected = !v.isSelected(); |
| | | screenIconState(viewBinding.stationMonthRl, viewBinding.stationMonthIv, isSelected); |
| | | screeningConditionStyle(viewBinding.stationMonthRl, viewBinding.stationMonthIv, isSelected); |
| | | key = SortType.batteryCapacitySort; |
| | | value = isSelected ? SortValue.ascending : SortValue.descending; |
| | | getStatusOverview(); |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | boolean isSelected = !v.isSelected(); |
| | | screenIconState(viewBinding.stationDayRl, viewBinding.stationDayIv, isSelected); |
| | | screeningConditionStyle(viewBinding.stationDayRl, viewBinding.stationDayIv, isSelected); |
| | | key = SortType.todayElectricitySort; |
| | | value = isSelected ? SortValue.ascending : SortValue.descending; |
| | | getStatusOverview(); |
| | |
| | | HdlDeviceLogic.getInstance().setDeviceRemoteInfo(newList, deviceBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> obj) { |
| | | |
| | | GatewayBean newGatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(deviceBean.getOsn()); |
| | | if (newGatewayBean == null) { |
| | | HdlThreadLogic.toast(_mActivity, getString(R.string.device_off)); |
| | | return; |
| | | } |
| | | if (TextUtils.isEmpty(newGatewayBean.getGatewayId()) || TextUtils.isEmpty(newGatewayBean.getAesKey())) { |
| | | //这里只支持远程调试,远程拿不到mqtt通讯秘钥以及gatewayId; |
| | | HdlThreadLogic.toast(_mActivity, getString(R.string.Device_failed_to_certificate) + "(124004)"); |
| | | return; |
| | | } |
| | | String jsonEncryption = URLEncodingUtils.encodeURIComponent(new Gson().toJson(newGatewayBean)); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_DEVICE_DETAILS + "?inverterInfo=" + jsonEncryption; |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | //设备设置下拉箭头颜色 |
| | | viewBinding.fragmentDeviceSrl.setColorSchemeResources(R.color.text_FF245EC3); |
| | | //设备下拉读取 |
| | | viewBinding.fragmentDeviceSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | viewBinding.fragmentDeviceSrl.setRefreshing(false); |
| | | loadNextPageDeviceList(false, 1, true); |
| | | } |
| | | }); |
| | | //设备上拉读取 |
| | | viewBinding.fragmentDeviceSrlListRc.addOnScrollListener(new RecyclerView.OnScrollListener() { |
| | | @Override |
| | | public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { |
| | | // super.onScrolled(recyclerView, dx, dy); |
| | | |
| | | LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); |
| | | if (layoutManager == null) { |
| | | return; |
| | | } |
| | | int visibleItemCount = layoutManager.getChildCount(); |
| | | int totalItemCount = layoutManager.getItemCount(); |
| | | int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition(); |
| | | if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) { |
| | | if (!isDeviceLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | HdlLogLogic.print("---滑动到了底部"); |
| | | loadNextPageDeviceList(false, ++currentDeviceListPage, false); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | //设备搜索 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新筛选条件状态 |
| | | * 更新筛选电站状态样式 |
| | | * |
| | | * @param ll 组件名称 |
| | | * @param tv 组件名称 |
| | | */ |
| | | private void stationStatusStyle(LinearLayout ll, TextView tv) { |
| | | 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_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_FF5B5B5B)); |
| | | viewBinding.connectedDesTv.setTextColor(getResources().getColor(R.color.text_FF5B5B5B)); |
| | | |
| | | ll.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff)); |
| | | tv.setTextColor(getResources().getColor(R.color.text_FFACACAC)); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 更新筛选条件状态样式 |
| | | * |
| | | * @param relativeLayout 组件名称 |
| | | * @param imageView 组件名称 |
| | | * @param isSelected 状态 |
| | | */ |
| | | private void screenIconState(RelativeLayout relativeLayout, ImageView imageView, boolean isSelected) { |
| | | private void screeningConditionStyle(RelativeLayout relativeLayout, ImageView imageView, boolean isSelected) { |
| | | viewBinding.stationNameRl.setSelected(false); |
| | | viewBinding.stationNameIv.setSelected(false); |
| | | viewBinding.stationPowerRl.setSelected(false); |
| | |
| | | imageView.setSelected(isSelected); |
| | | } |
| | | |
| | | |
| | | private void initView() { |
| | | viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE); |
| | | viewBinding.deviceLabelParent.setVisibility(View.GONE); |
| | | 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)); |
| | | |
| | | 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)); |
| | | stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); |
| | | //电站标签 |
| | | 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(); |
| | | //下拉刷新住宅的逻辑 |
| | | pullToRefreshHome(); |
| | | //下拉刷新设备的逻辑 |
| | | pullToRefreshDevice(); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | String homeId = eventBus.getData().toString(); |
| | | //进去住宅详情uni读取逆变器列表成功后通知 |
| | | for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) { |
| | | String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId(); |
| | | for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).size(); i++) { |
| | | String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).get(i).getGatewayId(); |
| | | //字符串是自己按规则拼接的,里面注册主题时会解析字符串,只拿getGatewayId()值; |
| | | String topic = "/user/" + gatewayId + "/#"; |
| | | //进去住宅详情开始订阅主题 |
| | |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | initializationState(); |
| | | stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } else if (eventBus.getType().equals(ConstantManage.station_page)) { |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | powerStationStatusValue = eventBus.getData() == null ? "" : eventBus.getData().toString(); |
| | | //通过首页电站进来的 |
| | | if (eventBus.getData().equals(PowerStationStatus.All)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.allLl.performClick(); |
| | | stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.malfunction)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.faultsLl.performClick(); |
| | | stationStatusStyle(viewBinding.faultsLl, viewBinding.faultsDesTv); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.off)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.offlineLl.performClick(); |
| | | stationStatusStyle(viewBinding.offlineLl, viewBinding.offlineDesTv); |
| | | } else if (eventBus.getData().equals(PowerStationStatus.connecting)) { |
| | | isClickPowerStationLabel = true; |
| | | selectedTitleLabelStyle(); |
| | | viewBinding.connectedLl.performClick(); |
| | | stationStatusStyle(viewBinding.connectedLl, viewBinding.connectedDesTv); |
| | | } |
| | | getStatusOverview(); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | } else if (eventBus.getType().equals(ConstantManage.station_edit)) { |
| | | //编辑后更新一下住宅列表 |
| | | //loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | |
| | | * 电站状态概览 |
| | | */ |
| | | private void getStatusOverview() { |
| | | HdlResidenceLogic.getInstance().getStatusOverview(screeningConditionStatus,installedCapacityMinValue,installedCapacityMaxValue,new CloudCallBeak<StatusOverviewBean>() { |
| | | HdlResidenceLogic.getInstance().getStatusOverview(screeningConditionStatus, installedCapacityMinValue, installedCapacityMaxValue, new CloudCallBeak<StatusOverviewBean>() { |
| | | @Override |
| | | public void onSuccess(StatusOverviewBean statusOverviewBean) { |
| | | if (statusOverviewBean == null) { |
| | |
| | | /** |
| | | * 刷新UI(电站) |
| | | * |
| | | * @param isRefreshing 表示是下拉刷新的 |
| | | * @param isRefreshing 是否显示加载框(true显示,false不显示) |
| | | * @param key 发电功率排序(powerSort); |
| | | * 今日发电量排序(todayElectricitySort); |
| | | * 创建时间排序(createTimeSort); |
| | |
| | | /** |
| | | * 刷新UI(设备) |
| | | * |
| | | * @param isRefreshing 表示是下拉刷新的 |
| | | * @param isRefreshing 是否显示加载框(true显示,false不显示) |
| | | * @param pageNo 页码 |
| | | * @param isClear true表示清空缓存 |
| | | */ |
| | |
| | | boolean is_data; |
| | | String tipText = ""; |
| | | if (isClickPowerStationLabel) { |
| | | is_data = houseListBeanIDList != null && houseListBeanIDList.size() > 0; |
| | | is_data = houseListBeanIDList != null && !houseListBeanIDList.isEmpty(); |
| | | 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; |
| | | is_data = deviceInfoList != null && !deviceInfoList.isEmpty(); |
| | | tipText = getString(R.string.no_equipment); |
| | | |
| | | HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.deviceNullDataIc.getRoot(), viewBinding.deviceNullDataIc.nullDataGifAnimationIv, viewBinding.deviceNullDataIc.nullDataTv, tipText, is_data); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下拉刷新【住宅】的逻辑 |
| | | */ |
| | | protected void pullToRefreshHome() { |
| | | viewBinding.fragmentHouseSrl.setDelegate(new BGARefreshLayout.BGARefreshLayoutDelegate() { |
| | | @Override |
| | | public void onBGARefreshLayoutBeginRefreshing(BGARefreshLayout refreshLayout) { |
| | | new AsyncTask<Void, Void, Void>() { |
| | | |
| | | @Override |
| | | protected Void doInBackground(Void... params) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected void onPostExecute(Void aVoid) { |
| | | // 执行任务(如更新UI、跳转等) |
| | | viewBinding.fragmentHouseSrl.endRefreshing(); |
| | | //加载最新数据完成 |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | } |
| | | }.execute(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout) { |
| | | new AsyncTask<Void, Void, Void>() { |
| | | @Override |
| | | protected Void doInBackground(Void... params) { |
| | | try { |
| | | Thread.sleep(10); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected void onPostExecute(Void aVoid) { |
| | | viewBinding.fragmentHouseSrl.endLoadingMore(); |
| | | if (!isHouseLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, ++currentHouseListPage, false); |
| | | } |
| | | } |
| | | }.execute(); |
| | | return true; |
| | | } |
| | | }); |
| | | HDLRefreshViewHolder hdlRefreshViewHolder = new HDLRefreshViewHolder(_mActivity, true); |
| | | hdlRefreshViewHolder.setPullDownImageResource(R.mipmap.loading_44); |
| | | hdlRefreshViewHolder.setChangeToReleaseRefreshAnimResId(R.drawable.loading_refresh); |
| | | hdlRefreshViewHolder.setRefreshingAnimResId(R.drawable.loading_refresh_end); |
| | | viewBinding.fragmentHouseSrl.setRefreshViewHolder(hdlRefreshViewHolder); |
| | | } |
| | | |
| | | /** |
| | | * 下拉刷新【设备】的逻辑 |
| | | */ |
| | | protected void pullToRefreshDevice() { |
| | | viewBinding.fragmentDeviceSrl.setDelegate(new BGARefreshLayout.BGARefreshLayoutDelegate() { |
| | | @Override |
| | | public void onBGARefreshLayoutBeginRefreshing(BGARefreshLayout refreshLayout) { |
| | | |
| | | new AsyncTask<Void, Void, Void>() { |
| | | @Override |
| | | protected Void doInBackground(Void... params) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected void onPostExecute(Void aVoid) { |
| | | viewBinding.fragmentDeviceSrl.endRefreshing(); |
| | | loadNextPageDeviceList(false, 1, true); |
| | | } |
| | | }.execute(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout) { |
| | | new AsyncTask<Void, Void, Void>() { |
| | | @Override |
| | | protected Void doInBackground(Void... params) { |
| | | try { |
| | | Thread.sleep(10); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected void onPostExecute(Void aVoid) { |
| | | // 执行任务(如更新UI、跳转等) |
| | | viewBinding.fragmentDeviceSrl.endLoadingMore(); |
| | | if (!isDeviceLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | loadNextPageDeviceList(false, ++currentDeviceListPage, false); |
| | | } |
| | | } |
| | | }.execute(); |
| | | return true; |
| | | } |
| | | }); |
| | | HDLRefreshViewHolder hdlRefreshViewHolder = new HDLRefreshViewHolder(_mActivity, true); |
| | | hdlRefreshViewHolder.setPullDownImageResource(R.mipmap.loading_44); |
| | | hdlRefreshViewHolder.setChangeToReleaseRefreshAnimResId(R.drawable.loading_refresh); |
| | | hdlRefreshViewHolder.setRefreshingAnimResId(R.drawable.loading_refresh_end); |
| | | viewBinding.fragmentDeviceSrl.setRefreshViewHolder(hdlRefreshViewHolder); |
| | | } |
| | | |
| | | |
| | | } |