From 6266d263e91a6e90c64fb3e6f2be348146371cc8 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 17 五月 2024 16:17:03 +0800
Subject: [PATCH] 2024年05月17日16:17:01

---
 app/src/main/java/com/hdl/photovoltaic/ui/me/MeFragment.java                  |    6 +
 app/src/main/res/layout/fragment_house_list.xml                               |  149 ++++---------------------------------
 app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java |   30 ++++++-
 3 files changed, 47 insertions(+), 138 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/me/MeFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/me/MeFragment.java
index cc2e2a5..65e4f84 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/me/MeFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/me/MeFragment.java
@@ -29,6 +29,8 @@
 import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
 
 import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
 
 /**
  * 鎴戠殑-鐣岄潰
@@ -263,7 +265,7 @@
 
     }
 
-    @Override
+    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
     public void onEventMessage(BaseEventBus eventBus) {
         super.onEventMessage(eventBus);
         if (eventBus == null) {
@@ -272,6 +274,8 @@
         //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢
         if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) {
             if (eventBus.getType().equals(HomepageTitleTabSwitch.me.toString())) {
+                // 鍙栨秷绮樻�т簨浠�
+                EventBus.getDefault().removeStickyEvent(eventBus);
                 //璇诲彇澶村儚
                 if (UserConfigManage.getInstance().isBAccount()) {
                     this.getBUserInfo();
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
index 0fa9abd..f94d30b 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
@@ -44,6 +44,10 @@
 import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
 import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient;
 
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -404,6 +408,11 @@
     private void initView() {
         viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);
         viewBinding.deviceLabelParent.setVisibility(View.GONE);
+
+        viewBinding.powerStationAllIl.stationTitleTv.setText(getString(R.string.message_all));
+        viewBinding.powerStationFaultsIl.stationTitleTv.setText(getString(R.string.my_power_station_malfunction));
+        viewBinding.hpowerStationOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line));
+        viewBinding.powerStationConnectedIl.stationTitleTv.setText(getString(R.string.to_be_added));
         //鐢电珯鏍囩
         houseInfoAdapter = new HouseInfoAdapter(_mActivity);
         viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity));
@@ -437,11 +446,13 @@
      *
      * @param eventBus 鏁版嵁
      */
-    @Override
+    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
     public void onEventMessage(BaseEventBus eventBus) {
         super.onEventMessage(eventBus);
         if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(eventBus.getTopic())) {
             if (HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION.equals(eventBus.getType())) {
+                // 鍙栨秷绮樻�т簨浠�
+                EventBus.getDefault().removeStickyEvent(eventBus);
                 //uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡
                 loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                 if (eventBus.getData() != null) {
@@ -452,6 +463,8 @@
 
                 }
             } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) {
+                // 鍙栨秷绮樻�т簨浠�
+                EventBus.getDefault().removeStickyEvent(eventBus);
                 //todo 鐜板湪榛樿鍒锋柊鍏ㄩ儴
                 //uin缂栬緫浣忓畢閫氱煡
 //                String homeId = HdlUniLogic.getInstance().getKeyValue("homeId", eventBus.getData());
@@ -478,6 +491,8 @@
 
             }
         } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_CLOSE_HOME_DETAILS_PAGE.equals(eventBus.getType())) {
+            // 鍙栨秷绮樻�т簨浠�
+            EventBus.getDefault().removeStickyEvent(eventBus);
             //uin鍏抽棴浣忓畢璇︽儏鐣岄潰閫氱煡
             if (MqttRecvClient.getInstance() != null) {
                 MqttRecvClient.getInstance().removeAllTopic();
@@ -485,6 +500,8 @@
             loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
 
         } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) {
+            // 鍙栨秷绮樻�т簨浠�
+            EventBus.getDefault().removeStickyEvent(eventBus);
             //杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡
             for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).size(); i++) {
                 String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).get(i).getGatewayId();
@@ -496,6 +513,8 @@
         } else if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) {
             //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢
             if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) {
+                // 鍙栨秷绮樻�т簨浠�
+                EventBus.getDefault().removeStickyEvent(eventBus);
                 HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��");
 //                HdlThreadLogic.runSubThread(new Runnable() {
 //                    @Override
@@ -509,6 +528,7 @@
         }
     }
 
+
     /**
      * 鐢电珯鐘舵�佹瑙�
      */
@@ -519,10 +539,10 @@
                 if (statusOverviewBean == null) {
                     return;
                 }
-                viewBinding.screeningConditionNumber1Tv.setText(statusOverviewBean.getTotal());
-                viewBinding.screeningConditionNumber2Tv.setText(statusOverviewBean.getFault());
-                viewBinding.screeningConditionNumber3Tv.setText(statusOverviewBean.getOffline());
-                viewBinding.screeningConditionNumber4Tv.setText(statusOverviewBean.getConnecting());
+                viewBinding.powerStationAllIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal()));
+                viewBinding.powerStationFaultsIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault()));
+                viewBinding.hpowerStationOfflineIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
+                viewBinding.powerStationConnectedIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting()));
             }
 
             @Override
diff --git a/app/src/main/res/layout/fragment_house_list.xml b/app/src/main/res/layout/fragment_house_list.xml
index 21bac17..1b78380 100644
--- a/app/src/main/res/layout/fragment_house_list.xml
+++ b/app/src/main/res/layout/fragment_house_list.xml
@@ -106,8 +106,7 @@
                         android:layout_alignParentStart="true"
                         android:layout_centerVertical="true"
                         android:layout_marginStart="@dimen/dp_13"
-                        android:src="@drawable/search_path"
-                        />
+                        android:src="@drawable/search_path" />
 
                     <TextView
                         android:id="@+id/power_station_search_tv"
@@ -118,8 +117,7 @@
                         android:layout_toEndOf="@+id/power_station_search_iv"
                         android:text="Search the power station"
                         android:textColor="@color/text_66000000"
-                        android:textSize="@dimen/text_14"
-                        />
+                        android:textSize="@dimen/text_14" />
                 </RelativeLayout>
 
                 <ImageView
@@ -132,6 +130,7 @@
 
 
             </RelativeLayout>
+
             <!--鏉′欢绛涢��-->
             <LinearLayout
                 android:id="@+id/screening_condition_ll"
@@ -145,139 +144,25 @@
                 app:layout_constraintStart_toStartOf="parent"
                 app:layout_constraintTop_toBottomOf="@+id/power_station_search_cl">
 
-                <LinearLayout
-                    android:id="@+id/screening_condition_1"
-                    android:layout_width="@dimen/dp_74"
-                    android:layout_height="@dimen/dp_56"
-                    android:layout_gravity="center_vertical"
-                    android:background="@drawable/station_status_no_ffffff"
-                    android:orientation="vertical">
+                <include
+                    android:id="@+id/power_station_all_il"
+                    layout="@layout/item_station" />
 
-                    <TextView
-                        android:id="@+id/screening_condition_number1_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="@dimen/dp_25"
-                        android:layout_marginTop="7dp"
-                        android:gravity="center"
-                        android:textColor="@color/text_E6000000"
-                        android:textSize="@dimen/text_21"
-                        android:textStyle="bold" />
+                <include
+                    android:id="@+id/power_station_faults_il"
+                    layout="@layout/item_station" />
 
-                    <TextView
-                        android:id="@+id/screening_condition_text1_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="17dp"
-                        android:layout_marginTop="1dp"
-                        android:gravity="center"
-                        android:text="@string/message_all"
-                        android:textColor="@color/text_66000000"
-                        android:textSize="@dimen/text_14" />
+                <include
+                    android:id="@+id/hpower_station_offline_il"
+                    layout="@layout/item_station" />
 
-                </LinearLayout>
-
-                <View
-                    android:layout_width="@dimen/dp_16"
-                    android:layout_height="match_parent" />
-
-                <LinearLayout
-                    android:id="@+id/screening_condition_2"
-                    android:layout_width="@dimen/dp_74"
-                    android:layout_height="@dimen/dp_56"
-                    android:layout_gravity="center_vertical"
-                    android:background="@drawable/station_status_no_ffffff"
-                    android:orientation="vertical">
-
-                    <TextView
-                        android:id="@+id/screening_condition_number2_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="@dimen/dp_25"
-                        android:layout_marginTop="7dp"
-                        android:gravity="center"
-                        android:textColor="@color/text_E6000000"
-                        android:textSize="@dimen/text_21"
-                        android:textStyle="bold" />
-
-                    <TextView
-                        android:id="@+id/screening_condition_text2_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="@dimen/dp_17"
-                        android:layout_marginTop="1dp"
-                        android:gravity="center"
-                        android:text="@string/alarm_all_grade_malfunction"
-                        android:textColor="@color/text_66000000"
-                        android:textSize="@dimen/text_14" />
-
-                </LinearLayout>
-
-                <View
-                    android:layout_width="@dimen/dp_16"
-                    android:layout_height="match_parent" />
-
-                <LinearLayout
-                    android:id="@+id/screening_condition_3"
-                    android:layout_width="@dimen/dp_74"
-                    android:layout_height="@dimen/dp_56"
-                    android:layout_gravity="center_vertical"
-                    android:background="@drawable/station_status_no_ffffff"
-                    android:orientation="vertical">
-
-                    <TextView
-                        android:id="@+id/screening_condition_number3_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="@dimen/dp_25"
-                        android:layout_marginTop="7dp"
-                        android:gravity="center"
-                        android:textColor="@color/text_E6000000"
-                        android:textSize="@dimen/text_21"
-                        android:textStyle="bold" />
-
-                    <TextView
-                        android:id="@+id/screening_condition_text3_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="@dimen/dp_17"
-                        android:layout_marginTop="1dp"
-                        android:gravity="center"
-                        android:text="@string/my_power_station_off_line"
-                        android:textColor="@color/text_66000000"
-                        android:textSize="@dimen/text_14" />
-
-                </LinearLayout>
-
-                <View
-                    android:layout_width="@dimen/dp_16"
-                    android:layout_height="match_parent" />
-
-                <LinearLayout
-                    android:id="@+id/screening_condition_4"
-                    android:layout_width="@dimen/dp_74"
-                    android:layout_height="@dimen/dp_56"
-                    android:layout_gravity="center_vertical"
-                    android:background="@drawable/station_status_no_ffffff"
-                    android:orientation="vertical">
-
-                    <TextView
-                        android:id="@+id/screening_condition_number4_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="@dimen/dp_25"
-                        android:layout_marginTop="7dp"
-                        android:gravity="center"
-                        android:textColor="@color/text_E6000000"
-                        android:textSize="@dimen/text_21"
-                        android:textStyle="bold" />
-
-                    <TextView
-                        android:id="@+id/screening_condition_text4_tv"
-                        android:layout_width="match_parent"
-                        android:layout_height="@dimen/dp_17"
-                        android:layout_marginTop="1dp"
-                        android:gravity="center"
-                        android:text="@string/to_be_added"
-                        android:textColor="@color/text_66000000"
-                        android:textSize="@dimen/text_14" />
-
-                </LinearLayout>
+                <include
+                    android:id="@+id/power_station_connected_il"
+                    layout="@layout/item_station" />
 
             </LinearLayout>
+
+
             <!--鍗囧簭闄嶅簭鍔熻兘-->
             <LinearLayout
                 android:id="@+id/ascending_order_descending_order_parent_ll"

--
Gitblit v1.8.0