2024年05月21日16:00:32
备份一下代码
| | |
| | | |
| | | //网络状态发生变化 |
| | | public static final String network_change_post = "network_change"; |
| | | //电站状态 |
| | | public static final String station_status = "station_status"; |
| | | |
| | | |
| | | } |
| | |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.QRCodeWriter; |
| | | import com.hdl.linkpm.sdk.user.HDLLinkPMUser; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; |
| | | import com.hdl.photovoltaic.enums.UnitType; |
| | | import com.hdl.photovoltaic.utils.GlideUtils; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.io.InputStream; |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发布EventBus粘性事件 |
| | | * <p> |
| | | * 注意:要取消粘性事件EventBus.getDefault().removeStickyEvent(eventBus); |
| | | * |
| | | * @param topic 主题 |
| | | * @param type 事件 |
| | | */ |
| | | public void postEventBusSticky(String topic, String type) { |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(topic); |
| | | baseEventBus.setType(type); |
| | | EventBus.getDefault().postSticky(baseEventBus); |
| | | } |
| | | |
| | | /** |
| | | * 发布EventBus粘性事件 |
| | | * <p> |
| | | * 注意:要取消粘性事件EventBus.getDefault().removeStickyEvent(eventBus); |
| | | * |
| | | * @param topic 主题 |
| | | * @param type 事件 |
| | | */ |
| | | public void postEventBusSticky(String topic, String type, Object o) { |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(topic); |
| | | baseEventBus.setType(type); |
| | | baseEventBus.setData(o); |
| | | EventBus.getDefault().postSticky(baseEventBus); |
| | | } |
| | | |
| | | /** |
| | | * 发布EventBus事件 |
| | | * |
| | | * @param topic 主题 |
| | | * @param type 事件 |
| | | */ |
| | | public void postEventBus(String topic, String type) { |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(topic); |
| | | baseEventBus.setType(type); |
| | | EventBus.getDefault().postSticky(baseEventBus); |
| | | } |
| | | |
| | | /** |
| | | * 发布EventBus事件 |
| | | * |
| | | * @param topic 主题 |
| | | * @param type 事件 |
| | | */ |
| | | public void postEventBus(String topic, String type, Object o) { |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(topic); |
| | | baseEventBus.setType(type); |
| | | baseEventBus.setData(o); |
| | | EventBus.getDefault().postSticky(baseEventBus); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.hdl.photovoltaic.databinding.ActivityMyPowerStationBinding; |
| | | import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; |
| | | import com.hdl.photovoltaic.enums.NetworkType; |
| | | import com.hdl.photovoltaic.enums.PowerStationStatusType; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlMessageLogic; |
| | |
| | | currentFragmentIndex = 0; |
| | | bottomViewChangeOfStyle(); |
| | | showFragment(); |
| | | postEventBus(HomepageTitleTabSwitch.homepage); |
| | | HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.homepage.toString()); |
| | | } |
| | | }); |
| | | viewBinding.myPowerStationBottomIl1.clickTv.setOnClickListener(new View.OnClickListener() { |
| | |
| | | currentFragmentIndex = 1; |
| | | bottomViewChangeOfStyle(); |
| | | showFragment(); |
| | | postEventBus(HomepageTitleTabSwitch.powerstation); |
| | | HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.powerstation.toString()); |
| | | } |
| | | }); |
| | | viewBinding.myMessageBottomIl2.clickTv.setOnClickListener(new View.OnClickListener() { |
| | |
| | | currentFragmentIndex = 2; |
| | | bottomViewChangeOfStyle(); |
| | | showFragment(); |
| | | postEventBus(HomepageTitleTabSwitch.message); |
| | | HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.message.toString()); |
| | | } |
| | | }); |
| | | viewBinding.myMeBottomIl3.clickTv.setOnClickListener(new View.OnClickListener() { |
| | |
| | | currentFragmentIndex = 3; |
| | | bottomViewChangeOfStyle(); |
| | | showFragment(); |
| | | postEventBus(HomepageTitleTabSwitch.me); |
| | | HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.me.toString()); |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发布点击事件 |
| | | * |
| | | * @param tabSwitch - |
| | | */ |
| | | private void postEventBus(HomepageTitleTabSwitch tabSwitch) { |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(ConstantManage.homepage_title_tab_switch); |
| | | baseEventBus.setType(tabSwitch.toString()); |
| | | EventBus.getDefault().postSticky(baseEventBus); |
| | | } |
| | | |
| | | public void requestPermissions() { |
| | | //消息通知限权 |
| | |
| | | } |
| | | }); |
| | | } |
| | | } else if (event.getTopic().contains(ConstantManage.station_status)) { |
| | | currentFragmentIndex = 1; |
| | | bottomViewChangeOfStyle(); |
| | | showFragment(); |
| | | HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, event.getType()); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.FragmentHomePageBinding; |
| | | import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; |
| | | import com.hdl.photovoltaic.enums.PowerStationStatus; |
| | | import com.hdl.photovoltaic.enums.PowerStationStatusType; |
| | | import com.hdl.photovoltaic.enums.TimeType; |
| | | import com.hdl.photovoltaic.enums.UnitType; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlPowerStationDataStatisticsLogic; |
| | | import com.hdl.photovoltaic.other.HdlResidenceLogic; |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | |
| | | //初始化 |
| | | initView(); |
| | | //初始化界面监听器 |
| | |
| | | viewBinding.homeAllIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | |
| | | HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.All); |
| | | |
| | | } |
| | | }); |
| | |
| | | viewBinding.homeFaultsIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.malfunction); |
| | | } |
| | | }); |
| | | //离线 |
| | | viewBinding.homeOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.off); |
| | | } |
| | | }); |
| | | //待接入 |
| | | viewBinding.homeConnectedIl.parentLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.connecting); |
| | | } |
| | | }); |
| | | //时间选择器 |
| | |
| | | aaChartView.callBack = this; |
| | | if (TimeType.day.equals(timeType)) { |
| | | aaChartModel = BasicChartComposer.configureAreaChart(getString(R.string.pv_power), fieldNames, fieldValues); |
| | | } else if (TimeType.month.equals(timeType) |
| | | || TimeType.year.equals(timeType) |
| | | || TimeType.all.equals(timeType)) { |
| | | } else if (TimeType.month.equals(timeType) || TimeType.year.equals(timeType) || TimeType.all.equals(timeType)) { |
| | | aaChartModel = configureColorfulColumnChart(getString(R.string.pv_power), fieldNames, fieldValues); |
| | | } |
| | | aaChartView.aa_drawChartWithChartModel(aaChartModel); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 电站状态概览 |
| | | */ |
| | |
| | | mMessageAdapter.setOnclickListener(new MessageAdapter.OnClickListener() { |
| | | @Override |
| | | public void onClick(int position, MessageBean messageBean) { |
| | | String messageStateType; |
| | | if (isAlarmDeviceClick) { |
| | | messageStateType = MessageStateType.untreated; |
| | | } else { |
| | | messageStateType = MessageStateType.processed; |
| | | } |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("msgId", messageBean.getMsgId().toString()); |
| | | intent.putExtra("messageStateType", messageStateType); |
| | | intent.setClass(_mActivity, MessageInfoActivity.class); |
| | | startActivity(intent); |
| | | } |
| | |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | //进来读取一次数据(为了更新currentPage,currentTotal这个值) |
| | | initData(); |
| | | // initData(); |
| | | HdlLogLogic.print("正在点击【消息】"); |
| | | |
| | | } |
| | |
| | | private MessageBean mMessageBean; |
| | | |
| | | private String mMsgId; |
| | | private String mMessageStateType; |
| | | |
| | | @Override |
| | | public Object getContentView() { |
| | |
| | | setStatusBarTextColor(); |
| | | try { |
| | | mMsgId = getIntent().getStringExtra("msgId"); |
| | | mMessageStateType = getIntent().getStringExtra("messageStateType"); |
| | | } catch (Exception ignored) { |
| | | } |
| | | |
| | |
| | | viewBinding.messageInfoAlarmRangeIn.rightContentTv.setText(""); |
| | | viewBinding.messageInfoPowerStationLocationIn.rightContentTv.setText(""); |
| | | viewBinding.messageInfoAlarmTimeIn.rightContentTv.setText(""); |
| | | |
| | | if (mMessageStateType.equals(MessageStateType.processed)) { |
| | | //已经解决掉的隐藏 |
| | | viewBinding.messageInfoBackTv.setVisibility(View.GONE); |
| | | viewBinding.messageInfoSolveTv.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | } |
| | |
| | | public void onClick(int position, MessageBean messageBean) { |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("msgId", messageBean.getMsgId().toString()); |
| | | intent.putExtra("messageStateType", mMessageStateType); |
| | | intent.setClass(_mActivity, MessageInfoActivity.class); |
| | | startActivity(intent); |
| | | } |
| | |
| | | messageCenterListAdapter.setNoOnclickListener(new MessageCenterListAdapter.OnclickListener() { |
| | | @Override |
| | | public void onClick(int position, MessageBean messageBean) { |
| | | |
| | | |
| | | String messageStateType; |
| | | if (isAlarmDeviceClick) { |
| | | messageStateType = MessageStateType.untreated; |
| | | } else { |
| | | messageStateType = MessageStateType.processed; |
| | | } |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("msgId", messageBean.getMsgId().toString()); |
| | | intent.putExtra("messageStateType", messageStateType); |
| | | intent.setClass(_mActivity, MessageInfoActivity.class); |
| | | startActivity(intent); |
| | | } |
| | |
| | | * 电站和设备-界面 |
| | | */ |
| | | 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.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | | } |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | } |
| | | }); |
| | | //设备标签 |
| | |
| | | public void onRefresh() { |
| | | viewBinding.fragmentHouseSrl.setRefreshing(false); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | getStatusOverview(); |
| | | } |
| | | }); |
| | | //电站上拉读取 |
| | |
| | | // 取消粘性事件 |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @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(); |
| | | } |