diff --git a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/HomeScreen.kt b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/HomeScreen.kt index e5f7646..91acf05 100644 --- a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/HomeScreen.kt +++ b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/HomeScreen.kt @@ -200,14 +200,14 @@ fun ImportDialog( val (selectedOption, onOptionSelected) = remember { mutableStateOf(ActionImport.FILE) } var lien by remember { mutableStateOf("") } - var ctx = LocalContext.current + val ctx = LocalContext.current val filePickerLauncher = rememberLauncherForActivityResult( ActivityResultContracts.StartActivityForResult() ) { result -> if (result.resultCode == Activity.RESULT_OK) { val uri = result.data?.data - lien = uri?.let { it.toString() } ?: lien + lien = uri?.toString() ?: lien } } diff --git a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ModifySetScreen.kt b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ModifySetScreen.kt index 948e5bf..22e1600 100644 --- a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ModifySetScreen.kt +++ b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ModifySetScreen.kt @@ -66,7 +66,7 @@ fun ModifySetScreen( modifier = Modifier.padding(padding), horizontalAlignment = Alignment.CenterHorizontally ) { - showList(model, questions, currentSelection) + ShowQuestionList(model, questions, currentSelection) Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) { Button( @@ -93,19 +93,23 @@ fun ModifySetScreen( } @Composable -fun showList(model: ModifySetViewModel, questions: List, currentSelection: Question?) { +fun ShowQuestionList( + model: ModifySetViewModel, + questions: List, + currentSelection: Question? +) { LazyColumn( Modifier.fillMaxHeight(0.6f) ) { itemsIndexed(questions) { index, item -> - listItem(index, item, currentSelection, model::updateSelection) + ListItem(index, item, currentSelection, model::updateSelection) } } } @OptIn(ExperimentalMaterial3Api::class) @Composable -fun listItem( +fun ListItem( index: Int, question: Question, currentSelection: Question?, diff --git a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/ActionHome.kt b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/ActionHome.kt index 3c2a273..656e2cc 100644 --- a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/ActionHome.kt +++ b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/ActionHome.kt @@ -1,5 +1,5 @@ package fr.uparis.diamantkennel.memorisationapplication.ui enum class ActionHome { - CREATION, IMPORTATION, MODIFIER, DELETION_SELECT, DELETION_DB -} \ No newline at end of file + CREATION, IMPORTATION, DELETION_SELECT, DELETION_DB +} diff --git a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/HomeViewModel.kt b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/HomeViewModel.kt index 4229d2a..b8df88f 100644 --- a/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/HomeViewModel.kt +++ b/app/src/main/java/fr/uparis/diamantkennel/memorisationapplication/ui/HomeViewModel.kt @@ -28,7 +28,6 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { var selected = mutableStateOf(null) var creation = mutableStateOf(false) - var modification = mutableStateOf(false) var importation = mutableStateOf(false) var deletionSelect = mutableStateOf(false) var deletionDB = mutableStateOf(false) @@ -81,12 +80,6 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { importation.value = true } - ActionHome.MODIFIER -> { - if (selected.value != null) { - modification.value = true - } - } - ActionHome.DELETION_SELECT -> { if (selected.value != null) { deletionSelect.value = true @@ -133,10 +126,6 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { deletionDB.value = false } - fun dismissModification() { - modification.value = false - } - fun dismissImportation() { importation.value = false }