From b5b0b01715a4de1ea3cdf4804da46a546e4f9262 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 08 三月 2024 11:54:46 +0800
Subject: [PATCH] 2024年03月08日11:54:38
---
app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
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 304fac9..e3ca3cd 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java
@@ -28,6 +28,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@@ -89,6 +90,48 @@
this.houseIdList = houseIdList;
}
+ /**
+ * 鍒犻櫎鐢电珯
+ *
+ * @param houseId 鐢电珯id
+ */
+ public void delHouseId(String houseId) {
+ if (TextUtils.isEmpty(houseId)) {
+ return;
+ }
+ for (int i = 0; i < houseIdList.size(); i++) {
+ if (houseIdList.get(i).getHomeId().equals(houseId)) {
+ houseIdList.remove(i);
+ break;
+ }
+ }
+ }
+
+ /**
+ * 绉诲姩鐢电珯浣嶇疆
+ *
+ * @param houseId 鐢电珯id
+ */
+ public void moveHouseId(String houseId) {
+ if (TextUtils.isEmpty(houseId)) {
+ return;
+ }
+ int index = -1;
+ for (int i = 0; i < houseIdList.size(); i++) {
+ if (houseIdList.get(i).getHomeId().equals(houseId)) {
+ index = i;
+ break;
+ }
+ }
+ if (index == -1) {
+ return;
+ }
+ //index==0琛ㄧず鍙湁涓�涓厓绱犳垨鑰呭湪棣栦綅,涓嶉渶瑕佺Щ鍔ㄤ綅缃�
+ if (index > 0) {
+ Collections.swap(houseIdList, index - 1, index);
+ }
+ }
+
//浣忓畢ID鍒楄〃
private List<HouseIdBean> houseIdList = new ArrayList<>();
//浣忓畢璇︽儏鍒楄〃
--
Gitblit v1.8.0