Compare commits

..

No commits in common. "ca2e10b9b2c795b8a06dffd3f1061305e2db04da" and "96eb4dbbf02d3f2967d549a0e38553dc5a7e87b0" have entirely different histories.

View file

@ -28,13 +28,11 @@ import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.text.* import androidx.compose.ui.text.*
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontStyle
@ -273,8 +271,8 @@ fun TimeUnitComposable(
val currentDensity = LocalDensity.current val currentDensity = LocalDensity.current
val animatedColor by animateColorAsState( val animatedColor by animateColorAsState(
targetValue = if (gridActive) MaterialTheme.colorScheme.secondary.copy(alpha = 1f) else col, targetValue = if (gridActive) MaterialTheme.colorScheme.secondary.copy(alpha = 0.5f) else col,
animationSpec = tween(durationMillis = 100) // Très court pour rester réactif animationSpec = tween(durationMillis = 150) // Très court pour rester réactif
) )
val focusRequesters = remember { List(4) { FocusRequester() } } val focusRequesters = remember { List(4) { FocusRequester() } }
@ -477,17 +475,13 @@ fun TimeUnitComposable(
} }
} }
data class TUOWidthMeasure(val width: Dp, val isReady: Boolean)
@Composable @Composable
fun bestTUOWidth(items: List<TimeUnitObject>): TUOWidthMeasure { fun bestTUOWidth(items: List<TimeUnitObject>): Dp {
val textMeasurer = rememberTextMeasurer() val textMeasurer = rememberTextMeasurer()
val density = LocalDensity.current val density = LocalDensity.current
var maxWidth by remember(items) { mutableStateOf(0.dp) } var maxWidth by remember { mutableStateOf(0.dp) }
var isReady by remember(items) { mutableStateOf(false) }
LaunchedEffect(items) { LaunchedEffect(items) {
isReady = false
maxWidth = 0.dp maxWidth = 0.dp
items.forEach { items.forEach {
val textLayoutResult: TextLayoutResult = textMeasurer.measure( val textLayoutResult: TextLayoutResult = textMeasurer.measure(
@ -501,9 +495,8 @@ fun bestTUOWidth(items: List<TimeUnitObject>): TUOWidthMeasure {
maxWidth = textWidth maxWidth = textWidth
} }
} }
isReady = true
} }
return TUOWidthMeasure(maxWidth + 13.dp, isReady) return maxWidth + 13.dp
} }
@Composable @Composable
fun AutoResizingText( fun AutoResizingText(
@ -571,6 +564,10 @@ fun LazyVerticalGridTUO(
val tuoList = viewModel.tuoList val tuoList = viewModel.tuoList
key(tuoList) { key(tuoList) {
var isCalculatingGrid by remember { mutableStateOf(true) }
var gridColumnCount by remember { mutableStateOf(0) }
var computedMeasures by remember { mutableStateOf<List<List<TimeUnitObject>>>(emptyList()) }
var menuPosition by remember { mutableStateOf(Offset.Zero) } var menuPosition by remember { mutableStateOf(Offset.Zero) }
var showAddDialog by remember { mutableStateOf(false) } var showAddDialog by remember { mutableStateOf(false) }
var showDetailDialog by remember { mutableStateOf(false) } var showDetailDialog by remember { mutableStateOf(false) }
@ -595,57 +592,40 @@ fun LazyVerticalGridTUO(
val editMode by sharedScreenModel.modeEditor.collectAsState() val editMode by sharedScreenModel.modeEditor.collectAsState()
val showFullChord by sharedScreenModel.harmonyView.collectAsState() val showFullChord by sharedScreenModel.harmonyView.collectAsState()
var toggleWithDegreeAndChord by remember { mutableStateOf (false) } var toggleWithDegreeAndChord by remember { mutableStateOf (false) }
val focusManager = LocalFocusManager.current
Column(
modifier = Modifier
.fillMaxWidth()
.onSizeChanged { size ->
onGridWidthMeasured(size.width)
}
.focusRequester(focusRequester)
.focusable()
) {
LaunchedEffect(editMode) {
if (editMode) {
focusRequester.requestFocus()
}
}
val density = LocalDensity.current val density = LocalDensity.current
val horizontalArrangementSpacing: Dp = 0.dp
val columnGroupString = regexMeasure?.groupValues?.get(1) ?: "1" val columnGroupString = regexMeasure?.groupValues?.get(1) ?: "1"
val columnGroup = columnGroupString.toInt().coerceAtLeast(1) val columnGroup = columnGroupString.toInt().coerceAtLeast(1)
val tuoWidthMeasure = bestTUOWidth(tuoList) val itemMinBaseWidth = bestTUOWidth(tuoList)
val itemMinBaseWidth = tuoWidthMeasure.width
val gridWidthDp = with(density) { gridWidthPx.toDp() } val gridWidthDp = with(density) { gridWidthPx.toDp() }
// on affiche un loader pour éviter le "saut" visuel
val isLayoutReady = tuoWidthMeasure.isReady && gridWidthDp > 0.dp
val gridCount by sharedScreenModel.gridCount.collectAsState() val gridCount by sharedScreenModel.gridCount.collectAsState()
val currentStanza = viewModel.stanza
var gridColumnCount: Int = remember(gridWidthDp, itemMinBaseWidth, columnGroup) { // Calcul asynchrone nombre de colonnes
if (gridWidthDp == 0.dp) return@remember columnGroup LaunchedEffect(gridWidthDp, itemMinBaseWidth, columnGroup, gridCount, tuoList) {
var calculatedCols = if (gridWidthDp == 0.dp || tuoList.isEmpty()) return@LaunchedEffect
(gridWidthDp / (itemMinBaseWidth + horizontalArrangementSpacing)).toInt()
isCalculatingGrid = true
withContext(Dispatchers.Default) {
var calculatedCols = (gridWidthDp / (itemMinBaseWidth + 0.dp)).toInt()
if (calculatedCols == 0) calculatedCols = columnGroup if (calculatedCols == 0) calculatedCols = columnGroup
if (calculatedCols % columnGroup != 0) { if (calculatedCols % columnGroup != 0) {
calculatedCols = (calculatedCols / columnGroup) * columnGroup calculatedCols = (calculatedCols / columnGroup) * columnGroup
if (calculatedCols == 0) calculatedCols = columnGroup if (calculatedCols == 0) calculatedCols = columnGroup
} }
val actualColumnCount: Int = calculatedCols.coerceAtLeast(columnGroup) val finalCols = calculatedCols.coerceAtLeast(columnGroup) + gridCount
actualColumnCount val chunkedMeasures = tuoList.drop(1).chunked(finalCols)
}
gridColumnCount += gridCount
val flowRowSize: Float = 0.98f / gridColumnCount
val currentStanza = viewModel.stanza withContext(Dispatchers.Main) {
gridColumnCount = finalCols
computedMeasures = chunkedMeasures
isCalculatingGrid = false
}
}
}
val tuoTimestamps by sharedScreenModel.tuoTimestamps.collectAsState() val tuoTimestamps by sharedScreenModel.tuoTimestamps.collectAsState()
val activeRowIndex by sharedScreenModel.activeIndex.collectAsState() val activeRowIndex by sharedScreenModel.activeIndex.collectAsState()
val measures = tuoList.drop(1).chunked(gridColumnCount)
// Avant column affichage:
val metadataList = remember(tuoList) { val metadataList = remember(tuoList) {
tuoList.drop(1).mapIndexedNotNull { globalIndex, oneTUO -> tuoList.drop(1).mapIndexedNotNull { globalIndex, oneTUO ->
val markerText = oneTUO.pTemplate.markerToString() val markerText = oneTUO.pTemplate.markerToString()
@ -681,26 +661,48 @@ fun LazyVerticalGridTUO(
sharedScreenModel.updateAndFinalizeMidiData(metadataList) sharedScreenModel.updateAndFinalizeMidiData(metadataList)
} }
} }
LaunchedEffect(measures, sharedScreenModel.stanza.value) { LaunchedEffect(computedMeasures, sharedScreenModel.stanza.value) {
sharedScreenModel.updateSyllablesFromList( sharedScreenModel.updateSyllablesFromList(
measures = measures, measures = computedMeasures,
stanzaNumber = sharedScreenModel.stanza.value stanzaNumber = sharedScreenModel.stanza.value
) )
val totalSyllables = sharedScreenModel.synchronizedSyllables.value.size val totalSyllables = sharedScreenModel.synchronizedSyllables.value.size
//println("Sync complète effectuée SUR stz: ${sharedScreenModel.stanza.value}! Total colonnes : $totalSyllables") //println("Sync complète effectuée SUR stz: ${sharedScreenModel.stanza.value}! Total colonnes : $totalSyllables")
} }
if (!isLayoutReady) {
Box( Box(
modifier = Modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.height(200.dp), .onSizeChanged { size->
onGridWidthMeasured(size.width)
}
.focusRequester(focusRequester)
.focusable(),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) {
LaunchedEffect(editMode) {
if (editMode) focusRequester.requestFocus()
}
// Chargement avant affichage
if (isCalculatingGrid || computedMeasures.isEmpty() || gridColumnCount == 0) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.padding(32.dp)
.size(100.dp)
) { ) {
CircularProgressIndicator( CircularProgressIndicator(
modifier = Modifier.size(64.dp), modifier = Modifier.fillMaxSize(),
strokeWidth = 3.dp color = MaterialTheme.colorScheme.primary,
strokeWidth = 2.dp,
trackColor = MaterialTheme.colorScheme.tertiary.copy(alpha = 0.1f)
) )
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text( Text(
text = "𝄞 ♫", text = "𝄞 ♫",
style = TextStyle( style = TextStyle(
@ -709,14 +711,71 @@ fun LazyVerticalGridTUO(
) )
) )
} }
}
} else { } else {
Column( Column(
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) { ) {
measures.forEachIndexed { measureIndex, measureTUOs -> computedMeasures.forEachIndexed { measureIndex, measureTUOs ->
key(measureIndex) { key(measureIndex) {
Column(modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) { MeasureRowItem(
measureTUOs,
gridWidthDp,
gridColumnCount,
showFullChord,
sharedScreenModel,
toggleWithDegreeAndChord,
measureIndex,
activeRowIndex,
selectedGridIndex,
editMode,
selectedTUO,
selectedIndex,
showContextualMenu,
currentStanza,
focusRequester,
showEditDialog,
showAddDialog,
showDetailDialog
)
}
}
}
}
}
}
}
@Composable
private fun MeasureRowItem(
measureTUOs: List<TimeUnitObject>,
gridWidthDp: Dp,
gridColumnCount: Int,
showFullChord: Boolean,
sharedScreenModel: SharedScreenModel,
toggleWithDegreeAndChord: Boolean,
measureIndex: Int,
activeRowIndex: Int,
selectedGridIndex: Int,
editMode: Boolean,
selectedTUO: TimeUnitObject?,
selectedIndex: Int,
showContextualMenu: Boolean,
currentStanza: Int,
focusRequester: FocusRequester,
showEditDialog: Boolean,
showAddDialog: Boolean,
showDetailDialog: Boolean
) {
var toggleWithDegreeAndChord1 = toggleWithDegreeAndChord
var selectedGridIndex1 = selectedGridIndex
var selectedTUO1 = selectedTUO
var selectedIndex1 = selectedIndex
var showContextualMenu1 = showContextualMenu
var showEditDialog1 = showEditDialog
var showAddDialog1 = showAddDialog
var showDetailDialog1 = showDetailDialog
Column(modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Start, horizontalArrangement = Arrangement.Start,
@ -763,8 +822,10 @@ fun LazyVerticalGridTUO(
Canvas( Canvas(
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxSize()
) { ) {
val xStart = if (lastHairPinSymbol == '>') -size.width * (tuo.numBlock - hairPinStart) else size.width/2 val xStart =
val xEnd = if (lastHairPinSymbol == '>') size.width/2 else -size.width * (tuo.numBlock - hairPinStart) if (lastHairPinSymbol == '>') -size.width * (tuo.numBlock - hairPinStart) else size.width / 2
val xEnd =
if (lastHairPinSymbol == '>') size.width / 2 else -size.width * (tuo.numBlock - hairPinStart)
drawLine( drawLine(
Color.DarkGray, Color.DarkGray,
start = Offset(x = xStart, y = 0f), start = Offset(x = xStart, y = 0f),
@ -793,9 +854,13 @@ fun LazyVerticalGridTUO(
if (text.contains(Regex("^\\s*(ppp|pp|p|mp|mf|f|ff|fff)\\s*$"))) { if (text.contains(Regex("^\\s*(ppp|pp|p|mp|mf|f|ff|fff)\\s*$"))) {
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
} }
Text(text = text, Text(
text = text,
modifier = Modifier modifier = Modifier
.wrapContentSize(unbounded = true, align = Alignment.CenterStart,), .wrapContentSize(
unbounded = true,
align = Alignment.CenterStart
),
softWrap = false, softWrap = false,
maxLines = 1, maxLines = 1,
fontStyle = fontStyle, fontStyle = fontStyle,
@ -825,7 +890,10 @@ fun LazyVerticalGridTUO(
if (chordMap.isNotEmpty()) HarmonicAnalyzer.analyzeDegree(chordMap) else null if (chordMap.isNotEmpty()) HarmonicAnalyzer.analyzeDegree(chordMap) else null
} }
val chordName = remember(chordMap) { val chordName = remember(chordMap) {
if (chordMap.isNotEmpty()) HarmonicAnalyzer.analyzeChordName(chordMap, sharedScreenModel.songKey.value) else null if (chordMap.isNotEmpty()) HarmonicAnalyzer.analyzeChordName(
chordMap,
sharedScreenModel.songKey.value
) else null
} }
Column( Column(
@ -837,12 +905,15 @@ fun LazyVerticalGridTUO(
var currentFontSize by remember { mutableStateOf(maxFontSize) } var currentFontSize by remember { mutableStateOf(maxFontSize) }
TextButton( TextButton(
onClick = { toggleWithDegreeAndChord = !toggleWithDegreeAndChord }, onClick = { toggleWithDegreeAndChord1 = !toggleWithDegreeAndChord1 },
contentPadding = PaddingValues(0.dp), contentPadding = PaddingValues(0.dp),
modifier = Modifier.height(24.dp).fillMaxWidth() modifier = Modifier.height(24.dp).fillMaxWidth()
) { ) {
BoxWithConstraints(modifier = Modifier.fillMaxWidth()) { BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
val textToDisplay = if (toggleWithDegreeAndChord) (chordName ?: "") else (degreeName ?: "") val textToDisplay =
if (toggleWithDegreeAndChord1) (chordName
?: "") else (degreeName
?: "")
Text( Text(
text = textToDisplay, text = textToDisplay,
@ -855,7 +926,11 @@ fun LazyVerticalGridTUO(
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Visible, overflow = TextOverflow.Visible,
style = TextStyle( style = TextStyle(
color = if (!toggleWithDegreeAndChord) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.secondary.copy(red = MaterialTheme.colorScheme.secondary.red * 0.4f, green = MaterialTheme.colorScheme.secondary.green * 0.4f, blue = MaterialTheme.colorScheme.secondary.blue * 0.4f ), color = if (!toggleWithDegreeAndChord1) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.secondary.copy(
red = MaterialTheme.colorScheme.secondary.red * 0.4f,
green = MaterialTheme.colorScheme.secondary.green * 0.4f,
blue = MaterialTheme.colorScheme.secondary.blue * 0.4f
),
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontSize = currentFontSize fontSize = currentFontSize
) )
@ -870,15 +945,17 @@ fun LazyVerticalGridTUO(
measureTUOs.forEachIndexed { indexInMeasure, oneTUO -> measureTUOs.forEachIndexed { indexInMeasure, oneTUO ->
val globalIndex = (measureIndex * gridColumnCount) + indexInMeasure val globalIndex = (measureIndex * gridColumnCount) + indexInMeasure
val isActive = (globalIndex == activeRowIndex) val isActive = (globalIndex == activeRowIndex)
val isSelectedByKeyboard = (globalIndex == selectedGridIndex) val isSelectedByKeyboard = (globalIndex == selectedGridIndex1)
val myTimestamp = sharedScreenModel.tuoTimestamps.value.getOrElse(globalIndex) { 0L } val myTimestamp =
sharedScreenModel.tuoTimestamps.value.getOrElse(globalIndex) { 0L }
var menuOffset by remember { mutableStateOf(Offset.Zero) } var menuOffset by remember { mutableStateOf(Offset.Zero) }
val interactionSource = remember { MutableInteractionSource() } val interactionSource = remember { MutableInteractionSource() }
val isHovered by interactionSource.collectIsHoveredAsState() val isHovered by interactionSource.collectIsHoveredAsState()
key(oneTUO.numBlock) { key(oneTUO.numBlock) {
Box(modifier = Modifier Box(
modifier = Modifier
.width(gridWidthDp / gridColumnCount) .width(gridWidthDp / gridColumnCount)
.border( .border(
width = if (isSelectedByKeyboard && editMode) 2.dp else 0.dp, width = if (isSelectedByKeyboard && editMode) 2.dp else 0.dp,
@ -898,11 +975,11 @@ fun LazyVerticalGridTUO(
detectTapGestures( detectTapGestures(
onTap = { offset -> onTap = { offset ->
if (editMode) { if (editMode) {
selectedGridIndex = globalIndex selectedGridIndex1 = globalIndex
menuOffset = offset menuOffset = offset
selectedTUO = oneTUO selectedTUO1 = oneTUO
selectedIndex = globalIndex selectedIndex1 = globalIndex
showContextualMenu = true showContextualMenu1 = true
} else { } else {
sharedScreenModel.seekToGrid(globalIndex) sharedScreenModel.seekToGrid(globalIndex)
} }
@ -921,43 +998,47 @@ fun LazyVerticalGridTUO(
transpositionInterval = currentInterval transpositionInterval = currentInterval
) )
if (showContextualMenu && selectedIndex == globalIndex) { if (showContextualMenu1 && selectedIndex1 == globalIndex) {
Popup( Popup(
alignment = Alignment.TopStart, alignment = Alignment.TopStart,
offset = IntOffset( offset = IntOffset(
menuOffset.x.roundToInt(), menuOffset.x.roundToInt(),
menuOffset.y.roundToInt() menuOffset.y.roundToInt()
), ),
onDismissRequest = { showContextualMenu = false } onDismissRequest = { showContextualMenu1 = false }
) { ) {
ContextualMenu(onMenuItemClick = { item -> ContextualMenu(onMenuItemClick = { item ->
println("Clicked in TUO $globalIndex: $item") println("Clicked in TUO $globalIndex: $item")
showContextualMenu = false showContextualMenu1 = false
when (item) { when (item) {
"Modifier" -> { "Modifier" -> {
showEditDialog = true showEditDialog1 = true
} }
"Ajouter" -> { "Ajouter" -> {
showAddDialog = true showAddDialog1 = true
} }
"Liste" -> { "Liste" -> {
showDetailDialog = true showDetailDialog1 = true
} }
else -> { else -> {
showDetailDialog = false showDetailDialog1 = false
} }
} }
}) })
} }
} }
val currentSelected = selectedTUO val currentSelected = selectedTUO1
if ((showEditDialog || showAddDialog || showDetailDialog) && currentSelected != null && selectedIndex == globalIndex) { if ((showEditDialog1 || showAddDialog1 || showDetailDialog1) && currentSelected != null && selectedIndex1 == globalIndex) {
val canAdd = showAddDialog val canAdd = showAddDialog1
val canEdit = showEditDialog || canAdd val canEdit = showEditDialog1 || canAdd
val template = oneTUO.pTemplate.template val template = oneTUO.pTemplate.template
val expectedTemplate = template.count { it.isLetter() } == 2 && template.contains(".") val expectedTemplate =
template.count { it.isLetter() } == 2 && template.contains(".")
val fileC = sharedScreenModel.fileContent.value ?: "" val fileC = sharedScreenModel.fileContent.value ?: ""
val lines = fileC.split("\n").toMutableList() val lines = fileC.split("\n").toMutableList()
@ -968,9 +1049,11 @@ fun LazyVerticalGridTUO(
t0Idx != -1 -> { t0Idx != -1 -> {
lines[t0Idx] lines[t0Idx]
} }
u0Idx != -1 -> { u0Idx != -1 -> {
lines[u0Idx] lines[u0Idx]
} }
else -> "" else -> ""
} }
val afterU0T0 = fullLine.substringAfter("0:") val afterU0T0 = fullLine.substringAfter("0:")
@ -981,7 +1064,8 @@ fun LazyVerticalGridTUO(
val editState = TUOEditState( val editState = TUOEditState(
tuoIndex = oneTUO.firstTuoIndex, tuoIndex = oneTUO.firstTuoIndex,
notesByVoice = (0..3).associate { i -> notesByVoice = (0..3).associate { i ->
val rawNote = oneTUO.tuNotes.getOrNull(i + 1)?.toString() ?: "" val rawNote =
oneTUO.tuNotes.getOrNull(i + 1)?.toString() ?: ""
val fixedNote = autoFixNote(rawNote, template) val fixedNote = autoFixNote(rawNote, template)
i to fixedNote i to fixedNote
}, },
@ -990,7 +1074,8 @@ fun LazyVerticalGridTUO(
}.toMutableMap(), }.toMutableMap(),
templateFragment = oneTUO.pTemplate.template, templateFragment = oneTUO.pTemplate.template,
marker = listOfNotNull( marker = listOfNotNull(
oneTUO.pTemplate.markerToString().takeIf { it.isNotBlank() }, oneTUO.pTemplate.markerToString()
.takeIf { it.isNotBlank() },
oneTUO.hasHairPin()?.toString()?.takeIf { it.isNotBlank() } oneTUO.hasHairPin()?.toString()?.takeIf { it.isNotBlank() }
).joinToString(" "), ).joinToString(" "),
silentDuration = blankPrefix, silentDuration = blankPrefix,
@ -1008,26 +1093,26 @@ fun LazyVerticalGridTUO(
isEditable = canEdit, isEditable = canEdit,
canAdd = canAdd, canAdd = canAdd,
onDismiss = { onDismiss = {
showAddDialog = false showAddDialog1 = false
showDetailDialog = false showDetailDialog1 = false
showEditDialog = false showEditDialog1 = false
}, },
onSave = { newState -> onSave = { newState ->
sharedScreenModel.openTUOEditor(newState) sharedScreenModel.openTUOEditor(newState)
showAddDialog = false showAddDialog1 = false
showEditDialog = false showEditDialog1 = false
}, },
onIndexChanged = { newIndex -> onIndexChanged = { newIndex ->
selectedIndex = newIndex selectedIndex1 = newIndex
val globalList = sharedScreenModel.tuoList.value val globalList = sharedScreenModel.tuoList.value
val nextTUO = globalList.getOrNull(newIndex) val nextTUO = globalList.getOrNull(newIndex)
if (nextTUO != null) { if (nextTUO != null) {
selectedTUO = nextTUO selectedTUO1 = nextTUO
} else { } else {
showAddDialog = false showAddDialog1 = false
showDetailDialog = false showDetailDialog1 = false
showEditDialog = false showEditDialog1 = false
} }
} }
) )
@ -1079,7 +1164,12 @@ fun LazyVerticalGridTUO(
val isTooLong = textWidthDp > containerWidthDp val isTooLong = textWidthDp > containerWidthDp
val spacer = makeSpaceBetweenSyllables(textMeasurer, columnWidthDp) val spacer = makeSpaceBetweenSyllables(textMeasurer, columnWidthDp)
val (dynamicSpaceSyl, alignmentText) = spacer(syl, cleanAllTemps, syls_i, index) val (dynamicSpaceSyl, alignmentText) = spacer(
syl,
cleanAllTemps,
syls_i,
index
)
Text( Text(
text = dynamicSpaceSyl, text = dynamicSpaceSyl,
modifier = Modifier modifier = Modifier
@ -1109,12 +1199,6 @@ fun LazyVerticalGridTUO(
} }
} }
} }
}
}
}
}
}
}
@Composable @Composable
fun makeSpaceBetweenSyllables( fun makeSpaceBetweenSyllables(