From 0582b05b1f9dc97a71a72e4784452e5a43510256 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 29 十月 2024 17:23:48 +0800
Subject: [PATCH] 2024年10月29日17:21:51

---
 app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java b/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java
index 5ae379f..8eee042 100644
--- a/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java
@@ -18,7 +18,12 @@
 import com.hdl.photovoltaic.listener.BaseView;
 import com.hdl.photovoltaic.other.HdlThreadLogic;
 import com.hdl.photovoltaic.widget.LoadingDialog;
+import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
 
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
 
 import java.util.Locale;
 
@@ -44,7 +49,7 @@
             view = inflater.inflate((int) getContentView(), container, false);
         } else if (getContentView() instanceof View) {
             view = (View) getContentView();
-            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
+            ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
             view.setLayoutParams(layoutParams);
         } else {
             view = null;
@@ -56,6 +61,7 @@
     @Override
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
+        view.setClickable(true);
         view.postDelayed(new Runnable() {
             @Override
             public void run() {
@@ -88,7 +94,8 @@
 
     protected void onLazyInitView(Bundle savedInstanceState) {
         onBindView(savedInstanceState);
-//        registerEventBus();
+        //娉ㄥ唽EventBus
+        registerEventBus();
     }
 
 
@@ -99,26 +106,32 @@
         isFirst = true;
         //闅愯棌Loading
         hideLoading();
-//        unregisterEventBus();
+        //娉ㄩ攢EventBus
+        unregisterEventBus();
     }
 
 
     protected void unregisterEventBus() {
-//        if (EventBus.getDefault().isRegistered(this)) {
-//            EventBus.getDefault().unregister(this);
-//        }
+        if (EventBus.getDefault().isRegistered(this)) {
+            EventBus.getDefault().unregister(this);
+        }
     }
 
     protected void registerEventBus() {
-//        if (!EventBus.getDefault().isRegistered(this)) {
-//            EventBus.getDefault().register(this);
-//        }
+        if (!EventBus.getDefault().isRegistered(this)) {
+            EventBus.getDefault().register(this);
+        }
     }
 
-//    @Subscribe(threadMode = ThreadMode.MAIN)
-//    public void onEventMessage(BaseEvent event) {
-//
-//    }
+    /**
+     * 鏀跺埌EventBUs閫氱煡
+     *
+     * @param eventBus 鏁版嵁
+     */
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    public void onEventMessage(BaseEventBus eventBus) {
+
+    }
 
     /**
      * 鏄剧ずView
@@ -171,6 +184,7 @@
      * 寮�濮婰oading
      */
     protected void showLoading() {
+        getLoadingDialog().setText("");
         getLoadingDialog().start();
     }
 

--
Gitblit v1.8.0