Good update

This commit is contained in:
Mathieu Sanchez 2020-04-18 10:15:02 +02:00
parent b95692bdf3
commit 28e348c194
4 changed files with 9 additions and 8 deletions

View File

@ -39,6 +39,7 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "1.8"
} }
@ -52,11 +53,11 @@ dependencies {
implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-fragment:2.2.1' implementation 'androidx.navigation:navigation-fragment:2.2.1'
implementation 'androidx.navigation:navigation-ui:2.2.1' implementation 'androidx.navigation:navigation-ui:2.2.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'
// Room // Room
// implementation 'androidx.room:room-runtime:2.2.5' // implementation 'androidx.room:room-runtime:2.2.5'

View File

@ -25,5 +25,4 @@ class MainActivity : AppCompatActivity() {
navView.setBackgroundColor(resources.getColor(R.color.itemBackground, theme)) navView.setBackgroundColor(resources.getColor(R.color.itemBackground, theme))
} }
} }

View File

@ -6,12 +6,13 @@ import fr.sanchezm.attestationsCovid19.data.db.dao.ProfileDao
class MyDatabase private constructor(private val path: String) { class MyDatabase private constructor(private val path: String) {
private val _profileDao: ProfileDao? = null private var _profileDao: ProfileDao? = null
private val _attestationDao: AttestationDao? = null private var _attestationDao: AttestationDao? = null
fun profileDao() : ProfileDao = _profileDao ?: ProfileDao(path) fun profileDao(): ProfileDao = _profileDao ?: ProfileDao(path).also { _profileDao = it }
fun attestationDao() : AttestationDao = _attestationDao ?: AttestationDao(path) fun attestationDao(): AttestationDao =
_attestationDao ?: AttestationDao(path).also { _attestationDao = it }
companion object { companion object {
@Volatile @Volatile

View File

@ -1,7 +1,7 @@
package fr.sanchezm.attestationsCovid19.utilities package fr.sanchezm.attestationsCovid19.utilities
open class Event<out T>(private val content: T) { open class Event<out T>(private val content: T) {
var hasBeenHandled = false private var hasBeenHandled = false
private set private set
fun getContentIfNotHandled(): T? { fun getContentIfNotHandled(): T? {