From 7c2dce60eeb3b3b54c52890ece8aa472d5512a04 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 11 三月 2024 16:03:49 +0800
Subject: [PATCH] 2024年03月11日16:03:42

---
 app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java           |    3 
 app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java |   41 +++-
 app/src/main/java/com/hdl/photovoltaic/enums/FilterType.java               |    8 
 app/src/main/res/drawable/fillet_line_38c494.xml                           |    9 +
 app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java          |   87 +++++++++
 app/src/main/res/values/colors.xml                                         |    1 
 app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java      |  359 ++++++++++++++++++++++++++++++---------
 app/src/main/res/drawable/checked_38c494.xml                               |    5 
 8 files changed, 419 insertions(+), 94 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/enums/FilterType.java b/app/src/main/java/com/hdl/photovoltaic/enums/FilterType.java
new file mode 100644
index 0000000..a5a5004
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/enums/FilterType.java
@@ -0,0 +1,8 @@
+package com.hdl.photovoltaic.enums;
+
+public @interface FilterType {
+    String all = "";//榛樿鍏ㄩ儴
+    String deviceType = "deviceType";
+    String type = "type";
+    String timeType = "timeType";
+}
diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java b/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java
index 68203ce..66ae087 100644
--- a/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java
@@ -17,6 +17,9 @@
     public static final String POST_Message_Info = "/home-wisdom/app/powerStation/message/info";
     //娑堟伅鏍囪宸茶(宸茶В闄�)
     public static final String POST_Message_Solve = "/home-wisdom/app/powerStation/message/solve";
+    //娑堟伅鍏ㄩ儴宸茶
+    public static final String POST_Message_AllRead = "/home-wisdom/app/powerStation/message/allRead";
+
     //endregion
 
     //region -----C鎽勬皬搴�,F鍗庢皬搴�(浣忓畢)---------
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
index f0f7534..b1af7fc 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
@@ -45,6 +45,9 @@
     }
 
     public void clearListMessage() {
+        if (mListMessage == null) {
+            return;
+        }
         if (mListMessage.size() > 0) {
             mListMessage.clear();
         }
@@ -134,7 +137,7 @@
     }
 
     public List<MessageBean> getAllMessageList() {
-        return mListMessage;
+        return sortList(mListMessage);
     }
 
 
@@ -413,7 +416,7 @@
     }
 
     /**
-     * 鑾峰彇鎸囧畾椤电殑鑾峰彇娑堟伅鍒楄〃
+     * 鑾峰彇鎸囧畾椤电殑鑾峰彇娑堟伅鍒楄〃(鐢ㄤ簬B绔�)
      *
      * @param pageNo           椤电爜
      * @param messageStateType all:鍏ㄩ儴,UNTREATED:鏈鐞�,PROCESSED:宸插鐞�;
@@ -457,6 +460,57 @@
 
     }
 
+    /**
+     * 鑾峰彇鎸囧畾椤电殑鑾峰彇娑堟伅鍒楄〃(鐢ㄤ簬C绔�)
+     *
+     * @param pageNo           椤电爜
+     * @param messageStateType all:鍏ㄩ儴,UNTREATED:鏈鐞�,PROCESSED:宸插鐞�;
+     * @param filter_key       绫诲瀷锛堣澶囷紝绛夌骇锛屾椂闂达級
+     * @param filter_value     deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級锛�
+     *                         type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱
+     *                         timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛�
+     * @param cloudCallBeak    -
+     */
+    public void getPageNoMessageList_C(int pageNo, String messageStateType, String filter_key, String filter_value, CloudCallBeak<MessageListClass> cloudCallBeak) {
+        String requestUrl = HttpApi.POST_Message_List;
+        JsonObject json = new JsonObject();
+
+        if (!MessageStateType.all.equals(messageStateType)) {
+            json.addProperty("status", messageStateType);
+        }
+        if (!TextUtils.isEmpty(filter_key) && !TextUtils.isEmpty(filter_value)) {
+            json.addProperty(filter_key, filter_value);
+        }
+        json.addProperty("pageNo", pageNo);//椤电爜
+        json.addProperty("pageSize", pageSize);//椤垫暟
+
+        HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
+            @Override
+            public void onSuccess(String jsonStr) {
+                if (TextUtils.isEmpty(jsonStr)) {
+                    if (cloudCallBeak != null) {
+                        cloudCallBeak.onSuccess(new MessageListClass());
+                    }
+                    return;
+                }
+                Gson gson = new Gson();
+                MessageListClass oldMessageListClass = gson.fromJson(jsonStr, MessageListClass.class);
+                setListMessage(oldMessageListClass.getList());
+                if (cloudCallBeak != null) {
+                    cloudCallBeak.onSuccess(oldMessageListClass);
+                }
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                if (cloudCallBeak != null) {
+                    cloudCallBeak.onFailure(e);
+                }
+            }
+        });
+
+
+    }
 
     /**
      * 鑾峰彇娑堟伅璇︽儏
@@ -523,6 +577,35 @@
 
     }
 
+    /**
+     * 娑堟伅鍏ㄩ儴宸茶
+     *
+     * @param homeId        娑堟伅id
+     * @param cloudCallBeak -
+     */
+    public void messageAllRead(String homeId, CloudCallBeak<Boolean> cloudCallBeak) {
+        String requestUrl = HttpApi.POST_Message_AllRead;
+        JsonObject json = new JsonObject();
+        json.addProperty("homeId", homeId);
+        HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
+            @Override
+            public void onSuccess(String str) {
+                if (cloudCallBeak != null) {
+                    cloudCallBeak.onSuccess(true);
+                }
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                if (cloudCallBeak != null) {
+                    cloudCallBeak.onFailure(e);
+                }
+            }
+        });
+
+
+    }
+
 
     public static class MessageListClass {
 
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 584cc4f..80d727b 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,6 +1,7 @@
 package com.hdl.photovoltaic.ui.message;
 
 
+import android.annotation.SuppressLint;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.view.View;
@@ -11,6 +12,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;
@@ -118,15 +120,22 @@
             @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);
+                    //鏀瑰彉缂撳瓨鐘舵��
+                    if (mMessageBean.getType().equals(MessageAlarmStateType.fault)) {
+                        HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated);
+                        baseEventBus.setType(MessageStateType.untreated);
+                    } else {
+                        //闄も�滄晠闅溾�濆锛屽叾浠栫瓑绾т俊鎭�滃凡璇烩�濆悗锛岃嚜鍔ㄧЩ鍑衡�滃彂鐢熶腑鈥濆垪琛ㄥ苟鍔犲叆鈥滃巻鍙茶褰曗�濆垪琛�
+                        HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed);
+                        baseEventBus.setType(MessageStateType.processed);
+                    }
                     EventBus.getDefault().post(baseEventBus);
                 }
                 finish();
@@ -137,15 +146,22 @@
             @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);
+                    //鏀瑰彉缂撳瓨鐘舵��
+                    if (mMessageBean.getType().equals(MessageAlarmStateType.fault)) {
+                        HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated);
+                        baseEventBus.setType(MessageStateType.untreated);
+                    } else {
+                        //闄も�滄晠闅溾�濆锛屽叾浠栫瓑绾т俊鎭�滃凡璇烩�濆悗锛岃嚜鍔ㄧЩ鍑衡�滃彂鐢熶腑鈥濆垪琛ㄥ苟鍔犲叆鈥滃巻鍙茶褰曗�濆垪琛�
+                        HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed);
+                        baseEventBus.setType(MessageStateType.processed);
+                    }
                     EventBus.getDefault().post(baseEventBus);
                 }
                 finish();
@@ -162,7 +178,7 @@
                         if (mMessageBean == null) {
                             return;
                         }
-                        //鎭㈠杩涙潵鍙槸鏌ョ湅鐨�
+                        //鏈鐞�
                         if (mMessageBean.getStatus().equals(MessageStateType.untreated)) {
                             HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed);
 
@@ -194,6 +210,7 @@
 
     }
 
+
     private void initView() {
 
         viewBinding.toolbarTopIn.topTitleTv.setText(R.string.message_alarm_info);
@@ -201,6 +218,12 @@
         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);
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java b/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java
index a6e41e7..ffc245f 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java
@@ -1,31 +1,44 @@
 package com.hdl.photovoltaic.ui.newC;
 
 
-import android.annotation.SuppressLint;
+import android.content.Intent;
 import android.os.Bundle;
-import android.text.TextUtils;
 import android.view.View;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.hdl.linkpm.sdk.core.exception.HDLException;
 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.ActivityMessageCenterListBinding;
+import com.hdl.photovoltaic.enums.FilterType;
 import com.hdl.photovoltaic.enums.MessageStateType;
 import com.hdl.photovoltaic.listener.CloudCallBeak;
 import com.hdl.photovoltaic.other.HdlCommonLogic;
+import com.hdl.photovoltaic.other.HdlLogLogic;
 import com.hdl.photovoltaic.other.HdlMessageLogic;
 import com.hdl.photovoltaic.other.HdlThreadLogic;
 import com.hdl.photovoltaic.ui.bean.MessageBean;
+import com.hdl.photovoltaic.ui.message.MessageInfoActivity;
 import com.hdl.photovoltaic.ui.newC.adapter.MessageCenterListAdapter;
 import com.hdl.photovoltaic.widget.TypeTitleListDialog;
+import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * C绔秷鎭腑蹇冨垪琛�
@@ -39,13 +52,16 @@
     private boolean isAlarmDeviceClick = true;//true琛ㄧず鍛婅璁惧琚�変腑,鍒檉alse琛ㄧず鎶ヨ璁板綍琚�変腑
 
     private final List<MessageBean> mList = new ArrayList<>();
-    private int currentPage = 0; // 褰撳墠椤电爜
-    private int currentTotal = 0; // 鎬婚〉鐮�
+    private int mCurrentPage = 0; // 褰撳墠椤电爜
+    private int mCurrentTotal = 0; // 鎬婚〉鐮�
 
+    private int mTotalCount1 = 0;//娑堟伅鏁伴噺鎬绘暟
 
+    private int mTotalCount2 = 0;//娑堟伅鏁伴噺鎬绘暟
+    private String mFilterKye = FilterType.all;//杩囨护绫诲瀷
+    private String mFilterValue = FilterType.all;//杩囨护绫诲瀷鍊�
     private boolean isLoadingMore = false; // 鏍囪姝e湪鍔犺浇鏇村鏁版嵁
-
-    LinearLayoutManager layoutManager;
+    LinearLayoutManager mLayoutManager;
 
     @Override
     public Object getContentView() {
@@ -62,7 +78,7 @@
         //鍒濆鍖栫晫闈㈢洃鍚櫒
         initEvent();
         //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�)
-        loadNextPageNascentMessageList(1, true);
+        loadNextPageMessageList(1, true, FilterType.all, FilterType.all);
     }
 
     private void initEvent() {
@@ -70,7 +86,28 @@
         viewBinding.toolbarTopMessageCenterListRl.topBackBtn.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                clearCacheData();
                 finish();
+            }
+        });
+        //娓呯┖鎵�鏈夋湭璇绘寜閽�
+        viewBinding.toolbarTopMessageCenterListRl.topMoreBtn.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showLoading();
+                HdlMessageLogic.getInstance().messageAllRead(UserConfigManage.getInstance().getHomeId(), new CloudCallBeak<Boolean>() {
+                    @Override
+                    public void onSuccess(Boolean obj) {
+                        hideLoading();
+                        loadNextPageMessageList(1, true, mFilterKye, mFilterValue);
+                    }
+
+                    @Override
+                    public void onFailure(HDLException e) {
+                        hideLoading();
+                        HdlThreadLogic.toast(_mActivity, e);
+                    }
+                });
             }
         });
 
@@ -78,20 +115,21 @@
         viewBinding.messageTabAllDeviceCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                List<String> stringList = new ArrayList<>();
-                stringList.add(getString(R.string.alarm_all_device));
-                stringList.add(getString(R.string.alarm_all_device_inverter));
-                stringList.add(getString(R.string.alarm_all_device_bms));
-                stringList.add(getString(R.string.alarm_all_device_battery_cell));
+                viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.up);
+                viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down);
+                viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down);
+                List<String> stringList = getTypeList(FilterType.deviceType);
                 TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList);
                 typeTitleListDialog.show();
                 typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() {
                     @Override
                     public void onClick(int position, String title) {
-                        viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.up);
-                        viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down);
-                        viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down);
+
                         viewBinding.allDeviceTitleTv.setText(title);
+                        mFilterKye = FilterType.deviceType;
+                        mFilterValue = findFilterValueString(title);
+                        loadNextPageMessageList(1, true, mFilterKye, mFilterValue);
+
                     }
                 });
 
@@ -102,21 +140,19 @@
         viewBinding.messageTabAllGradeCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-
-                List<String> stringList = new ArrayList<>();
-                stringList.add(getString(R.string.alarm_all_grade));
-                stringList.add(getString(R.string.alarm_all_grade_malfunction));
-                stringList.add(getString(R.string.alarm_all_grade_warning));
-                stringList.add(getString(R.string.alarm_all_grade_tip));
+                viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down);
+                viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.up);
+                viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down);
+                List<String> stringList = getTypeList(FilterType.type);
                 TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList);
                 typeTitleListDialog.show();
                 typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() {
                     @Override
                     public void onClick(int position, String title) {
-                        viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down);
-                        viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.up);
-                        viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down);
                         viewBinding.allGradeTitleTv.setText(title);
+                        mFilterKye = FilterType.type;
+                        mFilterValue = findFilterValueString(title);
+                        loadNextPageMessageList(1, true, mFilterKye, mFilterValue);
                     }
                 });
             }
@@ -125,22 +161,19 @@
         viewBinding.messageTabAllTimeCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-
-                List<String> stringList = new ArrayList<>();
-                stringList.add(getString(R.string.alarm_all_time));
-                stringList.add(getString(R.string.alarm_all_time_same_day));
-                stringList.add(getString(R.string.alarm_all_time_3));
-                stringList.add(getString(R.string.alarm_all_time_7));
-                stringList.add(getString(R.string.alarm_all_time_30));
+                viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down);
+                viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down);
+                viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.up);
+                List<String> stringList = getTypeList(FilterType.timeType);
                 TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList);
                 typeTitleListDialog.show();
                 typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() {
                     @Override
                     public void onClick(int position, String title) {
-                        viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down);
-                        viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down);
-                        viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.up);
                         viewBinding.allTimeTitleTv.setText(title);
+                        mFilterKye = FilterType.timeType;
+                        mFilterValue = findFilterValueString(title);
+                        loadNextPageMessageList(1, true, mFilterKye, mFilterValue);
                     }
                 });
             }
@@ -150,18 +183,70 @@
         viewBinding.messageBottomAlarmDeviceCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                if (isAlarmDeviceClick) {
+                    return;//闃叉澶氭鐐瑰嚮
+                }
                 isAlarmDeviceClick = true;
                 refreshBottomStyle(true);
+                loadNextPageMessageList(1, true, mFilterKye, mFilterValue);
             }
         });
         //鍛婅璁板綍鎸夐挳
         viewBinding.messageBottomAlarmRecordCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                if (!isAlarmDeviceClick) {
+                    return;//闃叉澶氭鐐瑰嚮
+                }
                 isAlarmDeviceClick = false;
                 refreshBottomStyle(false);
+                loadNextPageMessageList(1, true, mFilterKye, mFilterValue);
+
             }
         });
+
+        //涓嬫媺鎸夐挳
+        viewBinding.messageContentSrl.setColorSchemeResources(R.color.text_FF245EC3);
+        viewBinding.messageContentSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+            @Override
+            public void onRefresh() {
+                viewBinding.messageContentSrl.setRefreshing(false);
+                loadNextPageMessageList(1, true, mFilterKye, mFilterValue);
+            }
+        });
+        //涓婃媺鎸夐挳
+        viewBinding.messageContentRl.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 (!isLoadingMore) {
+                        // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔
+                        HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴");
+                        loadNextPageMessageList(++mCurrentPage, false, mFilterKye, mFilterValue);
+                    }
+                }
+            }
+        });
+        if (messageCenterListAdapter != null) {
+            messageCenterListAdapter.setNoOnclickListener(new MessageCenterListAdapter.OnclickListener() {
+                @Override
+                public void onClick(int position, MessageBean messageBean) {
+                    Intent intent = new Intent();
+                    intent.putExtra("msgId", messageBean.getMsgId().toString());
+                    intent.setClass(_mActivity, MessageInfoActivity.class);
+                    startActivity(intent);
+                }
+            });
+        }
 
     }
 
@@ -177,9 +262,9 @@
         viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down);
         viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down);
         refreshBottomStyle(true);
-        layoutManager = new LinearLayoutManager(_mActivity);
+        mLayoutManager = new LinearLayoutManager(_mActivity);
         messageCenterListAdapter = new MessageCenterListAdapter(_mActivity);
-        viewBinding.messageContentRl.setLayoutManager(layoutManager);
+        viewBinding.messageContentRl.setLayoutManager(mLayoutManager);
         viewBinding.messageContentRl.setAdapter(messageCenterListAdapter);
         messageCenterListAdapter.setList(mList);
         this.nullDataUpdateUi();
@@ -193,11 +278,19 @@
      *
      * @param pageNo        椤垫暟
      * @param isShowLoading 鏄惁鍚姩鍔犺浇妗� true鍚姩
+     * @param filter_key    绫诲瀷锛堣澶囷紝绛夌骇锛屾椂闂达級
+     * @param filter_value  deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級锛�
+     *                      type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱
+     *                      timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛�
      */
-    private void loadNextPageNascentMessageList(int pageNo, boolean isShowLoading) {
+    private void loadNextPageMessageList(int pageNo, boolean isShowLoading, String filter_key, String filter_value) {
+        if (pageNo == 1) {
+            //琛ㄧず浠庣涓�椤靛彲浠ヨ鍙栵紝榛樿娓呯┖鎵�鏈夌紦瀛樻暟鎹�;
+            clearCacheData();
+        }
         //绗竴椤佃鍙栨暟鎹己鍒惰
-        if (pageNo > 1 && currentPage > currentTotal) {
-            --currentPage;
+        if (pageNo > 1 && mCurrentPage > mCurrentTotal) {
+            --mCurrentPage;
             //褰撳墠椤典笉鑳藉ぇ浜庢�婚〉鏁�
             return;
         }
@@ -205,12 +298,24 @@
         if (isShowLoading) {
             showLoading();
         }
-        HdlMessageLogic.getInstance().getPageNoMessageList(pageNo, MessageStateType.untreated, new CloudCallBeak<HdlMessageLogic.MessageListClass>() {
+        String messageStateType;
+        if (isAlarmDeviceClick) {
+            messageStateType = MessageStateType.untreated;
+        } else {
+            messageStateType = MessageStateType.processed;
+        }
+        HdlMessageLogic.getInstance().getPageNoMessageList_C(pageNo, messageStateType, filter_key, filter_value, new CloudCallBeak<HdlMessageLogic.MessageListClass>() {
             @Override
             public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) {
                 if (messageListClass != null) {
-                    currentTotal = (int) messageListClass.getTotalPage();
-                    currentPage = (int) messageListClass.getPageNo();
+                    mCurrentTotal = (int) messageListClass.getTotalPage();
+                    mCurrentPage = (int) messageListClass.getPageNo();
+                    int totalCount = (int) messageListClass.getTotalCount();
+                    if (isAlarmDeviceClick) {
+                        mTotalCount1 = totalCount;
+                    } else {
+                        mTotalCount2 = totalCount;
+                    }
                     updateListData();
                 }
                 isLoadingMore = false;
@@ -221,8 +326,8 @@
 
             @Override
             public void onFailure(HDLException e) {
-                if (currentPage > 1) {
-                    --currentPage;
+                if (mCurrentPage > 1) {
+                    --mCurrentPage;
                 }
                 isLoadingMore = false;
                 if (isShowLoading) {
@@ -230,6 +335,8 @@
                 }
             }
         });
+
+
     }
 
     /**
@@ -247,12 +354,11 @@
                         if (jsonObject.containsKey("untreatedCount")) {
                             //鏈鐞嗘暟閲�
                             String untreatedCount = jsonObject.getString("untreatedCount");
-                            refreshNascentCount(untreatedCount);
+                            refreshCount();
                         }
                         if (jsonObject.containsKey("unreadCount")) {
                             //鏈鏁伴噺
                             String unreadCount = jsonObject.getString("unreadCount");
-                            refreshUnreadNascentCount(unreadCount);
                         }
                     }
                 });
@@ -269,19 +375,49 @@
         });
     }
 
+
+    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
+    public void onEventMessage(BaseEventBus eventBus) {
+        super.onEventMessage(eventBus);
+        if (eventBus == null) {
+            return;
+        }
+        if (eventBus.getTopic().equals(ConstantManage.message_function_push_post)) {
+            if (eventBus.getType().equals(MessageStateType.untreated)) {
+                updateListData();
+            } else if (eventBus.getType().equals(MessageStateType.processed)) {
+                if (mTotalCount1 > 0) {
+                    mTotalCount1--;
+                    mTotalCount2++;
+                }
+                updateListData();
+            }
+        }
+    }
+
     /**
      * 鍒锋柊淇℃伅鏁伴噺鎬绘暟
      */
-    private void refreshNascentCount(String totalCount) {
+    private void refreshCount() {
         HdlThreadLogic.runMainThread(new Runnable() {
             @Override
             public void run() {
-                TextView textView = _mActivity.findViewById(R.id.message_bottom_alarm_device_title_tv);
-                if (textView != null) {
-                    textView.setText(getText(R.string.alarm_device));
-                    if (!TextUtils.isEmpty(totalCount) && !totalCount.equals("0")) {
-                        String s = getText(R.string.message_nascent) + "(" + totalCount + ")";
-                        textView.setText(s);
+                //璁惧鎶ヨ鎬绘暟閲�
+                TextView textView1 = _mActivity.findViewById(R.id.message_bottom_alarm_device_title_tv);
+                if (textView1 != null) {
+                    textView1.setText(getText(R.string.alarm_device));
+                    if (mTotalCount1 > 0) {
+                        String s = getText(R.string.alarm_device) + "(" + mTotalCount1 + ")";
+                        textView1.setText(s);
+                    }
+                }
+                //鎶ヨ璁板綍鎬绘暟閲�
+                TextView textView2 = _mActivity.findViewById(R.id.message_bottom_alarm_record_title_tv);
+                if (textView2 != null) {
+                    textView2.setText(getText(R.string.alarm_record));
+                    if (mTotalCount2 > 0) {
+                        String s = getText(R.string.alarm_record) + "(" + mTotalCount2 + ")";
+                        textView2.setText(s);
                     }
                 }
             }
@@ -317,31 +453,6 @@
 
 
     /**
-     * 鍒锋柊瑙掓爣銆愭湭璇汇�戜俊鎭暟閲忔�绘暟
-     */
-    private void refreshUnreadNascentCount(String unreadCount) {
-        HdlThreadLogic.runMainThread(new Runnable() {
-            @SuppressLint("SetTextI18n")
-            @Override
-            public void run() {
-                TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv);
-                if (textView != null) {
-                    if (TextUtils.isEmpty(unreadCount) || unreadCount.equals("0")) {
-                        textView.setVisibility(View.GONE);
-                    } else {
-                        textView.setVisibility(View.VISIBLE);
-                        if (unreadCount.length() > 2) {
-                            textView.setText("99+");
-                        } else {
-                            textView.setText(unreadCount);
-                        }
-                    }
-                }
-            }
-        });
-    }
-
-    /**
      * 鍒锋柊鍒楄〃鏁版嵁
      */
     private void updateListData() {
@@ -351,11 +462,9 @@
                 //璇诲彇缂撳瓨鏁版嵁
                 updateCacheData();
                 //鍒锋柊鍒楄〃
-                if (messageCenterListAdapter != null) {
-                    messageCenterListAdapter.setList(mList);
-                }
+                updateRecyclerViewList();
                 //鏄剧ず鏈淇℃伅鎬绘暟閲�
-                getUnreadCount();
+                refreshCount();
                 //鏄剧ず娌℃暟鎹甎i鏍峰紡
                 nullDataUpdateUi();
 
@@ -364,11 +473,30 @@
     }
 
     /**
+     * 閲嶆柊鏇存柊鍒楄〃鏁版嵁
+     */
+    private void updateRecyclerViewList() {
+        if (messageCenterListAdapter == null) {
+            return;
+        }
+        messageCenterListAdapter.setList(mList);
+    }
+
+    /**
+     * 娓呯┖鎵�鏈夌紦瀛樻暟鎹�(鑾峰彇绗竴椤典箣鍓嶈娓呯┖鎵�鏈夌紦瀛樻暟鎹�)
+     */
+    private void clearCacheData() {
+        mList.clear();
+        HdlMessageLogic.getInstance().clearListMessage();//琛ㄧず寮哄埗娓呯┖鎵�鏈夌紦瀛樹俊鎭�
+    }
+
+
+    /**
      * 鏇存柊缂撳瓨鏁版嵁
      */
     private void updateCacheData() {
         mList.clear();
-        mList.addAll(HdlMessageLogic.getInstance().getNascentMessageMemoryList());
+        mList.addAll(HdlMessageLogic.getInstance().getAllMessageList());
     }
 
 
@@ -378,4 +506,69 @@
     private void nullDataUpdateUi() {
         HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.message_alarm_data_null), mList.size() > 0);
     }
+
+    /**
+     * 鏌ユ壘杩囨护鍊�
+     *
+     * @param title 鏍囬
+     * @return 杩囨护鍊�
+     */
+    public String findFilterValueString(String title) {
+        Map<String, String> map = new HashMap<>();
+        map.put(getString(R.string.alarm_all_device), "");//璁惧鍏ㄩ儴
+        map.put(getString(R.string.alarm_all_device_inverter), "INV");
+        map.put(getString(R.string.alarm_all_device_bms), "BMS");
+        map.put(getString(R.string.alarm_all_device_battery_cell), "BATTERY");
+        map.put(getString(R.string.alarm_all_grade), "");//璁剧瓑绾у叏閮�
+        map.put(getString(R.string.alarm_all_grade_malfunction), "FAULT");
+        map.put(getString(R.string.alarm_all_grade_warning), "WARN");
+        map.put(getString(R.string.alarm_all_grade_tip), "EVENT");
+        map.put(getString(R.string.alarm_all_time), "");//鏃堕棿鍏ㄩ儴
+        map.put(getString(R.string.alarm_all_time_same_day), "TODAY");
+        map.put(getString(R.string.alarm_all_time_3), "LAST_3_DAYS");
+        map.put(getString(R.string.alarm_all_time_7), "LAST_7_DAYS");
+        map.put(getString(R.string.alarm_all_time_30), "LAST_30_DAYS");
+
+        for (Map.Entry<String, String> entry : map.entrySet()) {
+            if (title.equals(entry.getKey())) {
+                return entry.getValue();
+            }
+        }
+        return "";
+    }
+
+    /**
+     * 鑾峰彇绫诲瀷鍒楄〃
+     *
+     * @param filterType 杩囨护绫诲瀷
+     * @return 杩斿洖绫诲瀷鍒楄〃
+     */
+    private List<String> getTypeList(String filterType) {
+        List<String> stringList = new ArrayList<>();
+        switch (filterType) {
+            case FilterType.deviceType: {
+                stringList.add(getString(R.string.alarm_all_device));
+                stringList.add(getString(R.string.alarm_all_device_inverter));
+                stringList.add(getString(R.string.alarm_all_device_bms));
+                stringList.add(getString(R.string.alarm_all_device_battery_cell));
+            }
+            break;
+            case FilterType.type: {
+                stringList.add(getString(R.string.alarm_all_grade));
+                stringList.add(getString(R.string.alarm_all_grade_malfunction));
+                stringList.add(getString(R.string.alarm_all_grade_warning));
+                stringList.add(getString(R.string.alarm_all_grade_tip));
+            }
+            break;
+            case FilterType.timeType: {
+                stringList.add(getString(R.string.alarm_all_time));
+                stringList.add(getString(R.string.alarm_all_time_same_day));
+                stringList.add(getString(R.string.alarm_all_time_3));
+                stringList.add(getString(R.string.alarm_all_time_7));
+                stringList.add(getString(R.string.alarm_all_time_30));
+            }
+            break;
+        }
+        return stringList;
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/res/drawable/checked_38c494.xml b/app/src/main/res/drawable/checked_38c494.xml
new file mode 100644
index 0000000..ca42a2c
--- /dev/null
+++ b/app/src/main/res/drawable/checked_38c494.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="@color/text_38C494"/>
+    <corners android:radius="@dimen/dp_4"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/fillet_line_38c494.xml b/app/src/main/res/drawable/fillet_line_38c494.xml
new file mode 100644
index 0000000..d31ef6c
--- /dev/null
+++ b/app/src/main/res/drawable/fillet_line_38c494.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="@dimen/dp_4" />
+    <solid android:color="#00000000" />
+    <stroke
+        android:width="1dp"
+        android:color="@color/text_38C494" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index f0d9a59..5bdebe6 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -46,6 +46,7 @@
     <color name="text_EDEFF2">#EDEFF2</color>
     <color name="text_191919">#191919</color>
     <color name="text_B2B2B2">#B2B2B2</color>
+    <color name="text_38C494">#38C494</color>
 
 
 </resources>
\ No newline at end of file

--
Gitblit v1.8.0