parent
e8bf8156c5
commit
27f0a6ba4c
@ -0,0 +1,26 @@
|
|||||||
|
package sae.android.sae_2a.VM
|
||||||
|
|
||||||
|
import androidx.compose.runtime.mutableStateListOf
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import sae.android.sae_2a.data.Vocabulary
|
||||||
|
|
||||||
|
class VocabularyViewModel : ViewModel() {
|
||||||
|
private val _vocabulary = mutableStateListOf<Vocabulary>()
|
||||||
|
val vocabulary: List<Vocabulary> get() = _vocabulary
|
||||||
|
|
||||||
|
init {
|
||||||
|
loadVocabulary()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadVocabulary() {
|
||||||
|
viewModelScope.launch {
|
||||||
|
_vocabulary.add(Vocabulary("test","Auteur", hashMapOf("Fromage" to "Cheese", "Pomme" to "Apple")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addVocabulary(vocabulary: Vocabulary){
|
||||||
|
_vocabulary.add(vocabulary)
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application") version "8.2.2" apply false
|
id("com.android.application") version "8.3.1" apply false
|
||||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
#Wed Mar 13 08:54:26 CET 2024
|
#Wed Mar 13 08:54:26 CET 2024
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
Loading…
Reference in new issue