From ecaff4ffd05c630ac32e49daf3b9b8904052b0fe Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 29 十二月 2023 15:16:07 +0800
Subject: [PATCH] 备份一下

---
 app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java
index ff6ccf9..aa13d48 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java
@@ -67,6 +67,7 @@
                 currentIndex = 0;
                 initView();
                 showFragment();
+                postEventBus(MessageFunctionTabSwitch.nascent);
 
             }
         });
@@ -77,6 +78,7 @@
                 currentIndex = 1;
                 initView();
                 showFragment();
+                postEventBus(MessageFunctionTabSwitch.recover);
 
             }
         });
@@ -88,6 +90,7 @@
                 currentIndex = 2;
                 initView();
                 showFragment();
+                postEventBus(MessageFunctionTabSwitch.all);
             }
         });
     }
@@ -116,6 +119,7 @@
             viewBinding.line2V.setVisibility(View.GONE);
             viewBinding.line3V.setVisibility(View.VISIBLE);
         }
+
     }
 
     private void initData() {
@@ -130,7 +134,8 @@
         BaseEventBus baseEventBus = new BaseEventBus();
         baseEventBus.setTopic(ConstantManage.message_function_tab_switch);
         baseEventBus.setType(tabSwitch.toString());
-        EventBus.getDefault().post(baseEventBus);
+        //鍙戦�佺矘鎬т簨浠�(濡傛灉涓嶅彂绮樻�т簨浠朵細閬囧埌涓�涓病鏈夊姞杞藉嚭鏉ョ殑纰庣墖鎺ユ敹涓嶅埌淇℃伅)
+        EventBus.getDefault().postSticky(baseEventBus);
     }
 
 
@@ -183,13 +188,6 @@
         //鎶婂綋鍓嶆樉绀虹殑fragment璁板綍涓嬫潵
         currentFragment = fragmentList.get(currentIndex);
 
-        if (this.currentIndex == 0) {
-            postEventBus(MessageFunctionTabSwitch.nascent);
-        } else if (this.currentIndex == 1) {
-            postEventBus(MessageFunctionTabSwitch.recover);
-        } else if (this.currentIndex == 2) {
-            postEventBus(MessageFunctionTabSwitch.all);
-        }
 
     }
 

--
Gitblit v1.8.0