| | |
| | | package com.hdl.photovoltaic.ui.message; |
| | | |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.ActivityMessageInfoBinding; |
| | | import com.hdl.photovoltaic.enums.MessageAlarmStateType; |
| | | import com.hdl.photovoltaic.enums.MessageStateType; |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (mMessageBean == null) { |
| | | finish(); |
| | | return; |
| | | } |
| | | //恢复进来只是查看的 |
| | | //未处理 |
| | | if (mMessageBean.getStatus().equals(MessageStateType.untreated)) { |
| | | |
| | | //改变缓存状态 |
| | | HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated); |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(ConstantManage.message_function_push_post); |
| | | baseEventBus.setType(MessageStateType.untreated); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | if (mMessageBean.getType().equals(MessageAlarmStateType.fault)) { |
| | | HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated); |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(ConstantManage.message_function_push_post); |
| | | baseEventBus.setType(MessageStateType.untreated); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | } else { |
| | | //除“故障”外,其他等级信息“已读”后,自动移出“发生中”列表并加入“历史记录”列表 |
| | | HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed); |
| | | sendEventBus(); |
| | | } |
| | | |
| | | } |
| | | finish(); |
| | | } |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (mMessageBean == null) { |
| | | finish(); |
| | | return; |
| | | } |
| | | //恢复进来只是查看的 |
| | | //未处理 |
| | | if (mMessageBean.getStatus().equals(MessageStateType.untreated)) { |
| | | //改变缓存状态 |
| | | HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated); |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(ConstantManage.message_function_push_post); |
| | | baseEventBus.setType(MessageStateType.untreated); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | if (mMessageBean.getType().equals(MessageAlarmStateType.fault)) { |
| | | HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated); |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(ConstantManage.message_function_push_post); |
| | | baseEventBus.setType(MessageStateType.untreated); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | } else { |
| | | //除“故障”外,其他等级信息“已读”后,自动移出“发生中”列表并加入“历史记录”列表 |
| | | HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed); |
| | | sendEventBus(); |
| | | } |
| | | } |
| | | finish(); |
| | | } |
| | |
| | | if (mMessageBean == null) { |
| | | return; |
| | | } |
| | | //恢复进来只是查看的 |
| | | //未处理 |
| | | if (mMessageBean.getStatus().equals(MessageStateType.untreated)) { |
| | | HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed); |
| | | |
| | | //已处理要更新数据 |
| | | BaseEventBus processedBus = new BaseEventBus(); |
| | | processedBus.setTopic(ConstantManage.message_function_push_post); |
| | | processedBus.setType(MessageStateType.processed); |
| | | EventBus.getDefault().post(processedBus); |
| | | //未处理要更新数据 |
| | | BaseEventBus untreatedBus = new BaseEventBus(); |
| | | untreatedBus.setTopic(ConstantManage.message_function_push_post); |
| | | untreatedBus.setType(MessageStateType.untreated); |
| | | EventBus.getDefault().post(untreatedBus); |
| | | sendEventBus(); |
| | | } |
| | | finish(); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 通知出去外面更新数据 |
| | | */ |
| | | private void sendEventBus() { |
| | | //通知已处理要更新数据 |
| | | BaseEventBus processedBus = new BaseEventBus(); |
| | | processedBus.setTopic(ConstantManage.message_function_push_post); |
| | | processedBus.setType(MessageStateType.processed); |
| | | EventBus.getDefault().post(processedBus); |
| | | //通知未处理要更新数据 |
| | | BaseEventBus untreatedBus = new BaseEventBus(); |
| | | untreatedBus.setTopic(ConstantManage.message_function_push_post); |
| | | untreatedBus.setType(MessageStateType.untreated); |
| | | EventBus.getDefault().post(untreatedBus); |
| | | } |
| | | |
| | | |
| | | private void initView() { |
| | | |
| | | viewBinding.toolbarTopIn.topTitleTv.setText(R.string.message_alarm_info); |
| | |
| | | viewBinding.toolbarTopIn.topBackBtn.setVisibility(View.VISIBLE); |
| | | viewBinding.toolbarTopIn.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF, null)); |
| | | |
| | | if (!UserConfigManage.getInstance().isBAccount()) { |
| | | viewBinding.messageInfoBackTv.setTextColor(getColor(R.color.text_38C494)); |
| | | viewBinding.messageInfoBackTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.fillet_line_38c494)); |
| | | viewBinding.messageInfoSolveTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.checked_38c494)); |
| | | } |
| | | |
| | | viewBinding.messageInfoAlarmContentIn.leftTitleTv.setText(R.string.messagealarm_details_content); |
| | | viewBinding.messageInfoAlarmDeviceIn.leftTitleTv.setText(R.string.messagealarm_details_device); |
| | | viewBinding.messageInfoAlarmRangeIn.leftTitleTv.setText(R.string.message_alarm_detailsaffect_region); |