ajout squelette application
This commit is contained in:
parent
4539301619
commit
9df89f1548
@ -100,15 +100,16 @@ dependencies {
|
|||||||
// Timber
|
// Timber
|
||||||
implementation(libs.timber)
|
implementation(libs.timber)
|
||||||
|
|
||||||
|
// Compose Navigation
|
||||||
implementation(libs.androidx.navigation.compose)
|
implementation(libs.androidx.navigation.compose)
|
||||||
|
|
||||||
|
|
||||||
// Tests
|
// Tests
|
||||||
testImplementation(libs.test.junit)
|
testImplementation(libs.test.junit)
|
||||||
androidTestImplementation(libs.test.junit)
|
androidTestImplementation(libs.test.junit)
|
||||||
androidTestImplementation(libs.test.espresso)
|
androidTestImplementation(libs.test.espresso)
|
||||||
androidTestImplementation(libs.test.androidx.junit)
|
androidTestImplementation(libs.test.androidx.junit)
|
||||||
|
|
||||||
|
// Kotlin serialization
|
||||||
implementation(libs.kotlin.serialization)
|
implementation(libs.kotlin.serialization)
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package fr.openium.consentium
|
package fr.openium.consentium
|
||||||
|
|
||||||
|
import DemoNavGraph
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
@ -14,7 +15,6 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import fr.openium.afu.ui.navigation.DemoNavGraph
|
|
||||||
import fr.openium.consentium.ui.theme.ConsentiumTheme
|
import fr.openium.consentium.ui.theme.ConsentiumTheme
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
package fr.openium.afu.ui.navigation
|
|
||||||
|
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package fr.openium.afu.ui.navigation
|
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|
||||||
sealed interface Destination {
|
sealed interface Destination {
|
||||||
|
|
||||||
@kotlinx.serialization.Serializable
|
@Serializable
|
||||||
data object Splash : Destination
|
data object Splash : Destination
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -2,12 +2,11 @@ package fr.openium.consentium.ui.screens.splash
|
|||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@ -25,6 +24,9 @@ fun SplashScreen(
|
|||||||
|
|
||||||
Text("Splash")
|
Text("Splash")
|
||||||
|
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
viewModel.initMain()
|
||||||
|
}
|
||||||
|
|
||||||
when (val _state = state) {
|
when (val _state = state) {
|
||||||
|
|
||||||
@ -43,8 +45,6 @@ fun SplashScreen(
|
|||||||
navigateToMain()
|
navigateToMain()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ class SplashScreenViewModel @Inject constructor(
|
|||||||
private val _state = MutableStateFlow<State>(State.Loading)
|
private val _state = MutableStateFlow<State>(State.Loading)
|
||||||
val state: StateFlow<State> = _state
|
val state: StateFlow<State> = _state
|
||||||
|
|
||||||
private fun loadMain() {
|
fun initMain() {
|
||||||
val delay = viewModelScope.launch {
|
val delay = viewModelScope.launch {
|
||||||
delay(1500L)
|
delay(1500L)
|
||||||
}
|
}
|
||||||
@ -36,8 +36,4 @@ class SplashScreenViewModel @Inject constructor(
|
|||||||
data object Loaded : State
|
data object Loaded : State
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
loadMain()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -15,8 +15,11 @@ plugins {
|
|||||||
// Agp
|
// Agp
|
||||||
alias(libs.plugins.android.library) apply false
|
alias(libs.plugins.android.library) apply false
|
||||||
|
|
||||||
|
//Hilt
|
||||||
alias(libs.plugins.hilt) apply false
|
alias(libs.plugins.hilt) apply false
|
||||||
|
|
||||||
|
|
||||||
|
//Kotlin serialization
|
||||||
alias(libs.plugins.kotlin.serialization) apply false
|
alias(libs.plugins.kotlin.serialization) apply false
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,8 +43,6 @@ matomo = "4.3"
|
|||||||
# Serialization
|
# Serialization
|
||||||
serialization = "1.7.1"
|
serialization = "1.7.1"
|
||||||
|
|
||||||
navigationCommonKtx = "2.8.2"
|
|
||||||
navigationRuntimeKtx = "2.8.2"
|
|
||||||
navigationCompose = "2.8.2"
|
navigationCompose = "2.8.2"
|
||||||
|
|
||||||
|
|
||||||
@ -82,9 +80,12 @@ material = { group = "com.google.android.material", name = "material", version.r
|
|||||||
# Matomo
|
# Matomo
|
||||||
matomo = { module = "com.github.matomo-org:matomo-sdk-android", version.ref = "matomo" }
|
matomo = { module = "com.github.matomo-org:matomo-sdk-android", version.ref = "matomo" }
|
||||||
|
|
||||||
|
# Kotlin serizalization
|
||||||
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }
|
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }
|
||||||
androidx-navigation-common-ktx = { group = "androidx.navigation", name = "navigation-common-ktx", version.ref = "navigationCommonKtx" }
|
|
||||||
androidx-navigation-runtime-ktx = { group = "androidx.navigation", name = "navigation-runtime-ktx", version.ref = "navigationRuntimeKtx" }
|
# Compose navigation
|
||||||
|
androidx-navigation-common-ktx = { group = "androidx.navigation", name = "navigation-common-ktx", version.ref = "navigationCompose" }
|
||||||
|
androidx-navigation-runtime-ktx = { group = "androidx.navigation", name = "navigation-runtime-ktx", version.ref = "navigationCompose" }
|
||||||
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
|
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
|
||||||
|
|
||||||
# Test
|
# Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user