From f7c38847b8e00c84c30e51a92c03071d3e9a9da8 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 14 五月 2024 09:08:57 +0800
Subject: [PATCH] 2024年05月14日09:08:49

---
 app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java |   88 +++++++++++++++++++++++++++++---------------
 1 files changed, 58 insertions(+), 30 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 f001d8f..d90e9cf 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
@@ -11,6 +11,7 @@
 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;
@@ -89,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);
@@ -114,20 +115,29 @@
 
     private void initEvent() {
         //鍚庨��鐨勪簨浠�
-        viewBinding.toolbarTopIn.topBackBtn.setOnClickListener(new View.OnClickListener() {
+        viewBinding.toolbarTopIn.topBackLl.setOnClickListener(new View.OnClickListener() {
             @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();
             }
@@ -137,16 +147,23 @@
             @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();
             }
@@ -162,24 +179,12 @@
                         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();
-
-
                     }
 
                     @Override
@@ -194,13 +199,36 @@
 
     }
 
+    /**
+     * 閫氱煡鍑哄幓澶栭潰鏇存柊鏁版嵁
+     */
+    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.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C, null));
-        viewBinding.toolbarTopIn.topBackBtn.setVisibility(View.VISIBLE);
+        viewBinding.toolbarTopIn.topBackLl.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);

--
Gitblit v1.8.0