final language
parent
39de56a91b
commit
04f263dbb3
|
@ -41,6 +41,7 @@ dependencies {
|
|||
testImplementation("junit:junit:4.13.1")
|
||||
implementation("org.apache.poi:poi:5.0.0")
|
||||
implementation("org.apache.poi:poi-ooxml:5.0.0")
|
||||
implementation("pl.droidsonroids.gif:android-gif-drawable:1.2.23")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment
|
|||
|
||||
@Composable
|
||||
fun compareResults(
|
||||
languageManager: LanguageManager,
|
||||
glossaryWords: List<Word>,
|
||||
codeWords: List<String>,
|
||||
onBackClick: () -> Unit,
|
||||
|
@ -64,17 +65,18 @@ fun compareResults(
|
|||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Retour")
|
||||
Text(languageManager.getBackText())
|
||||
}
|
||||
}
|
||||
dropdownButtonComponent(
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
languageManager = languageManager,
|
||||
items = listOf(languageManager.getGlossaryText(), languageManager.getCodeToVerifyText(), languageManager.getCompareText())
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
when (selectedOption) {
|
||||
"Glossaire" -> onProjectClick()
|
||||
"Code à vérifier" -> onCodeToVerifyClick()
|
||||
"Comparer" -> {
|
||||
languageManager.getGlossaryText() -> onProjectClick()
|
||||
languageManager.getCodeToVerifyText() -> onCodeToVerifyClick()
|
||||
languageManager.getCompareText() -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
return@dropdownButtonComponent
|
||||
|
|
|
@ -21,6 +21,7 @@ import main.component.dropdownButtonComponent
|
|||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun glossaryDetailedPage(
|
||||
languageManager: LanguageManager,
|
||||
glossary: List<Word>,
|
||||
glossaryName: String,
|
||||
onBackClick: () -> Unit,
|
||||
|
@ -130,13 +131,14 @@ fun glossaryDetailedPage(
|
|||
}
|
||||
}
|
||||
dropdownButtonComponent(
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
languageManager = languageManager,
|
||||
items = listOf(languageManager.getGlossaryText(), languageManager.getCodeToVerifyText(), languageManager.getCompareText())
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
when (selectedOption) {
|
||||
"Glossaire" -> onProjectClick()
|
||||
"Code à vérifier" -> onCodeToVerifyClick()
|
||||
"Comparer" -> {
|
||||
languageManager.getGlossaryText() -> onProjectClick()
|
||||
languageManager.getCodeToVerifyText() -> onCodeToVerifyClick()
|
||||
languageManager.getCompareText() -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
return@dropdownButtonComponent
|
||||
|
|
|
@ -38,6 +38,7 @@ val frame = Frame()
|
|||
|
||||
@Composable
|
||||
fun glossariesPage(
|
||||
languageManager: LanguageManager,
|
||||
currentPage: MutableState<String>,
|
||||
onProjectClick: () -> Unit,
|
||||
onCodeToVerifyClick: () -> Unit
|
||||
|
@ -52,7 +53,7 @@ fun glossariesPage(
|
|||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text("Sélectionnez un glossaire", style = MaterialTheme.typography.h5)
|
||||
Text(languageManager.getSelectGlossaryText(), style = MaterialTheme.typography.h5)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
|
@ -60,12 +61,13 @@ fun glossariesPage(
|
|||
modifier = Modifier
|
||||
.height(300.dp)
|
||||
.width(250.dp)
|
||||
.padding(10.dp)
|
||||
.padding(10.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
val scrollState = rememberLazyListState()
|
||||
glossaries = loadGlossaries(appState.selectedProject!!)
|
||||
if (glossaries.isEmpty()) {
|
||||
Text("Aucun glossaire n'a été créé pour ce projet")
|
||||
Text(languageManager.getNoGlossaryText())
|
||||
} else {
|
||||
LazyColumn(
|
||||
state = scrollState,
|
||||
|
@ -119,7 +121,7 @@ fun glossariesPage(
|
|||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
// mettre un texte "ou"
|
||||
Text("ou", style = MaterialTheme.typography.h5)
|
||||
Text(languageManager.getOuText(), style = MaterialTheme.typography.h5)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
|
||||
|
@ -134,7 +136,7 @@ fun glossariesPage(
|
|||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Créer un nouveau glossaire")
|
||||
Text(languageManager.getNewGlossaryText())
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
|
@ -150,17 +152,18 @@ fun glossariesPage(
|
|||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Retour")
|
||||
Text(languageManager.getBackText())
|
||||
}
|
||||
}
|
||||
dropdownButtonComponent(
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
languageManager = languageManager,
|
||||
items = listOf(languageManager.getGlossaryText(), languageManager.getCodeToVerifyText(), languageManager.getCompareText())
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
when (selectedOption) {
|
||||
"Glossaire" -> onProjectClick()
|
||||
"Code à vérifier" -> onCodeToVerifyClick()
|
||||
"Comparer" -> {
|
||||
languageManager.getGlossaryText() -> onProjectClick()
|
||||
languageManager.getCodeToVerifyText() -> onCodeToVerifyClick()
|
||||
languageManager.getCompareText() -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
return@dropdownButtonComponent
|
||||
|
@ -175,6 +178,7 @@ fun glossariesPage(
|
|||
@OptIn(ExperimentalStdlibApi::class, ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun newGlossary(
|
||||
languageManager: LanguageManager,
|
||||
currentPage: MutableState<String>,
|
||||
) {
|
||||
val isEmptySnackbarVisibleState = remember { mutableStateOf(false) }
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package main
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import main.component.buttonComponent
|
||||
|
@ -22,14 +24,27 @@ fun HelpPage(onBackClick: () -> Unit) {
|
|||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Text("Contenu de l'aide...")
|
||||
// Charger et afficher le premier GIF
|
||||
Image(
|
||||
painter = painterResource("1.gif"),
|
||||
contentDescription = "GIF 1",
|
||||
modifier = Modifier.size(150.dp)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
// Charger et afficher le deuxième GIF
|
||||
Image(
|
||||
painter = painterResource("2.gif"),
|
||||
contentDescription = "GIF 2",
|
||||
modifier = Modifier.size(150.dp)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
buttonComponent("OK", onBackClick)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun HelpButton(onHelpClick: () -> Unit) {
|
||||
Box(
|
||||
|
|
|
@ -112,13 +112,14 @@ fun homePage(
|
|||
|
||||
// Example usage with text options
|
||||
dropdownButtonComponent(
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
languageManager = languageManager,
|
||||
items = listOf(languageManager.getGlossaryText(), languageManager.getCodeToVerifyText(), languageManager.getCompareText())
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
when (selectedOption) {
|
||||
"Glossaire" -> onProjectClick()
|
||||
"Code à vérifier" -> onCodeToVerifyClick()
|
||||
"Comparer" -> {
|
||||
languageManager.getGlossaryText() -> onProjectClick()
|
||||
languageManager.getCodeToVerifyText() -> onCodeToVerifyClick()
|
||||
languageManager.getCompareText() -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
return@dropdownButtonComponent
|
||||
|
@ -146,6 +147,7 @@ fun homePage(
|
|||
selectedProject = null
|
||||
},
|
||||
onProjectClick = { currentPage.value = "projects" },
|
||||
languageManager = languageManager,
|
||||
onCodeToVerifyClick = { currentPage.value = "choixLangage" }
|
||||
)
|
||||
}
|
||||
|
@ -162,6 +164,7 @@ fun homePage(
|
|||
selectedProject = null
|
||||
},
|
||||
onProjectClick = { currentPage.value = "projects" },
|
||||
languageManager = languageManager,
|
||||
onCodeToVerifyClick = { currentPage.value = "choixLangage" }
|
||||
)
|
||||
}
|
||||
|
@ -169,6 +172,7 @@ fun homePage(
|
|||
isCompareClicked -> {
|
||||
selectedGlossary?.let {
|
||||
compareResults(
|
||||
languageManager = languageManager,
|
||||
glossaryWords = loadDatasFromFile(it.jsonFilePath),
|
||||
codeWords = mostUsedWordList.keys.toList(),
|
||||
onBackClick = {
|
||||
|
@ -193,6 +197,7 @@ fun homePage(
|
|||
|
||||
@Composable
|
||||
fun glossaryList(
|
||||
languageManager: LanguageManager,
|
||||
glossaries: List<Glossary>,
|
||||
onGlossarySelected: (Glossary) -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
|
@ -254,6 +259,7 @@ fun glossaryList(
|
|||
}
|
||||
|
||||
dropdownButtonComponent(
|
||||
languageManager,
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
|
@ -274,6 +280,7 @@ fun glossaryList(
|
|||
|
||||
@Composable
|
||||
fun projectList(
|
||||
languageManager: LanguageManager,
|
||||
projects: List<Project>,
|
||||
onProjectSelected: (Project) -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
|
@ -334,6 +341,7 @@ fun projectList(
|
|||
buttonComponent("Retour", onBackClick)
|
||||
}
|
||||
dropdownButtonComponent(
|
||||
languageManager,
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
|
|
|
@ -81,4 +81,139 @@ class LanguageManager {
|
|||
Language.ENGLISH -> "Back"
|
||||
}
|
||||
}
|
||||
|
||||
fun getSelectProjectText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Sélectionnez un projet"
|
||||
Language.ENGLISH -> "Select a project"
|
||||
}
|
||||
}
|
||||
|
||||
fun getNoProjectText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Aucun projet n'a été créé"
|
||||
Language.ENGLISH -> "There is no project"
|
||||
}
|
||||
}
|
||||
|
||||
fun getNewProjectText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Créer un nouveau projet"
|
||||
Language.ENGLISH -> "Create a new project"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getBackText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Retour"
|
||||
Language.ENGLISH -> "Back"
|
||||
}
|
||||
}
|
||||
|
||||
fun getMenuText(): String {
|
||||
return "Menu"
|
||||
}
|
||||
|
||||
fun getNameProjectText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Nom du projet"
|
||||
Language.ENGLISH -> "Project name"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getEnterProjectNameText(): Any {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Veuillez saisir un nom pour le projet"
|
||||
Language.ENGLISH -> "Please enter a name for the project"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getNoSpaceInProjectNameText(): Any {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Le nom du projet ne doit pas contenir d'espace"
|
||||
Language.ENGLISH -> "The project name cannot contain spaces"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getGlossaryAlreadyExistsText(): Any {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Le nom du projet existe déjà"
|
||||
Language.ENGLISH -> "The project name already exists"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getInvalidCharacterText(): Any {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Le nom du projet ne doit pas contenir les caractères suivants : / \\ : * ? \" < > |"
|
||||
Language.ENGLISH -> "The project name cannot contain the following characters: / \\ : * ? \" < > |"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getCreateProjectText(): Any {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Créer"
|
||||
Language.ENGLISH -> "Create"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getNameGlossaryText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Nom du glossaire"
|
||||
Language.ENGLISH -> "Glossary name"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getNoGlossaryText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Aucun glossaire n'a été créé"
|
||||
Language.ENGLISH -> "There is no glossary"
|
||||
}
|
||||
}
|
||||
|
||||
fun getSelectGlossaryText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Sélectionnez un glossaire"
|
||||
Language.ENGLISH -> "Select a glossary"
|
||||
}
|
||||
}
|
||||
|
||||
fun getCreateGlossaryText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Créer un nouveau glossaire"
|
||||
Language.ENGLISH -> "Create a new glossary"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getAcceuil(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Accueil"
|
||||
Language.ENGLISH -> "Home"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getNewGlossaryText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "Créer un nouveau glossaire"
|
||||
Language.ENGLISH -> "Create a new glossary"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getOuText(): String {
|
||||
return when (currentLanguage) {
|
||||
Language.FRENCH -> "ou"
|
||||
Language.ENGLISH -> "or"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ fun app() {
|
|||
|
||||
"glossaires" -> {
|
||||
glossariesPage(
|
||||
languageManager,
|
||||
currentPage = currentPage,
|
||||
onProjectClick = { currentPage.value = "projets" },
|
||||
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||
|
@ -68,20 +69,23 @@ fun app() {
|
|||
// Nouvelle page pour créer un nouveau glossaire
|
||||
"nouveauGlossaire" -> {
|
||||
newGlossary(
|
||||
languageManager,
|
||||
currentPage = currentPage,
|
||||
)
|
||||
}
|
||||
|
||||
"projects" -> {
|
||||
projectsPage(
|
||||
currentPage = currentPage,
|
||||
onProjectClick = { currentPage.value = "projects" },
|
||||
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||
languageManager = languageManager,
|
||||
currentPage = currentPage,
|
||||
)
|
||||
}
|
||||
|
||||
"nouveauProjet" ->{
|
||||
newProject(
|
||||
languageManager,
|
||||
currentPage = currentPage
|
||||
)
|
||||
}
|
||||
|
@ -114,6 +118,7 @@ fun app() {
|
|||
}
|
||||
},
|
||||
onProjectClick = { currentPage.value = "projects" },
|
||||
languageManager = languageManager,
|
||||
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||
)
|
||||
}
|
||||
|
@ -152,6 +157,7 @@ fun app() {
|
|||
}
|
||||
"occurrence" -> {
|
||||
parsedWordsTable(
|
||||
languageManager,
|
||||
mostUsedWordList,
|
||||
onBackClick = { currentPage.value = "choixLangage" },
|
||||
onProjectClick = { currentPage.value = "projects" },
|
||||
|
|
|
@ -29,6 +29,7 @@ fun loadProjects(): List<Project> {
|
|||
|
||||
@Composable
|
||||
fun projectsPage(
|
||||
languageManager: LanguageManager,
|
||||
currentPage: MutableState<String>,
|
||||
onProjectClick: () -> Unit,
|
||||
onCodeToVerifyClick: () -> Unit
|
||||
|
@ -45,6 +46,7 @@ fun projectsPage(
|
|||
) {
|
||||
|
||||
Text("Sélectionnez un projet", style = MaterialTheme.typography.h5)
|
||||
Text(languageManager.getSelectProjectText(), style = MaterialTheme.typography.h5)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
|
@ -52,12 +54,13 @@ fun projectsPage(
|
|||
modifier = Modifier
|
||||
.height(300.dp)
|
||||
.width(250.dp)
|
||||
.padding(10.dp)
|
||||
.padding(10.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
val scrollState = rememberLazyListState()
|
||||
projects = loadProjects()
|
||||
if (projects.isEmpty()) {
|
||||
Text("Aucun proje n'a été créé")
|
||||
Text(languageManager.getNoProjectText())
|
||||
} else {
|
||||
LazyColumn(
|
||||
state = scrollState,
|
||||
|
@ -122,7 +125,7 @@ fun projectsPage(
|
|||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Créer un nouveau projet")
|
||||
Text(languageManager.getNewProjectText())
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
|
@ -138,17 +141,18 @@ fun projectsPage(
|
|||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Retour")
|
||||
Text(languageManager.getBackText())
|
||||
}
|
||||
}
|
||||
dropdownButtonComponent(
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
languageManager = languageManager,
|
||||
items = listOf(languageManager.getGlossaryText(), languageManager.getCodeToVerifyText(), languageManager.getCompareText())
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
when (selectedOption) {
|
||||
"Glossaire" -> onProjectClick()
|
||||
"Code à vérifier" -> onCodeToVerifyClick()
|
||||
"Comparer" -> {
|
||||
languageManager.getGlossaryText() -> onProjectClick()
|
||||
languageManager.getCodeToVerifyText() -> onCodeToVerifyClick()
|
||||
languageManager.getCompareText() -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
return@dropdownButtonComponent
|
||||
|
@ -163,6 +167,7 @@ fun projectsPage(
|
|||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun newProject(
|
||||
languageManager: LanguageManager,
|
||||
currentPage: MutableState<String>
|
||||
){
|
||||
var projectName by remember { mutableStateOf("") }
|
||||
|
@ -177,7 +182,7 @@ fun newProject(
|
|||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
){
|
||||
Text("Nom du projet", style = MaterialTheme.typography.h5)
|
||||
Text(languageManager.getNameProjectText(), style = MaterialTheme.typography.h5)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
val projectsList = loadProjects()
|
||||
|
@ -186,7 +191,7 @@ fun newProject(
|
|||
value = projectName,
|
||||
singleLine = true,
|
||||
onValueChange = { projectName = it },
|
||||
label = { Text("Nom du projet") },
|
||||
label = { Text(languageManager.getNameProjectText()) },
|
||||
colors = TextFieldDefaults.textFieldColors(
|
||||
focusedIndicatorColor = customRedColor,
|
||||
unfocusedIndicatorColor = Color.Gray,
|
||||
|
@ -198,16 +203,16 @@ fun newProject(
|
|||
.onKeyEvent { event ->
|
||||
if (event.key == Key.Enter && event.type == KeyEventType.KeyDown) {
|
||||
if (projectName.isEmpty()) {
|
||||
println("Veuillez saisir un nom pour le nouveau projet")
|
||||
println(languageManager.getEnterProjectNameText())
|
||||
isEmptySnackbarVisibleState.value = true
|
||||
} else if (projectName.contains(" ")) {
|
||||
println("Le nom du projet ne doit pas contenir d'espace")
|
||||
println(languageManager.getNoSpaceInProjectNameText())
|
||||
containsSpaceSnackbarVisibleState.value = true
|
||||
} else if (projectsList.any { it.name == projectName }) {
|
||||
println("Le nom du projet existe déjà")
|
||||
println(languageManager.getGlossaryAlreadyExistsText())
|
||||
glossaryAlreadyExistsSnackbarVisibleState.value = true
|
||||
} else if (!isValidFileName(projectName)) {
|
||||
println("Le nom du projet contient des caractères non autorisés")
|
||||
println(languageManager.getInvalidCharacterText())
|
||||
invalidCharacterSnackbarVisibleState.value = true
|
||||
} else {
|
||||
val directory = File("src/main/resources/projects/$projectName/")
|
||||
|
@ -227,16 +232,16 @@ fun newProject(
|
|||
Button(
|
||||
onClick = {
|
||||
if (projectName.isEmpty()) {
|
||||
println("Veuillez saisir un nom pour le nouveau projet")
|
||||
println(languageManager.getEnterProjectNameText())
|
||||
isEmptySnackbarVisibleState.value = true
|
||||
} else if (projectName.contains(" ")) {
|
||||
println("Le nom du projet ne doit pas contenir d'espace")
|
||||
println(languageManager.getNoSpaceInProjectNameText())
|
||||
containsSpaceSnackbarVisibleState.value = true
|
||||
} else if (projectsList.any { it.name == projectName }) {
|
||||
println("Le nom du projet existe déjà")
|
||||
println(languageManager.getGlossaryAlreadyExistsText())
|
||||
glossaryAlreadyExistsSnackbarVisibleState.value = true
|
||||
} else if (!isValidFileName(projectName)) {
|
||||
println("Le nom du projet contient des caractères non autorisés")
|
||||
println(languageManager.getInvalidCharacterText())
|
||||
invalidCharacterSnackbarVisibleState.value = true
|
||||
} else {
|
||||
val directory = File("src/main/resources/projects/$projectName/")
|
||||
|
@ -252,7 +257,7 @@ fun newProject(
|
|||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Créer")
|
||||
Text(languageManager.getCreateProjectText().toString())
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
|
@ -268,7 +273,7 @@ fun newProject(
|
|||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Retour")
|
||||
Text(languageManager.getBackText())
|
||||
}
|
||||
|
||||
if (isEmptySnackbarVisibleState.value) {
|
||||
|
@ -286,7 +291,7 @@ fun newProject(
|
|||
}
|
||||
}
|
||||
) {
|
||||
Text("Veuillez entrer un nom de projet.")
|
||||
Text(languageManager.getEnterProjectNameText().toString())
|
||||
}
|
||||
}
|
||||
if (containsSpaceSnackbarVisibleState.value) {
|
||||
|
@ -304,7 +309,7 @@ fun newProject(
|
|||
}
|
||||
}
|
||||
) {
|
||||
Text("Veuillez ne pas mettre d'espace dans le nom du projet.")
|
||||
Text(languageManager.getNoSpaceInProjectNameText().toString())
|
||||
}
|
||||
}
|
||||
if (glossaryAlreadyExistsSnackbarVisibleState.value) {
|
||||
|
@ -322,7 +327,7 @@ fun newProject(
|
|||
}
|
||||
}
|
||||
) {
|
||||
Text("Ce projet existe déjà.")
|
||||
Text(languageManager.getGlossaryAlreadyExistsText().toString())
|
||||
}
|
||||
}
|
||||
if (invalidCharacterSnackbarVisibleState.value) {
|
||||
|
@ -340,7 +345,7 @@ fun newProject(
|
|||
}
|
||||
}
|
||||
) {
|
||||
Text("Le nom du projet contient des caractères non autorisés (caractères spéciaux).")
|
||||
Text(languageManager.getInvalidCharacterText().toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,13 +120,14 @@ fun choixLangagePage(
|
|||
}
|
||||
}
|
||||
dropdownButtonComponent(
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
languageManager = languageManager,
|
||||
items = listOf(languageManager.getGlossaryText(), languageManager.getCodeToVerifyText(), languageManager.getCompareText())
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
when (selectedOption) {
|
||||
"Glossaire" -> onProjectClick()
|
||||
"Code à vérifier" -> onCodeToVerifyClick()
|
||||
"Comparer" -> {
|
||||
languageManager.getGlossaryText() -> onProjectClick()
|
||||
languageManager.getCodeToVerifyText() -> onCodeToVerifyClick()
|
||||
languageManager.getCompareText() -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
return@dropdownButtonComponent
|
||||
|
|
|
@ -8,10 +8,12 @@ import androidx.compose.runtime.*
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import main.LanguageManager
|
||||
import main.customRedColor
|
||||
|
||||
@Composable
|
||||
fun dropdownButtonComponent(
|
||||
languageManager: LanguageManager,
|
||||
modifier: Modifier = Modifier,
|
||||
items: List<String>,
|
||||
onItemSelected: (String) -> Unit
|
||||
|
|
|
@ -18,6 +18,7 @@ import main.component.dropdownButtonComponent
|
|||
|
||||
@Composable
|
||||
fun parsedWordsTable(
|
||||
languageManager: LanguageManager,
|
||||
parsedWords: Map<String, Int>,
|
||||
onBackClick: () -> Unit,
|
||||
onProjectClick: () -> Unit,
|
||||
|
@ -64,13 +65,14 @@ fun parsedWordsTable(
|
|||
}
|
||||
}
|
||||
dropdownButtonComponent(
|
||||
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||
languageManager = languageManager,
|
||||
items = listOf(languageManager.getGlossaryText(), languageManager.getCodeToVerifyText(), languageManager.getCompareText())
|
||||
) { selectedOption ->
|
||||
// Handle the selected option
|
||||
when (selectedOption) {
|
||||
"Glossaire" -> onProjectClick()
|
||||
"Code à vérifier" -> onCodeToVerifyClick()
|
||||
"Comparer" -> {
|
||||
languageManager.getGlossaryText() -> onProjectClick()
|
||||
languageManager.getCodeToVerifyText() -> onCodeToVerifyClick()
|
||||
languageManager.getCompareText() -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
return@dropdownButtonComponent
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.4 MiB |
Binary file not shown.
After Width: | Height: | Size: 4.7 MiB |
Loading…
Reference in New Issue