From bae677bcbf12e6e7bff63baff362f3ce91184a62 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 09 五月 2024 17:49:33 +0800
Subject: [PATCH] 2024年05月09日17:49:28

---
 app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java       |  275 ++++++++++++++++++++++++
 app/src/main/res/values/styles.xml                                              |    4 
 app/src/main/java/com/hdl/photovoltaic/base/BaseDialog.java                     |    3 
 app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java      |   46 ++-
 app/src/main/res/values/strings.xml                                             |    1 
 app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java |   74 +++---
 app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java             |   54 ++++
 app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java   |  152 ++++++++-----
 app/src/main/res/layout/dialog_default_filtering.xml                            |   29 +-
 9 files changed, 495 insertions(+), 143 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/base/BaseDialog.java b/app/src/main/java/com/hdl/photovoltaic/base/BaseDialog.java
index 082298e..4afe44c 100644
--- a/app/src/main/java/com/hdl/photovoltaic/base/BaseDialog.java
+++ b/app/src/main/java/com/hdl/photovoltaic/base/BaseDialog.java
@@ -1,5 +1,6 @@
 package com.hdl.photovoltaic.base;
 
+import android.app.Activity;
 import android.app.Dialog;
 import android.content.Context;
 import android.graphics.Color;
@@ -8,6 +9,7 @@
 import androidx.annotation.NonNull;
 
 import com.hdl.photovoltaic.R;
+import com.jaeger.library.StatusBarUtil;
 
 public class BaseDialog extends Dialog {
 
@@ -20,6 +22,7 @@
         setNotificationBarBackgroundColor(CustomColor.white);
     }
 
+
     /**
      * 淇敼鐘舵�佹爮瀛椾綋棰滆壊锛堥粦鑹诧級
      */
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java
index a7b54f7..735f513 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java
@@ -344,21 +344,59 @@
     /**
      * 鑾峰彇浣忓畢(鐢电珯)ID鍒楄〃
      *
-     * @param key      鍙戠數鍔熺巼鎺掑簭(powerSort);
-     *                 浠婃棩鍙戠數閲忔帓搴�(todayElectricitySort);
-     *                 鍒涘缓鏃堕棿鎺掑簭(createTimeSort);
-     * @param keyValue (descending:闄嶅簭
-     *                 ascending:鍗囧簭),
-     * @param pageNo   椤电爜
-     * @param pageSize 椤垫暟锛堜竴椤靛灏戞暟鎹級
+     * @param key                  鍙戠數鍔熺巼鎺掑簭(powerSort);
+     *                             浠婃棩鍙戠數閲忔帓搴�(todayElectricitySort);
+     *                             鍒涘缓鏃堕棿鎺掑簭(createTimeSort);
+     * @param keyValue             (descending:闄嶅簭
+     *                             ascending:鍗囧簭),
+     * @param installedCapacityMin 鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
+     * @param installedCapacityMax 鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
+     * @param gridType             骞剁綉鐘舵�� (鍏ㄩ儴 锛�"";FULL_GRID 锛� 骞剁綉;OFFLINE 锛氱缃�)
+     * @param powerStationStatus   鐢电珯鐘舵�� (鍏ㄩ儴  锛�"";1 锛� 姝e父;2 锛� 绂荤嚎; 3 锛� 寰呮帴鍏�;4 锛� 鏁呴殰)
+     * @param pageNo               椤电爜
+     * @param pageSize             椤垫暟锛堜竴椤靛灏戞暟鎹級
      */
-    public void getResidenceIdList(String key, String keyValue, long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) {
+    public void getResidenceIdList(
+            String key,
+            String keyValue,
+            String installedCapacityMin,
+            String installedCapacityMax,
+            String gridType,
+            String powerStationStatus,
+            long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) {
 
         String requestUrl = HttpApi.POST_PowerStation_List;
         JsonObject json = new JsonObject();
         if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(keyValue)) {
             json.addProperty(key, keyValue);//鍙戠數鍔熺巼鎺掑簭(descending:闄嶅簭ascending:鍗囧簭)
         }
+        if (!TextUtils.isEmpty(installedCapacityMin)) {
+            try {
+                int value = Integer.parseInt(installedCapacityMin);//鍙兘鏈夊紓甯�,鐢ㄦ埛杈撳叆鍊艰秴鏃秈nt鏈�澶ц嚧瀵艰嚧鐨�
+                json.addProperty("installedCapacityMin", value);
+            } catch (Exception ignored) {
+            }
+        }
+        if (!TextUtils.isEmpty(installedCapacityMax)) {
+            try {
+                int value = Integer.parseInt(installedCapacityMax);//鍙兘鏈夊紓甯�,鐢ㄦ埛杈撳叆鍊艰秴鏃秈nt鏈�澶ц嚧瀵艰嚧鐨�
+                json.addProperty("installedCapacityMax", value);
+            } catch (Exception ignored) {
+            }
+        }
+        if (!TextUtils.isEmpty(gridType)) {
+            try {
+                json.addProperty("gridType", gridType);
+            } catch (Exception ignored) {
+            }
+        }
+        if (!TextUtils.isEmpty(powerStationStatus)) {
+            try {
+                int value = Integer.parseInt(powerStationStatus);
+                json.addProperty("powerStationStatus", value);
+            } catch (Exception ignored) {
+            }
+        }
 //        json.addProperty("zoneType", "password");//鍖哄煙
         json.addProperty("pageNo", pageNo);//椤电爜
         json.addProperty("pageSize", pageSize);//椤垫暟
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 80d727b..c0b0223 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
@@ -125,18 +125,20 @@
                 }
                 //鏈鐞�
                 if (mMessageBean.getStatus().equals(MessageStateType.untreated)) {
-                    BaseEventBus baseEventBus = new BaseEventBus();
-                    baseEventBus.setTopic(ConstantManage.message_function_push_post);
+
                     //鏀瑰彉缂撳瓨鐘舵��
                     if (mMessageBean.getType().equals(MessageAlarmStateType.fault)) {
                         HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated);
+                        BaseEventBus baseEventBus = new BaseEventBus();
+                        baseEventBus.setTopic(ConstantManage.message_function_push_post);
                         baseEventBus.setType(MessageStateType.untreated);
+                        EventBus.getDefault().post(baseEventBus);
                     } else {
                         //闄も�滄晠闅溾�濆锛屽叾浠栫瓑绾т俊鎭�滃凡璇烩�濆悗锛岃嚜鍔ㄧЩ鍑衡�滃彂鐢熶腑鈥濆垪琛ㄥ苟鍔犲叆鈥滃巻鍙茶褰曗�濆垪琛�
                         HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed);
-                        baseEventBus.setType(MessageStateType.processed);
+                        sendEventBus();
                     }
-                    EventBus.getDefault().post(baseEventBus);
+
                 }
                 finish();
             }
@@ -151,18 +153,18 @@
                 }
                 //鏈鐞�
                 if (mMessageBean.getStatus().equals(MessageStateType.untreated)) {
-                    BaseEventBus baseEventBus = new BaseEventBus();
-                    baseEventBus.setTopic(ConstantManage.message_function_push_post);
                     //鏀瑰彉缂撳瓨鐘舵��
                     if (mMessageBean.getType().equals(MessageAlarmStateType.fault)) {
                         HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.untreated);
+                        BaseEventBus baseEventBus = new BaseEventBus();
+                        baseEventBus.setTopic(ConstantManage.message_function_push_post);
                         baseEventBus.setType(MessageStateType.untreated);
+                        EventBus.getDefault().post(baseEventBus);
                     } else {
                         //闄も�滄晠闅溾�濆锛屽叾浠栫瓑绾т俊鎭�滃凡璇烩�濆悗锛岃嚜鍔ㄧЩ鍑衡�滃彂鐢熶腑鈥濆垪琛ㄥ苟鍔犲叆鈥滃巻鍙茶褰曗�濆垪琛�
                         HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed);
-                        baseEventBus.setType(MessageStateType.processed);
+                        sendEventBus();
                     }
-                    EventBus.getDefault().post(baseEventBus);
                 }
                 finish();
             }
@@ -181,17 +183,7 @@
                         //鏈鐞�
                         if (mMessageBean.getStatus().equals(MessageStateType.untreated)) {
                             HdlMessageLogic.getInstance().setMessageState(mMessageBean.getMsgId(), true, MessageStateType.processed);
-
-                            //閫氱煡宸插鐞嗚鏇存柊鏁版嵁
-                            BaseEventBus processedBus = new BaseEventBus();
-                            processedBus.setTopic(ConstantManage.message_function_push_post);
-                            processedBus.setType(MessageStateType.processed);
-                            EventBus.getDefault().post(processedBus);
-                            //閫氱煡鏈鐞嗚鏇存柊鏁版嵁
-                            BaseEventBus untreatedBus = new BaseEventBus();
-                            untreatedBus.setTopic(ConstantManage.message_function_push_post);
-                            untreatedBus.setType(MessageStateType.untreated);
-                            EventBus.getDefault().post(untreatedBus);
+                            sendEventBus();
                         }
                         finish();
 
@@ -210,6 +202,22 @@
 
     }
 
+    /**
+     * 閫氱煡鍑哄幓澶栭潰鏇存柊鏁版嵁
+     */
+    private void sendEventBus() {
+        //閫氱煡宸插鐞嗚鏇存柊鏁版嵁
+        BaseEventBus processedBus = new BaseEventBus();
+        processedBus.setTopic(ConstantManage.message_function_push_post);
+        processedBus.setType(MessageStateType.processed);
+        EventBus.getDefault().post(processedBus);
+        //閫氱煡鏈鐞嗚鏇存柊鏁版嵁
+        BaseEventBus untreatedBus = new BaseEventBus();
+        untreatedBus.setTopic(ConstantManage.message_function_push_post);
+        untreatedBus.setType(MessageStateType.untreated);
+        EventBus.getDefault().post(untreatedBus);
+    }
+
 
     private void initView() {
 
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 b850088..f32beb7 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
@@ -36,6 +36,7 @@
 import com.hdl.photovoltaic.ui.bean.HouseIdBean;
 import com.hdl.photovoltaic.uni.HDLUniMP;
 import com.hdl.photovoltaic.utils.PermissionUtils;
+import com.hdl.photovoltaic.widget.DefaultFilteringDialog;
 import com.hdl.photovoltaic.widget.DelayedConfirmationCancelDialog;
 import com.hdl.sdk.link.common.exception.HDLLinkException;
 import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
@@ -70,16 +71,10 @@
 
     private String key = SortValue.all;
     private String value = SortValue.all;//descending:闄嶅簭,ascending:鍗囧簭
-
-
-    private String installedCapacityMinKey = SortType.installedCapacityMin;
-    private int installedCapacityMinValue;//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
-    private String installedCapacityMaxKey = SortType.installedCapacityMax;
-    private int installedCapacityMaxValue;//鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
-    private String gridTypeKey = SortType.gridType;
-    private String gridTypeValue;//骞剁綉鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,FULL_GRID:骞剁綉,OFFLINE:绂荤綉)
-    private String powerStationStatusKey = SortType.powerStationStatus;
-    private int powerStationStatusValue;//鐢电珯鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,1:姝e父(杩愯),2:绂荤嚎,3:寰呮帴鍏�,4:鏁呴殰)
+    private String installedCapacityMinValue = "";//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
+    private String installedCapacityMaxValue = "";//鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
+    private String gridTypeValue = "";//骞剁綉鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,FULL_GRID:骞剁綉,OFFLINE:绂荤綉)
+    private String powerStationStatusValue = "";//鐢电珯鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,1:姝e父(杩愯),2:绂荤嚎,3:寰呮帴鍏�,4:鏁呴殰)
 
     private final long pageSize = 20;//椤垫暟
 
@@ -113,7 +108,7 @@
                 viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style);
                 viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);
                 viewBinding.deviceLabelParent.setVisibility(View.GONE);//璁惧鏍囩闅愯棌
-                loadNextPageHouseList(true, 1, true);
+                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
             }
         });
         //璁惧鏍囩
@@ -142,7 +137,7 @@
 
             }
         });
-        //鐢电珯娣绘悳绱�
+        //鐢电珯鎼滅储
         viewBinding.powerStationSearchClickCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
@@ -151,6 +146,25 @@
                 startActivity(intent);
             }
         });
+        //榛樿閫夋嫨鍙傛暟鍥炬爣
+        viewBinding.powerStationDefaultConditionIv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                DefaultFilteringDialog defaultFilteringDialog = new DefaultFilteringDialog(_mActivity);
+                defaultFilteringDialog.show();
+                defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue);
+                defaultFilteringDialog.setOnClickListener(new DefaultFilteringDialog.OnClickListener() {
+                    @Override
+                    public void confirm(String min, String max, String state) {
+                        installedCapacityMinValue = min;//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
+                        installedCapacityMaxValue = max;//鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
+                        gridTypeValue = state;//骞剁綉鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,FULL_GRID:骞剁綉,OFFLINE:绂荤綉)
+                        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+                    }
+                });
+            }
+        });
+
         //鐢电珯璁剧疆涓嬫媺绠ご棰滆壊
         viewBinding.fragmentHouseSrl.setColorSchemeResources(R.color.text_FF245EC3);
         //鐢电珯涓嬫媺璇诲彇
@@ -158,7 +172,7 @@
             @Override
             public void onRefresh() {
                 viewBinding.fragmentHouseSrl.setRefreshing(false);
-                loadNextPageHouseList(true, 1, true);
+                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
             }
         });
         //鐢电珯涓婃媺璇诲彇
@@ -178,7 +192,7 @@
                     if (!isHouseLoadingMore) {
                         // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔
                         HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴");
-                        loadNextPageHouseList(false, ++currentHouseListPage, false);
+                        loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, ++currentHouseListPage, false);
                     }
                 }
             }
@@ -421,7 +435,7 @@
         if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(eventBus.getTopic())) {
             if (HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION.equals(eventBus.getType())) {
                 //uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡
-                loadNextPageHouseList(false, 1, true);
+                loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                 if (eventBus.getData() != null) {
                     Gson gson = new Gson();
                     String json = eventBus.getData().toString();
@@ -460,7 +474,7 @@
             if (MqttRecvClient.getInstance() != null) {
                 MqttRecvClient.getInstance().removeAllTopic();
             }
-            loadNextPageHouseList(false, 1, true);
+            loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
 
         } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) {
             //杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡
@@ -475,7 +489,7 @@
             //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢
             if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) {
                 HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��");
-                loadNextPageHouseList(true, 1, true);
+                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
             }
         }
     }
@@ -484,9 +498,28 @@
     /**
      * 鍒锋柊UI锛堢數绔欙級
      *
-     * @param isRefreshing 琛ㄧず鏄笅鎷夊埛鏂扮殑
+     * @param isRefreshing         琛ㄧず鏄笅鎷夊埛鏂扮殑
+     * @param key                  鍙戠數鍔熺巼鎺掑簭(powerSort);
+     *                             浠婃棩鍙戠數閲忔帓搴�(todayElectricitySort);
+     *                             鍒涘缓鏃堕棿鎺掑簭(createTimeSort);
+     * @param keyValue             (descending:闄嶅簭
+     *                             ascending:鍗囧簭),
+     * @param installedCapacityMin 鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
+     * @param installedCapacityMax 鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
+     * @param gridType             骞剁綉鐘舵�� (鍏ㄩ儴 锛�"";FULL_GRID 锛� 骞剁綉;OFFLINE 锛氱缃�)
+     * @param powerStationStatus   鐢电珯鐘舵�� (鍏ㄩ儴  锛�"";1 锛� 姝e父;2 锛� 绂荤嚎; 3 锛� 寰呮帴鍏�;4 锛� 鏁呴殰)
+     * @param pageNo               椤电爜
+     * @param isClear              鏄惁娓呴櫎鏁版嵁
      */
-    private void loadNextPageHouseList(boolean isRefreshing, long pageNo, boolean isClear) {
+    private void loadNextPageHouseList(boolean isRefreshing,
+                                       String key,
+                                       String keyValue,
+                                       String installedCapacityMin,
+                                       String installedCapacityMax,
+                                       String gridType,
+                                       String powerStationStatus,
+                                       long pageNo,
+                                       boolean isClear) {
         if (isClear) {
             clearData();
         }
@@ -502,50 +535,57 @@
         }
 
         //鑾峰彇浣忓畢(鐢电珯)ID鍒楄〃
-        HdlResidenceLogic.getInstance().getResidenceIdList(key, value, pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() {
-            @Override
-            public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) {
-                HdlThreadLogic.runMainThread(new Runnable() {
+        HdlResidenceLogic.getInstance().getResidenceIdList(
+                key,
+                keyValue,
+                installedCapacityMin,
+                installedCapacityMax,
+                gridType,
+                powerStationStatus,
+                pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() {
                     @Override
-                    public void run() {
-                        if (isRefreshing) {
-                            hideLoading();
-                        }
-                        isHouseLoadingMore = false;
-                        if (houseBeanClass != null) {
-                            currentHouseListTotal = (int) houseBeanClass.getTotalPage();
-                            currentHouseListPage = (int) houseBeanClass.getPageNo();
-                            //鏇存柊缂撳瓨
-                            HdlResidenceLogic.getInstance().setHouseIdList(houseBeanClass.getList());
-                            if (houseInfoAdapter != null) {
-                                initData();
-                                //鏇存柊UI
-                                houseInfoAdapter.setList(houseListBeanIDList);
+                    public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) {
+                        HdlThreadLogic.runMainThread(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (isRefreshing) {
+                                    hideLoading();
+                                }
+                                isHouseLoadingMore = false;
+                                if (houseBeanClass != null) {
+                                    currentHouseListTotal = (int) houseBeanClass.getTotalPage();
+                                    currentHouseListPage = (int) houseBeanClass.getPageNo();
+                                    //鏇存柊缂撳瓨
+                                    HdlResidenceLogic.getInstance().setHouseIdList(houseBeanClass.getList());
+                                    if (houseInfoAdapter != null) {
+                                        initData();
+                                        //鏇存柊UI
+                                        houseInfoAdapter.setList(houseListBeanIDList);
+                                    }
+                                }
+                                nullDataUpdateUi();
                             }
-                        }
-                        nullDataUpdateUi();
+                        }, _mActivity, ShowErrorMode.YES);
+
                     }
-                }, _mActivity, ShowErrorMode.YES);
 
-            }
-
-            @Override
-            public void onFailure(HDLException e) {
-                HdlThreadLogic.runMainThread(new Runnable() {
                     @Override
-                    public void run() {
-                        if (currentHouseListPage > 1) {
-                            --currentHouseListPage;
-                        }
-                        isHouseLoadingMore = false;
-                        if (isRefreshing) {
-                            hideLoading();
-                        }
+                    public void onFailure(HDLException e) {
+                        HdlThreadLogic.runMainThread(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (currentHouseListPage > 1) {
+                                    --currentHouseListPage;
+                                }
+                                isHouseLoadingMore = false;
+                                if (isRefreshing) {
+                                    hideLoading();
+                                }
 
+                            }
+                        }, _mActivity, ShowErrorMode.YES);
                     }
-                }, _mActivity, ShowErrorMode.YES);
-            }
-        });
+                });
     }
 
     /**
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java
index a84f2c0..6afbe86 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java
@@ -270,49 +270,51 @@
         }
 
         //鑾峰彇浣忓畢(鐢电珯)ID鍒楄〃
-        HdlResidenceLogic.getInstance().getResidenceIdList(SortType.homeName, currSearchText, pageNo, 20, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() {
-            @Override
-            public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) {
-                HdlThreadLogic.runMainThread(new Runnable() {
+        HdlResidenceLogic.getInstance().getResidenceIdList(SortType.homeName, currSearchText,
+                "", "", "", "",
+                pageNo, 20, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() {
                     @Override
-                    public void run() {
-                        if (isRefreshing) {
-                            hideLoading();
-                        }
-                        isHouseLoadingMore = false;
-                        if (houseBeanClass != null) {
-                            currentHouseListTotal = (int) houseBeanClass.getTotalPage();
-                            currentHouseListPage = (int) houseBeanClass.getPageNo();
-                            //鏇存柊缂撳瓨
-                            setHouseIdList(houseBeanClass.getList());
-                            if (searchHouseAdapter != null) {
-                                initData();
-                                //鏇存柊UI
-                                searchHouseAdapter.setList(houseListBeanIDList);
+                    public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) {
+                        HdlThreadLogic.runMainThread(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (isRefreshing) {
+                                    hideLoading();
+                                }
+                                isHouseLoadingMore = false;
+                                if (houseBeanClass != null) {
+                                    currentHouseListTotal = (int) houseBeanClass.getTotalPage();
+                                    currentHouseListPage = (int) houseBeanClass.getPageNo();
+                                    //鏇存柊缂撳瓨
+                                    setHouseIdList(houseBeanClass.getList());
+                                    if (searchHouseAdapter != null) {
+                                        initData();
+                                        //鏇存柊UI
+                                        searchHouseAdapter.setList(houseListBeanIDList);
+                                    }
+                                }
                             }
-                        }
+                        }, _mActivity, ShowErrorMode.YES);
+
                     }
-                }, _mActivity, ShowErrorMode.YES);
 
-            }
-
-            @Override
-            public void onFailure(HDLException e) {
-                HdlThreadLogic.runMainThread(new Runnable() {
                     @Override
-                    public void run() {
-                        if (currentHouseListPage > 1) {
-                            --currentHouseListPage;
-                        }
-                        isHouseLoadingMore = false;
-                        if (isRefreshing) {
-                            hideLoading();
-                        }
+                    public void onFailure(HDLException e) {
+                        HdlThreadLogic.runMainThread(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (currentHouseListPage > 1) {
+                                    --currentHouseListPage;
+                                }
+                                isHouseLoadingMore = false;
+                                if (isRefreshing) {
+                                    hideLoading();
+                                }
 
+                            }
+                        }, _mActivity, ShowErrorMode.YES);
                     }
-                }, _mActivity, ShowErrorMode.YES);
-            }
-        });
+                });
     }
 
     private void clearData() {
diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java b/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java
index 6f41018..5fd99bc 100644
--- a/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java
+++ b/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java
@@ -2,13 +2,18 @@
 
 import android.content.Context;
 import android.os.Bundle;
+import android.text.TextUtils;
 import android.view.View;
+import android.widget.TextView;
 
 import androidx.annotation.NonNull;
+import androidx.appcompat.content.res.AppCompatResources;
 
 import com.hdl.photovoltaic.R;
 import com.hdl.photovoltaic.base.BaseDialog;
 import com.hdl.photovoltaic.databinding.DialogDefaultFilteringBinding;
+import com.hdl.photovoltaic.enums.GridType;
+import com.hdl.photovoltaic.other.HdlThreadLogic;
 
 public class DefaultFilteringDialog extends BaseDialog {
     private final Context mContext;
@@ -16,6 +21,18 @@
     DialogDefaultFilteringBinding viewBinding;
 
     OnClickListener mOnClickListener;
+
+    final String text1 = "0-5";
+    final String text2 = "5-10";
+    final String text3 = "10-15";
+    final String text4 = "15-30";
+    final String text5 = "30-100";
+    final String text6 = "100-300";
+    final String text7 = "300-500";
+    final String text8 = "500+";
+
+
+    private String mStateValue = GridType.All;
 
     public DefaultFilteringDialog(@NonNull Context context) {
         super(context, R.style.Custom_Dialog);
@@ -32,7 +49,7 @@
         //鍒濆鍖栫晫闈㈡帶浠�
         initView();
         //鍒濆鍖栫晫闈㈡暟鎹�
-        initData();
+//        initData(mMinValue, mMaxValue, mStateValue);
         //鍒濆鍖栫晫闈㈡帶浠剁殑浜嬩欢
         initEvent();
     }
@@ -42,12 +59,36 @@
         viewBinding.affirmLl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                if (mOnClickListener != null) {
-                    mOnClickListener.confirm();
+                String minValue = viewBinding.minEt.getText().toString();
+                String maxValue = viewBinding.maxEt.getText().toString();
+                if (!TextUtils.isEmpty(minValue) && !TextUtils.isEmpty(maxValue)) {
+                    try {
+                        if (Integer.parseInt(minValue) > Integer.parseInt(maxValue)) {
+                            //鏈�灏忓�煎湪鍓嶉潰
+                            if (mOnClickListener != null) {
+                                mOnClickListener.confirm(maxValue, minValue, mStateValue);
+                            }
+                        } else {
+                            if (mOnClickListener != null) {
+                                mOnClickListener.confirm(minValue, maxValue, mStateValue);
+                            }
+                        }
+                    } catch (Exception e) {
+                        //寮哄埗杞崲鍥犺緭鍏ュ�艰秴鍑篿nt鍊煎煙鑼冨洿鎶ュ嚭寮傚父
+                        int maxValueInt = Integer.MAX_VALUE;
+                        HdlThreadLogic.toast(mContext, mContext.getString(R.string.the_input_value_has_been_exceeded) + "(" + maxValueInt + ").");
+                        return;
+                    }
+
+                } else {
+                    if (mOnClickListener != null) {
+                        mOnClickListener.confirm(minValue, maxValue, mStateValue);
+                    }
                 }
                 dismiss();
             }
         });
+
 
         viewBinding.cancelLl.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -55,12 +96,228 @@
                 dismiss();
             }
         });
+
+        viewBinding.resetTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(null, TitleType.string_capacity);
+                setSelectedText("");
+            }
+        });
+        viewBinding.text1Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text1Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text1Tv.getTag().toString());
+            }
+        });
+        viewBinding.text2Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text2Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text2Tv.getTag().toString());
+            }
+        });
+        viewBinding.text3Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text3Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text3Tv.getTag().toString());
+            }
+        });
+        viewBinding.text4Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text4Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text4Tv.getTag().toString());
+            }
+        });
+
+        viewBinding.text5Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text5Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text5Tv.getTag().toString());
+            }
+        });
+        viewBinding.text6Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text6Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text6Tv.getTag().toString());
+            }
+        });
+        viewBinding.text7Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text7Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text7Tv.getTag().toString());
+            }
+        });
+        viewBinding.text8Tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.text8Tv, TitleType.string_capacity);
+                setSelectedText(viewBinding.text8Tv.getTag().toString());
+            }
+        });
+
+        viewBinding.allTv.setOnClickListener(new View.OnClickListener() {
+
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState);
+                setSelectedText(viewBinding.allTv.getTag().toString());
+            }
+        });
+        viewBinding.gridConnectedTv.setOnClickListener(new View.OnClickListener() {
+
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.gridConnectedTv, TitleType.GridConnectedState);
+                setSelectedText(viewBinding.gridConnectedTv.getTag().toString());
+            }
+        });
+        viewBinding.offNetworkTv.setOnClickListener(new View.OnClickListener() {
+
+            @Override
+            public void onClick(View v) {
+                setBackgroundColor(viewBinding.offNetworkTv, TitleType.GridConnectedState);
+                setSelectedText(viewBinding.offNetworkTv.getTag().toString());
+            }
+        });
+
     }
 
-    private void initData() {
+    /**
+     * @param value 閫変腑鐨勫��
+     */
+    private void setSelectedText(String value) {
+
+        String minValue = "", maxValue = "";
+        if (TextUtils.isEmpty(value)) {
+            minValue = "";
+            maxValue = "";
+        } else if (value.contains("+")) {
+            minValue = "500";
+            maxValue = "";
+        } else if (value.contains("-")) {
+            String[] min_max = value.split("-");
+            if (min_max.length == 2) {
+                minValue = min_max[0];
+                maxValue = min_max[1];
+            }
+        } else {
+            mStateValue = value;
+        }
+
+        viewBinding.minEt.setText(minValue);
+        viewBinding.maxEt.setText(maxValue);
+
+    }
+
+    /**
+     * 鏀瑰彉缁勪欢鑳屾櫙锛屽瓧浣撻鑹叉牸寮�
+     *
+     * @param textView  缁勪欢鍙互锛堣缃负null,娌℃湁閫変腑鐘舵��)
+     * @param titleType 淇敼绫诲瀷
+     */
+    private void setBackgroundColor(TextView textView, TitleType titleType) {
+        if (titleType == TitleType.string_capacity) {
+            viewBinding.text1Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text1Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.text2Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text2Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.text3Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text3Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.text4Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text4Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.text5Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text5Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.text6Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text6Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.text7Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text7Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.text8Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.text8Tv.setTextColor(mContext.getColor(R.color.text_90000000));
+        } else {
+            viewBinding.allTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.allTv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.gridConnectedTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.gridConnectedTv.setTextColor(mContext.getColor(R.color.text_90000000));
+            viewBinding.offNetworkTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
+            viewBinding.offNetworkTv.setTextColor(mContext.getColor(R.color.text_90000000));
+        }
+        if (textView != null) {
+            textView.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.selected_38c494));
+            textView.setTextColor(mContext.getColor(R.color.text_FFFFFFFF));
+        }
+
+    }
+
+    public void initState(String min, String max, String stateValue) {
+        try {
+            mStateValue = stateValue;
+            viewBinding.minEt.setText(min);
+            viewBinding.maxEt.setText(max);
+
+            if (!TextUtils.isEmpty(min) || !TextUtils.isEmpty(max)) {
+                String str = min + "-" + max;
+                switch (str) {
+                    case text1:
+                        setBackgroundColor(viewBinding.text1Tv, TitleType.string_capacity);
+                        break;
+                    case text2:
+                        setBackgroundColor(viewBinding.text2Tv, TitleType.string_capacity);
+                        break;
+                    case text3:
+                        setBackgroundColor(viewBinding.text3Tv, TitleType.string_capacity);
+                        break;
+                    case text4:
+                        setBackgroundColor(viewBinding.text4Tv, TitleType.string_capacity);
+                        break;
+                    case text5:
+                        setBackgroundColor(viewBinding.text5Tv, TitleType.string_capacity);
+                        break;
+                    case text6:
+                        setBackgroundColor(viewBinding.text6Tv, TitleType.string_capacity);
+                        break;
+                    case text7:
+                        setBackgroundColor(viewBinding.text7Tv, TitleType.string_capacity);
+                        break;
+                    case text8:
+                        setBackgroundColor(viewBinding.text8Tv, TitleType.string_capacity);
+                        break;
+                }
+            }
+            if (TextUtils.isEmpty(stateValue)) {
+                setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState);
+            } else if (stateValue.equals(GridType.FULL_GRID)) {
+                setBackgroundColor(viewBinding.gridConnectedTv, TitleType.GridConnectedState);
+            } else {
+                setBackgroundColor(viewBinding.offNetworkTv, TitleType.GridConnectedState);
+            }
+        } catch (Exception ignored) {
+        }
+
     }
 
     private void initView() {
+
+        viewBinding.text1Tv.setTag(text1);
+        viewBinding.text2Tv.setTag(text2);
+        viewBinding.text3Tv.setTag(text3);
+        viewBinding.text4Tv.setTag(text4);
+        viewBinding.text5Tv.setTag(text5);
+        viewBinding.text6Tv.setTag(text6);
+        viewBinding.text7Tv.setTag(text7);
+        viewBinding.text8Tv.setTag(text8);
+
+        viewBinding.allTv.setTag(GridType.All);
+        viewBinding.gridConnectedTv.setTag(GridType.FULL_GRID);
+        viewBinding.offNetworkTv.setTag(GridType.OFFLINE);
+        setBackgroundColor(null, TitleType.string_capacity);
+        setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState);
     }
 
     public void setOnClickListener(OnClickListener onClickListener) {
@@ -71,6 +328,14 @@
 
 
     public interface OnClickListener {
-        void confirm();
+        void confirm(String min, String max, String state);
     }
+
+    public enum TitleType {
+        string_capacity,//缁勪覆瀹归噺
+        GridConnectedState//骞剁綉鐘舵��
+
+    }
+
+
 }
diff --git a/app/src/main/res/layout/dialog_default_filtering.xml b/app/src/main/res/layout/dialog_default_filtering.xml
index b9c7d65..a2dd503 100644
--- a/app/src/main/res/layout/dialog_default_filtering.xml
+++ b/app/src/main/res/layout/dialog_default_filtering.xml
@@ -123,22 +123,18 @@
                 android:layout_marginStart="@dimen/dp_20"
                 android:background="@drawable/search_bj_ff05000000"
                 android:gravity="center"
-                android:hint="min"
+                android:inputType="number"
                 android:textColor="@color/text_90000000"
                 android:textColorHint="@color/text_40000000"
                 android:textSize="@dimen/text_14" />
 
             <View
-                android:layout_width="match_parent"
+                android:layout_width="@dimen/dp_16"
                 android:layout_height="1dp"
-                android:layout_marginStart="@dimen/dp_5"
-                android:layout_marginTop="@dimen/dp_17"
-                android:layout_marginEnd="@dimen/dp_5"
-                android:layout_toStartOf="@+id/max_et"
-                android:layout_toEndOf="@+id/min_et"
-                android:background="@color/text_E1E1E1"
-
-                />
+                android:layout_alignParentStart="true"
+                android:layout_marginStart="@dimen/dp_180"
+                android:layout_marginTop="@dimen/dp_19"
+                android:background="@color/text_E1E1E1" />
 
             <EditText
                 android:id="@+id/max_et"
@@ -149,7 +145,7 @@
                 android:layout_marginEnd="@dimen/dp_20"
                 android:background="@drawable/search_bj_ff05000000"
                 android:gravity="center"
-                android:hint="max"
+                android:inputType="number"
                 android:textColor="@color/text_90000000"
                 android:textColorHint="@color/text_40000000"
                 android:textSize="@dimen/text_14" />
@@ -219,7 +215,7 @@
             android:id="@+id/text5_tv"
             android:layout_width="102dp"
             android:layout_height="@dimen/dp_35"
-            android:layout_marginStart="@dimen/dp_20"
+            android:layout_marginStart="@dimen/dp_15"
             android:layout_marginTop="@dimen/dp_66"
             android:background="@drawable/search_bj_ff05000000"
             android:gravity="center"
@@ -234,7 +230,7 @@
             android:id="@+id/text6_tv"
             android:layout_width="102dp"
             android:layout_height="@dimen/dp_35"
-            android:layout_marginStart="@dimen/dp_20"
+            android:layout_marginStart="@dimen/dp_15"
             android:layout_marginTop="@dimen/dp_66"
             android:background="@drawable/search_bj_ff05000000"
             android:gravity="center"
@@ -264,11 +260,11 @@
             android:id="@+id/text8_tv"
             android:layout_width="102dp"
             android:layout_height="@dimen/dp_35"
-            android:layout_marginStart="@dimen/dp_20"
+            android:layout_marginStart="@dimen/dp_15"
             android:layout_marginTop="114dp"
             android:background="@drawable/search_bj_ff05000000"
             android:gravity="center"
-            android:tag="500-1000000"
+            android:tag="500+"
             android:text="500+"
             android:textColor="@color/text_90000000"
             android:textSize="@dimen/text_14"
@@ -295,7 +291,6 @@
             android:layout_marginTop="13dp"
             android:background="@drawable/search_bj_ff05000000"
             android:gravity="center"
-            android:tag="all"
             android:text="@string/message_all"
             android:textColor="@color/text_90000000"
             android:textSize="@dimen/text_14"
@@ -310,7 +305,6 @@
             android:layout_marginTop="13dp"
             android:background="@drawable/search_bj_ff05000000"
             android:gravity="center"
-            android:tag="grid_connected"
             android:text="@string/grid_connected"
             android:textColor="@color/text_90000000"
             android:textSize="@dimen/text_14"
@@ -325,7 +319,6 @@
             android:layout_marginTop="13dp"
             android:background="@drawable/search_bj_ff05000000"
             android:gravity="center"
-            android:tag="off_network"
             android:text="@string/off_network"
             android:textColor="@color/text_90000000"
             android:textSize="@dimen/text_14"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 44ba7df..02a7e84 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -286,6 +286,7 @@
     <string name="grid_connected_state">骞剁綉鐘舵��</string>
     <string name="grid_connected">骞剁綉</string>
     <string name="off_network">绂荤綉</string>
+    <string name="the_input_value_has_been_exceeded">杈撳叆鍊煎凡缁忚秴杩�</string>
 
 
 </resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 4e9d4d2..114e0be 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -13,7 +13,7 @@
         <item name="android:textSize">@dimen/text_20</item>
         <item name="android:textStyle">bold</item>
         <item name="android:textColor">@color/text_90000000</item>
-<!--        <item name="android:fontFamily"></item>-->
+        <!--        <item name="android:fontFamily"></item>-->
 
     </style>
     <!-- 鑷畾涔夊瓧浣撴牱寮� 鍐呭涓�绾ф爣棰�-->
@@ -35,4 +35,6 @@
     </style>
 
 
+
+
 </resources>
\ No newline at end of file

--
Gitblit v1.8.0