From 43c0a28db7e43959561036dbde0eb5cb37a7e324 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 10 五月 2024 18:25:40 +0800
Subject: [PATCH] 2024年05月10日18:25:29

---
 app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java |   53 +++++++++++++++++++++++++++++------------------------
 1 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java
index 80d727b..4cf04f1 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java
@@ -1,7 +1,6 @@
 package com.hdl.photovoltaic.ui.message;
 
 
-import android.annotation.SuppressLint;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.view.View;
@@ -91,8 +90,8 @@
                             type = _mActivity.getString(R.string.message_alarm);
                             drawable = AppCompatResources.getDrawable(_mActivity, R.drawable.alarm_ffb300);
                         } else if (mMessageBean.getType().equals(MessageAlarmStateType.event)) {
-                            type = _mActivity.getString(R.string.event);
-                            drawable = AppCompatResources.getDrawable(_mActivity, R.drawable.alarm_ffb300);
+                            type = _mActivity.getString(R.string.loading_title_tip);
+                            drawable = AppCompatResources.getDrawable(_mActivity, R.drawable.state_b9b9b9);
                         }
                         viewBinding.messageInfoAlarmStateTv.setText(type);
                         viewBinding.messageInfoAlarmStateTv.setBackground(drawable);
@@ -125,18 +124,20 @@
                 }
                 //鏈鐞�
                 if (mMessageBean.getStatus().equals(MessageStateType.untreated)) {
-                    BaseEventBus baseEventBus = new BaseEventBus();
-                    baseEventBus.setTopic(ConstantManage.message_function_push_post);
+
                     //鏀瑰彉缂撳瓨鐘舵��
                     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);
-                        baseEventBus.setType(MessageStateType.processed);
+                        sendEventBus();
                     }
-                    EventBus.getDefault().post(baseEventBus);
+
                 }
                 finish();
             }
@@ -151,18 +152,18 @@
                 }
                 //鏈鐞�
                 if (mMessageBean.getStatus().equals(MessageStateType.untreated)) {
-                    BaseEventBus baseEventBus = new BaseEventBus();
-                    baseEventBus.setTopic(ConstantManage.message_function_push_post);
                     //鏀瑰彉缂撳瓨鐘舵��
                     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);
-                        baseEventBus.setType(MessageStateType.processed);
+                        sendEventBus();
                     }
-                    EventBus.getDefault().post(baseEventBus);
                 }
                 finish();
             }
@@ -181,21 +182,9 @@
                         //鏈鐞�
                         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();
-
-
                     }
 
                     @Override
@@ -210,6 +199,22 @@
 
     }
 
+    /**
+     * 閫氱煡鍑哄幓澶栭潰鏇存柊鏁版嵁
+     */
+    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() {
 

--
Gitblit v1.8.0