Skip to content

Commit 45800f1

Browse files
author
DaniilBorovskiy1809
committed
列表 заданий по task_order + скролл длинных вариантов match
1 parent da863bf commit 45800f1

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎app/src/main/java/ru/mesh/foss/app/CdzMatchScreen.kt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import androidx.compose.foundation.BorderStroke
55
import androidx.compose.foundation.background
66
import androidx.compose.foundation.border
77
import androidx.compose.foundation.Canvas
8+
import androidx.compose.foundation.rememberScrollState
9+
import androidx.compose.foundation.verticalScroll
810
import androidx.compose.foundation.gestures.detectDragGestures
911
import androidx.compose.foundation.gestures.detectTapGestures
1012
import androidx.compose.foundation.layout.*
@@ -204,7 +206,10 @@ private fun MatchColumn(
204206
onRemove: (MatchNode) -> Unit,
205207
modifier: Modifier = Modifier,
206208
) {
207-
Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
209+
Column(
210+
modifier.heightIn(max = 360.dp).verticalScroll(rememberScrollState()),
211+
verticalArrangement = Arrangement.spacedBy(8.dp)
212+
) {
208213
nodes.forEach { node ->
209214
val index = links.entries.indexOfFirst { if (node.source) it.key == node.id else it.value == node.id }
210215
val tint by animateColorAsState(

‎app/src/main/java/ru/mesh/foss/app/CdzNativeActivity.kt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,12 @@ class CdzNativeActivity : AppCompatActivity() {
327327
if (task.optLong("id") > 0L) out += task
328328
}
329329
}
330-
return out.sortedBy { it.optInt("task_order") }
330+
val sorted = out.mapIndexed { index, task -> index to task }
331+
.sortedWith(compareBy({ it.second.optInt("task_order", Int.MAX_VALUE) }, { it.first }))
332+
.map { it.second }
333+
val orderLog = sorted.joinToString(",") { it.optInt("task_order").toString() }
334+
MeshLog.log("CDZ", "порядок заданий=$orderLog")
335+
return sorted
331336
}
332337

333338
private fun taskId(index: Int): Long = tasks.getOrNull(index)?.optLong("id") ?: 0L

0 commit comments

Comments
 (0)