From ec6193939600ca7930193b1d5942b1700baf9e06 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 21 二月 2025 09:20:15 +0800
Subject: [PATCH] 1.巡检记录列表页的实现 2.巡检记录地图展示路径的详情页。 3.处理巡检记录详情页因打开同一个网址导致的webView不显示问题。 4.实现地图页搜索后的地图跳转功能。 5.巡检记录详情页数据加载的优化,默认加载本地数据,当本地没有数据时从服务端获取数据。

---
 expand_button/src/main/java/com/example/expand_button/ExpandButton.kt |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/expand_button/src/main/java/com/example/expand_button/ExpandButton.kt b/expand_button/src/main/java/com/example/expand_button/ExpandButton.kt
index 1ac7b29..007713c 100644
--- a/expand_button/src/main/java/com/example/expand_button/ExpandButton.kt
+++ b/expand_button/src/main/java/com/example/expand_button/ExpandButton.kt
@@ -86,6 +86,14 @@
     // 娣诲姞涓�涓睘鎬у畾涔変笁瑙掑舰鍥炬爣鐨勭偣鍑诲尯鍩熸墿灞曡寖鍥�
     private val triangleClickPadding: Float = 15f * context.resources.displayMetrics.density // 20dp
 
+    // 娣诲姞涓�涓爣璇嗙锛岀敤浜庡尯鍒嗕笉鍚岀殑 ExpandButton 瀹炰緥
+    private var buttonId: String = "default"
+
+    companion object {
+        private const val PREFS_NAME = "expand_button_prefs"
+        private const val KEY_LEGEND_STATES = "legend_states"
+    }
+
     init {
         // 淇濆瓨 XML 涓缃殑榛樿瀛椾綋澶у皬
         defaultTextSize = textSize
@@ -485,14 +493,25 @@
     }
 
     /**
+     * 璁剧疆鎸夐挳鐨勫敮涓�鏍囪瘑绗�
+     * @param id 鏍囪瘑绗�
+     */
+    fun setButtonId(id: String) {
+        this.buttonId = id
+        // 鍔犺浇淇濆瓨鐨勭姸鎬�
+
+    }
+
+
+    /**
      * 璁剧疆鍥句緥鍐呭
      */
     @JvmName("setLegendsList")
-    fun setLegends(items: List<Triple<Drawable, Drawable, String>>) {
-        legendItems = items.map { (selectedIcon, unselectedIcon, description) ->
+    fun setLegends(items: List<Quadruple<Drawable, Drawable, String, Boolean>>) {
+        legendItems = items.map { (selectedIcon, unselectedIcon, description, isSelected) ->
             selectedIcon.setBounds(0, 0, iconSize, iconSize)
             unselectedIcon.setBounds(0, 0, iconSize, iconSize)
-            LegendItem(selectedIcon, unselectedIcon, description)
+            LegendItem(selectedIcon, unselectedIcon, description, isSelected)
         }
         
         if (!isExpanded) {
@@ -505,8 +524,21 @@
 
     // 娣诲姞涓�涓� Java 鍙嬪ソ鐨勬柟娉�
     @JvmName("setLegendsArray")
-    fun setLegends(vararg items: Triple<Drawable, Drawable, String>) {
+    fun setLegends(vararg items: Quadruple<Drawable, Drawable, String, Boolean>) {
         setLegends(items.toList())
+    }
+
+    // 娣诲姞涓�涓暟鎹被鏉ヨ〃绀哄洓鍏冪粍
+    data class Quadruple<A, B, C, D>(
+        val first: A,
+        val second: B,
+        val third: C,
+        val fourth: D
+    )
+
+    // 娣诲姞涓�涓究鎹风殑鎵╁睍鍑芥暟鏉ュ垱寤� Quadruple
+    fun <A, B, C, D> quadrupleOf(first: A, second: B, third: C, fourth: D): Quadruple<A, B, C, D> {
+        return Quadruple(first, second, third, fourth)
     }
 
     /**
@@ -587,6 +619,7 @@
             index, 
             legendItems[index].isSelected
         )
+
         invalidate()
     }
 

--
Gitblit v1.8.0