fix: improve TRAIN_OR_LOCO merge display and settings scroll

This commit is contained in:
Nedifinita
2025-08-01 17:44:26 +08:00
parent e6e7831b96
commit 4cad3679a9
2 changed files with 26 additions and 3 deletions

View File

@@ -771,6 +771,30 @@ fun MergedTrainRecordItem(
"${recordItem.locoType}-${recordItem.loco}"
} else null
}
GroupBy.TRAIN_OR_LOCO -> {
val latestTrain = mergedRecord.latestRecord.train.trim()
val latestLoco = mergedRecord.latestRecord.loco.trim()
val recordTrain = recordItem.train.trim()
val recordLoco = recordItem.loco.trim()
when {
latestTrain.isNotEmpty() && latestTrain != "<NUL>" &&
recordTrain.isNotEmpty() && recordTrain != "<NUL>" &&
latestTrain == recordTrain -> {
if (recordLoco.isNotEmpty() && recordLoco != "<NUL>") {
"${recordItem.locoType}-${recordLoco}"
} else null
}
latestLoco.isNotEmpty() && latestLoco != "<NUL>" &&
recordLoco.isNotEmpty() && recordLoco != "<NUL>" &&
latestLoco == recordLoco -> {
if (recordTrain.isNotEmpty() && recordTrain != "<NUL>") {
recordTrain
} else null
}
else -> null
}
}
else -> null
}

View File

@@ -47,13 +47,12 @@ fun SettingsScreen(
val scrollState = rememberScrollState()
LaunchedEffect(scrollPosition) {
if (scrollState.value != scrollPosition) {
scrollState.scrollTo(scrollPosition)
if (scrollPosition > 0 && scrollState.value != scrollPosition) {
scrollState.animateScrollTo(scrollPosition)
}
}
LaunchedEffect(scrollState.value) {
delay(50)
onScrollPositionChange(scrollState.value)
}