diff --git a/app/src/main/java/fr/sanchezm/attestationsCovid19/ui/attestations/AttestationsViewModel.kt b/app/src/main/java/fr/sanchezm/attestationsCovid19/ui/attestations/AttestationsViewModel.kt index 8177937..4d277bb 100644 --- a/app/src/main/java/fr/sanchezm/attestationsCovid19/ui/attestations/AttestationsViewModel.kt +++ b/app/src/main/java/fr/sanchezm/attestationsCovid19/ui/attestations/AttestationsViewModel.kt @@ -1,5 +1,6 @@ package fr.sanchezm.attestationsCovid19.ui.attestations +import android.view.View import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel @@ -13,13 +14,23 @@ class AttestationsViewModel(attestationRepository: AttestationRepository) : View private var _attestations = attestationRepository.getAttestations() as MutableLiveData> + private var _displayNoAttestation = MutableLiveData() + val attestations: LiveData> = _attestations val startActivity: LiveData> = _startActivity + val displayNoAttestation: LiveData = + _displayNoAttestation + init { - _attestations = attestationRepository.getAttestations() as MutableLiveData> + if (_attestations.value == null || _attestations.value?.size == 0) { + _displayNoAttestation.value = View.VISIBLE + } else { + _displayNoAttestation.value = View.GONE + } } + } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_attestations.xml b/app/src/main/res/layout/fragment_attestations.xml index f2f0f47..803175b 100644 --- a/app/src/main/res/layout/fragment_attestations.xml +++ b/app/src/main/res/layout/fragment_attestations.xml @@ -29,6 +29,16 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + #RestonsChezNous Erreur lors de la génération de l\'attestation, tout les champs ne sont pas compléter Attestation générer + Aucune attestation, veuillez en générer une. Prénom