Merge branch 'main' of https://github.com/fortyup/qualinomme
commit
61e3f39705
|
@ -27,6 +27,7 @@ import androidx.compose.ui.graphics.Paint
|
|||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.*
|
||||
import androidx.compose.ui.unit.Constraints
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
@ -45,6 +46,8 @@ fun compareResults(
|
|||
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||
val scrollState = rememberLazyListState()
|
||||
val showTableAndLegend = remember { mutableStateOf(true) } // State to control the visibility of the table and legend
|
||||
val showVennDiagram = remember { mutableStateOf(false) } // State to control the visibility of the Venn diagram
|
||||
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
@ -59,7 +62,34 @@ fun compareResults(
|
|||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
// Show the table and legend only if showTableAndLegend is true
|
||||
if (showTableAndLegend.value) {
|
||||
|
||||
|
||||
val intersectionWords = mutableListOf<String>()
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
println("glossaryWords : $glossaryWordsSet")
|
||||
|
||||
for (word in codeWords) {
|
||||
if (word in glossaryWords.map { it.name }) {
|
||||
intersectionWords.add(word)
|
||||
println("inter : $word")
|
||||
}
|
||||
}
|
||||
|
||||
// Show the Venn diagram only if showTableAndLegend is false
|
||||
if (!showTableAndLegend.value && showVennDiagram.value) {
|
||||
IntersectionCircles(
|
||||
intersectionWords,
|
||||
glossaryWords,
|
||||
codeWords
|
||||
)
|
||||
} else if (!showTableAndLegend.value && !showVennDiagram.value) {
|
||||
Image(
|
||||
painter = painterResource("code.png"),
|
||||
contentDescription = "Venn diagram",
|
||||
modifier = Modifier.size(500.dp)
|
||||
)
|
||||
} else if (showTableAndLegend.value && !showVennDiagram.value) {
|
||||
commonWordsTable(glossaryWords, codeWords)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
@ -76,37 +106,51 @@ fun compareResults(
|
|||
}
|
||||
}
|
||||
|
||||
val intersectionWords = mutableListOf<String>()
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
println("glossaryWords : $glossaryWordsSet")
|
||||
|
||||
for (word in codeWords) {
|
||||
if (word in glossaryWords.map { it.name }) {
|
||||
intersectionWords.add(word)
|
||||
println("inter : $word")
|
||||
}
|
||||
}
|
||||
|
||||
// Show the Venn diagram only if showTableAndLegend is false
|
||||
if (!showTableAndLegend.value) {
|
||||
IntersectionCircles(
|
||||
intersectionWords,
|
||||
glossaryWords,
|
||||
codeWords
|
||||
)
|
||||
}
|
||||
|
||||
Column {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
Button(
|
||||
onClick = { showTableAndLegend.value = !showTableAndLegend.value }, // Toggle the value of showTableAndLegend when the button is clicked
|
||||
onClick = {
|
||||
showTableAndLegend.value = false
|
||||
showVennDiagram.value = true
|
||||
}, // Toggle the value of showTableAndLegend when the button is clicked
|
||||
colors = androidx.compose.material.ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(if (showTableAndLegend.value) "Montrer le diagramme de Venn" else "Montrer le tableau") // Change the button text based on the value of showTableAndLegend
|
||||
Text("Montrer le diagramme de Venn") // Change the button text based on the value of showTableAndLegend
|
||||
}
|
||||
|
||||
Button(
|
||||
onClick = { showTableAndLegend.value = true
|
||||
showVennDiagram.value = false},
|
||||
colors = androidx.compose.material.ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Montrer le tableau")
|
||||
}
|
||||
|
||||
Button(
|
||||
onClick = { showTableAndLegend.value = false
|
||||
showVennDiagram.value = false},
|
||||
colors = androidx.compose.material.ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Montrer le diagramme")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Button(
|
||||
onClick = onBackClick,
|
||||
colors = androidx.compose.material.ButtonDefaults.buttonColors(
|
||||
|
|
Loading…
Reference in New Issue