Browse Source

@fun: sort and name

bai 3 năm trước cách đây
mục cha
commit
e8b4037ba2

+ 9 - 8
app/src/main/java/com/ys/bdtp/adm/mvvm/model/db/entity/task/FloorEntity.kt

@@ -52,12 +52,13 @@ data class FloorEntity(
  * 楼层信息点
  */
 data class FloorInfos(
-    val bimIdPre: String,
-    val floorElevation: Double,
-    val floorLocateType: String,
-    val floorMap: String,
-    val floorSequenceID: Int,
-    val floorType: String,
-    val height: Double,
-    val modelId: String
+    val bimIdPre: String? = "",
+    val floorElevation: Double = 0.0,
+    val floorLocateType: String? = "",
+    val floorMap: String? = "",
+    val floorSequenceID: Int = 0,
+    val floorType: String? = "",
+    val height: Double = 0.0,
+    val modelId: String? = "",
+    val digitalDeliveryID: String? = ""
 )

+ 8 - 11
app/src/main/java/com/ys/bdtp/adm/mvvm/ui/compose/ExpandList.kt

@@ -2,14 +2,7 @@ package com.ys.bdtp.adm.mvvm.ui.compose
 
 import androidx.compose.foundation.background
 import androidx.compose.foundation.clickable
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.fillMaxHeight
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.layout.*
 import androidx.compose.foundation.lazy.LazyColumn
 import androidx.compose.foundation.lazy.items
 import androidx.compose.material.Icon
@@ -26,9 +19,11 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.dp
+import com.google.gson.Gson
 import com.ys.bdtp.adm.app.theme.textBlackColor
 import com.ys.bdtp.adm.app.theme.underColor
 import com.ys.bdtp.adm.mvvm.model.db.entity.task.FloorEntity
+import com.ys.bdtp.adm.mvvm.model.db.entity.task.FloorInfos
 import com.ys.bdtp.adm.mvvm.model.db.relation.BuildingWithFloors
 
 
@@ -68,11 +63,13 @@ fun ExpandList(items: List<BuildingWithFloors>, click: (FloorEntity) -> Unit) {
                         Icons.Default.ArrowRight,
                     contentDescription = ""
                 )
-                Text(text = building.building.name, color = textBlackColor)
+                Text(text = building.building.localName, color = textBlackColor)
             }
 
             if (building.building.id == selectId && isExpand) {
-                building.floors.forEach { floor ->
+                building.floors.sortedByDescending {
+                    (Gson().fromJson(it.infos, FloorInfos::class.java)).floorSequenceID
+                }.forEach { floor ->
                     Row(
                         modifier = Modifier
                             .height(60.dp)
@@ -84,7 +81,7 @@ fun ExpandList(items: List<BuildingWithFloors>, click: (FloorEntity) -> Unit) {
                     ) {
                         Spacer(modifier = Modifier.width(48.dp))
                         Text(
-                            text = floor.localId,
+                            text = floor.localName,
                             color = textBlackColor,
                         )
                     }