fmt
This commit is contained in:
parent
a20b894571
commit
678582b562
4 changed files with 12 additions and 19 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Question>, currentSelection: Question?) {
|
||||
fun ShowQuestionList(
|
||||
model: ModifySetViewModel,
|
||||
questions: List<Question>,
|
||||
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?,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package fr.uparis.diamantkennel.memorisationapplication.ui
|
||||
|
||||
enum class ActionHome {
|
||||
CREATION, IMPORTATION, MODIFIER, DELETION_SELECT, DELETION_DB
|
||||
}
|
||||
CREATION, IMPORTATION, DELETION_SELECT, DELETION_DB
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
|
|||
var selected = mutableStateOf<SetQuestions?>(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
|
||||
}
|
||||
|
|
Reference in a new issue