From 96f2b56c103c53b17cf946d2c733d4cb03d2f39d Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 29 一月 2024 15:16:28 +0800
Subject: [PATCH] 2024年01月29日15:16:23

---
 app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java
index 00bded9..ec05cd8 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java
@@ -2,6 +2,7 @@
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.widget.TextView;
 
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@@ -15,6 +16,7 @@
 import com.hdl.photovoltaic.enums.MessageFunctionTabSwitch;
 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;
@@ -103,11 +105,19 @@
             this.messageRecoverAdapter.setList(mList);
             this.messageRecoverAdapter.notifyDataSetChanged();
         }
+
+        //鍒锋柊銆愬凡鎭㈠銆戜俊鎭暟閲忔�绘暟
+        this.refreshRecoverCount();
+        this.nullDataUpdateUi();
     }
+
 
     @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_tab_switch)) {
             if (eventBus.getType().equals(MessageFunctionTabSwitch.recover.toString())) {
@@ -121,6 +131,7 @@
                 //娑堟伅璇︽儏鍥炶皟
                 initData();
                 updateListData();
+
             }
         }
     }
@@ -153,6 +164,8 @@
                             if (list != null && list.size() != 0) {
                                 mList.addAll(list);
                                 updateListData();
+                            } else {
+                                nullDataUpdateUi();
                             }
                         }
                     });
@@ -170,4 +183,35 @@
             });
         }
     }
+
+    /**
+     * 鍒锋柊銆愬凡鎭㈠銆戜俊鎭暟閲忔�绘暟
+     */
+    private void refreshRecoverCount() {
+        HdlThreadLogic.runMainThread(new Runnable() {
+            @Override
+            public void run() {
+                TextView textView = _mActivity.findViewById(R.id.message_tab_recover_title_tv);
+                if (textView != null) {
+                    textView.setText(getText(R.string.message_recover));
+                    if (mList.size() > 0) {
+                        String s = getText(R.string.message_recover) + "(" + mList.size() + ")";
+                        textView.setText(s);
+                    }
+                }
+
+            }
+        });
+    }
+
+    /**
+     * 娌℃湁鐢电珯鍒楄〃鐨勬牱寮�
+     */
+    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);
+    }
+
 }

--
Gitblit v1.8.0