Compare commits
No commits in common. 'master' and 'travailModele' have entirely different histories.
master
...
travailMod
@ -1,63 +1,268 @@
|
|||||||
package com.example.veraxapplication
|
package com.example.veraxapplication
|
||||||
|
|
||||||
import ArticlesViewModel
|
import android.os.Build
|
||||||
import IUsersDataManager
|
|
||||||
import StubUsers
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
|
import androidx.compose.material.icons.filled.Home
|
||||||
|
import androidx.compose.material.icons.filled.Menu
|
||||||
|
import androidx.compose.material.icons.filled.Person
|
||||||
|
import androidx.compose.material3.BottomAppBar
|
||||||
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
|
import androidx.compose.material3.DropdownMenu
|
||||||
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.livedata.observeAsState
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.compose.runtime.remember
|
||||||
import com.example.veraxapplication.modele.IArticlesDataManager
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import coil.compose.rememberImagePainter
|
||||||
|
import coil.size.Scale
|
||||||
|
import com.example.veraxapplication.articles.IArticlesDataManager
|
||||||
import com.example.veraxapplication.articles.StubArticles
|
import com.example.veraxapplication.articles.StubArticles
|
||||||
import com.example.veraxapplication.modele.api.UsersViewModel
|
import com.example.veraxapplication.data.Article
|
||||||
import com.example.veraxapplication.navigation.VeraxNavHost
|
import com.example.veraxapplication.data.Paragraph
|
||||||
import com.example.veraxapplication.ui.connexion.AfficherForm
|
import com.example.veraxapplication.ui.theme.Salmon
|
||||||
import com.example.veraxapplication.ui.topBar.TopBarVerax
|
|
||||||
|
|
||||||
// doc navBar: https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#TopAppBar(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Function1,androidx.compose.foundation.layout.WindowInsets,androidx.compose.material3.TopAppBarColors,androidx.compose.material3.TopAppBarScrollBehavior)
|
// doc navBar: https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#TopAppBar(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Function1,androidx.compose.foundation.layout.WindowInsets,androidx.compose.material3.TopAppBarColors,androidx.compose.material3.TopAppBarScrollBehavior)
|
||||||
// doc compose, pleins de trucs: https://developer.android.com/jetpack/compose/text?hl=fr
|
// doc compose, pleins de trucs: https://developer.android.com/jetpack/compose/text?hl=fr
|
||||||
//doc couleur background pas finie: https://developer.android.com/jetpack/compose/components/scaffold
|
//doc couleur background pas finie: https://developer.android.com/jetpack/compose/components/scaffold
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
|
// un truc vite fait pour avoir un visi
|
||||||
|
// var article = listOf("Thinkerview", "thinkerview.jgp", "Thinkerview est une chaîne youtube d'interview-débat")
|
||||||
|
// var articles = listOf( Article("Thinkerview", "This is a descrition", Author = "IAmAGreatAuthor", Image = "https://www.gstatic.com/webp/gallery/1.jpg", LectureTime = "12", Content = listOf(Paragraph("This is a paragraph"), Paragraph("This is another paragraph"), Paragraph("This is a third paragraph"))))
|
||||||
|
|
||||||
|
var dataManager: IArticlesDataManager = StubArticles()
|
||||||
|
var articles = dataManager.getDerniersArticles(4)
|
||||||
|
|
||||||
|
|
||||||
|
var theme = listOf("Economique", "Culture", "Politique", "Faits divers")
|
||||||
|
var color = Color(0xFF00FF00)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContent {
|
setContent {
|
||||||
VeraxContent()
|
|
||||||
}
|
// articles?.forEach({ a -> println(a)})
|
||||||
|
|
||||||
|
articles?.forEach({ a ->
|
||||||
|
Log.println(Log.ASSERT, "debug articles", a.toString())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Il faudrait mettre ca dans un fichier appart mais je connais plus les conventions ...
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun VeraxContent() {
|
fun TopBarVerax(theme: List<String>, article: List<Article>) {
|
||||||
|
var leMenu by remember {
|
||||||
|
mutableStateOf(false)
|
||||||
|
}
|
||||||
|
Row() {
|
||||||
|
Scaffold(
|
||||||
|
topBar = {
|
||||||
|
CenterAlignedTopAppBar(
|
||||||
|
title = {
|
||||||
|
Text(
|
||||||
|
text = "Verax",
|
||||||
|
style = TextStyle(fontSize = 35.sp),
|
||||||
|
color = colorResource(R.color.red),
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
/*backcolor = topAppBarColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.primaryContainer),*/ //version recommandée par le prof
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
},
|
||||||
|
navigationIcon = {
|
||||||
|
IconButton(onClick = { /* action() */ }) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.ArrowBack,
|
||||||
|
contentDescription = "Retour",
|
||||||
|
Modifier.size(30.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
IconButton(onClick = { leMenu = !leMenu }) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Menu,
|
||||||
|
contentDescription = "Menu",
|
||||||
|
Modifier.size(35.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
DropdownMenu(
|
||||||
|
expanded = leMenu, onDismissRequest = { leMenu = false },
|
||||||
|
modifier = Modifier
|
||||||
|
.background(Color.hsl(0.08F, 1F, 0.96F))
|
||||||
|
) {
|
||||||
|
theme.sorted().forEach {
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = {
|
||||||
|
Text(
|
||||||
|
it,
|
||||||
|
style = TextStyle(fontSize = 25.sp),
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(10.dp)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = { /* faut un moyen d'appeler une methode diff pour chaque, ca doit etre faisable facilement */ }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
|
},
|
||||||
|
bottomBar = {
|
||||||
|
// Faudrait pouvoir faire un flex sur les boutons parce que là ils sont juste côte à côte
|
||||||
|
BottomAppBar(containerColor = Color.Black, contentColor = Color.White) {
|
||||||
|
IconButton(onClick = { /*TODO*/ }) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Home,
|
||||||
|
contentDescription = "Home",
|
||||||
|
Modifier.size(35.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
IconButton(onClick = { /*TODO*/ }) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Person,
|
||||||
|
contentDescription = "Account",
|
||||||
|
Modifier.size(35.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) { innerPadding ->
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(innerPadding),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
) {
|
||||||
|
AffichageUnArticle(article = article)
|
||||||
|
|
||||||
// Initialiser les données ou observer les données du ViewModel
|
}
|
||||||
var dataManager: IArticlesDataManager = StubArticles()
|
}
|
||||||
var articles = dataManager.getDerniersArticles(4)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var usersManager: IUsersDataManager = StubUsers()
|
|
||||||
var users = usersManager.getUsers();
|
|
||||||
|
|
||||||
// Observer les données du ViewModel
|
@Composable
|
||||||
val articlesViewModel: ArticlesViewModel = viewModel()
|
fun AffichageUnArticle(article: List<Article>) {
|
||||||
|
Column() {
|
||||||
|
for (e in article) {
|
||||||
|
DisplayTitle(title = e.Title)
|
||||||
|
DisplayHeader(
|
||||||
|
author = e.Author,
|
||||||
|
description = e.Description,
|
||||||
|
lectureTime = e.LectureTime
|
||||||
|
)
|
||||||
|
DisplayImage(image = e.Image)
|
||||||
|
DisplayContentArticle(content = e.Content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Observez les articles du ViewModel
|
@Composable
|
||||||
val articlesApi by articlesViewModel.articles.observeAsState(initial = articles)
|
fun DisplayImage(image: String) {
|
||||||
|
Log.d("DisplayImage", "Chargement de l'image à partir de l'URL : $image")
|
||||||
|
|
||||||
val usersViewModel: UsersViewModel = viewModel()
|
val painter = rememberImagePainter(
|
||||||
|
data = image,
|
||||||
|
builder = {
|
||||||
|
scale(Scale.FILL)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
val usersApi by usersViewModel.users.observeAsState(initial = users)
|
Log.d("DisplayImage", "Painter créé avec succès")
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
androidx.compose.foundation.Image(
|
||||||
|
painter = painter,
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var theme = listOf("Economique", "Culture", "Politique", "Faits divers")
|
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DisplayHeader(author: String, description: String, lectureTime: String) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.border(width = 1.dp, color = Color.Black, shape = RoundedCornerShape(10.dp))
|
||||||
|
.clip(RoundedCornerShape(10.dp))
|
||||||
|
.background(Salmon)
|
||||||
|
.padding(10.dp)
|
||||||
|
) {
|
||||||
|
Column() {
|
||||||
|
Text(text = author)
|
||||||
|
Text(text = description)
|
||||||
|
Text(text = "Lecture Time: " + lectureTime + " minutes")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TopBarVerax(articles = articlesApi, theme = theme, articlesStub= articles)
|
@Composable
|
||||||
|
fun DisplayTitle(title: String) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
Text(text = title, fontFamily = FontFamily.Serif, fontSize = 30.sp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DisplayContentArticle(content: List<Paragraph>) {
|
||||||
|
Column {
|
||||||
|
for (e in content) {
|
||||||
|
Text(
|
||||||
|
text = e.Content,
|
||||||
|
fontSize = 15.sp,
|
||||||
|
fontFamily = FontFamily.Serif,
|
||||||
|
textAlign = TextAlign.Justify,
|
||||||
|
modifier = Modifier.padding(10.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.example.veraxapplication.data
|
package com.example.veraxapplication.data
|
||||||
/*
|
|
||||||
data class Paragraph(
|
data class Paragraph(
|
||||||
var Content : String,
|
var Content : String,
|
||||||
)
|
)
|
||||||
*/
|
|
@ -1,9 +0,0 @@
|
|||||||
import com.example.veraxapplication.modele.user.User
|
|
||||||
|
|
||||||
|
|
||||||
interface IUsersDataManager {
|
|
||||||
val allUsers: List<Any?>?
|
|
||||||
|
|
||||||
fun getUser(pseudo : String): User?
|
|
||||||
fun getUsers(): List<User>
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package com.example.veraxapplication.modele.api
|
|
||||||
|
|
||||||
import com.example.veraxapplication.modele.articles.Article
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
data class ArticleDTO (
|
|
||||||
|
|
||||||
@SerializedName("id")
|
|
||||||
val id: Int,
|
|
||||||
@SerializedName("titre")
|
|
||||||
val titre: String,
|
|
||||||
@SerializedName("description")
|
|
||||||
val description: String,
|
|
||||||
@SerializedName("temps")
|
|
||||||
val temps: String,
|
|
||||||
@SerializedName("date")
|
|
||||||
val date: String,
|
|
||||||
@SerializedName("auteur")
|
|
||||||
val auteur: String,
|
|
||||||
@SerializedName("categorie")
|
|
||||||
val categorie: String,
|
|
||||||
@SerializedName("imagePrincipale")
|
|
||||||
val imagePrincipale: String,
|
|
||||||
@SerializedName("note")
|
|
||||||
val note: String,
|
|
||||||
) {
|
|
||||||
fun toModel(): Article {
|
|
||||||
return Article(
|
|
||||||
id,
|
|
||||||
titre,
|
|
||||||
description,
|
|
||||||
temps,
|
|
||||||
date,
|
|
||||||
auteur,
|
|
||||||
categorie,
|
|
||||||
imagePrincipale,
|
|
||||||
note,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data class ContenuDTO (
|
|
||||||
@SerializedName("id")
|
|
||||||
val id: Int,
|
|
||||||
@SerializedName("typeContenu")
|
|
||||||
val typeContenu: String,
|
|
||||||
@SerializedName("titre")
|
|
||||||
val titre: String,
|
|
||||||
@SerializedName("texte")
|
|
||||||
val texte: String,
|
|
||||||
)
|
|
@ -1,54 +0,0 @@
|
|||||||
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import com.example.veraxapplication.modele.api.IArticleService
|
|
||||||
import com.example.veraxapplication.modele.articles.Article
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
|
||||||
import retrofit2.Retrofit
|
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
|
||||||
|
|
||||||
object ArticleApiClient {
|
|
||||||
private const val BASE_URL = "http://181.214.189.133:9092/"
|
|
||||||
|
|
||||||
private val logging = HttpLoggingInterceptor().apply {
|
|
||||||
level = HttpLoggingInterceptor.Level.BODY
|
|
||||||
}
|
|
||||||
|
|
||||||
private val httpClient = OkHttpClient.Builder().apply {
|
|
||||||
addInterceptor(logging)
|
|
||||||
}.build()
|
|
||||||
|
|
||||||
val retrofit: Retrofit = Retrofit.Builder()
|
|
||||||
.baseUrl(BASE_URL)
|
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
|
||||||
.client(httpClient)
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
class ArticlesViewModel : ViewModel() {
|
|
||||||
private val _articles = MutableLiveData<List<Article>>()
|
|
||||||
val articles: LiveData<List<Article>> = _articles
|
|
||||||
|
|
||||||
private val service = ArticleApiClient.retrofit.create(IArticleService::class.java)
|
|
||||||
|
|
||||||
init {
|
|
||||||
loadArticles()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadArticles() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
try {
|
|
||||||
val articlesDto = service.getArticles() // Pas besoin d'appeler .execute()
|
|
||||||
// Convertissez les DTO en modèles de données si nécessaire
|
|
||||||
_articles.value = articlesDto.map { it.toModel() }
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("ArticlesViewModel", "Erreur lors du chargement des articles", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.example.veraxapplication.modele.api
|
|
||||||
|
|
||||||
import retrofit2.http.GET
|
|
||||||
|
|
||||||
interface IArticleService {
|
|
||||||
@GET("articles")
|
|
||||||
suspend fun getArticles(): List<ArticleDTO>
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.example.veraxapplication.modele.api
|
|
||||||
|
|
||||||
import com.example.veraxapplication.modele.user.User
|
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.http.GET
|
|
||||||
|
|
||||||
interface IUserService {
|
|
||||||
@GET("users")
|
|
||||||
suspend fun getUsers(): List<UserDTO>
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package com.example.veraxapplication.modele.api
|
|
||||||
|
|
||||||
import com.example.veraxapplication.modele.user.User
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
data class UserDTO (
|
|
||||||
|
|
||||||
@SerializedName("pseudo")
|
|
||||||
val pseudo: String,
|
|
||||||
@SerializedName("mdp")
|
|
||||||
val mdp: String,
|
|
||||||
@SerializedName("mail")
|
|
||||||
val mail: String,
|
|
||||||
@SerializedName("nom")
|
|
||||||
val nom: String,
|
|
||||||
@SerializedName("prenom")
|
|
||||||
val prenom: String,
|
|
||||||
@SerializedName("role")
|
|
||||||
val role: String,
|
|
||||||
|
|
||||||
) {
|
|
||||||
fun toModel(): User {
|
|
||||||
return User(
|
|
||||||
pseudo,
|
|
||||||
mdp,
|
|
||||||
mail,
|
|
||||||
nom,
|
|
||||||
prenom,
|
|
||||||
role,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
package com.example.veraxapplication.modele.api
|
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import com.example.veraxapplication.modele.articles.Article
|
|
||||||
import com.example.veraxapplication.modele.user.User
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
|
||||||
import retrofit2.Retrofit
|
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
|
||||||
|
|
||||||
object RetrofitClientUser {
|
|
||||||
|
|
||||||
private const val BASE_URL = "https://codefirst.iut.uca.fr/containers/Verax-verax-api"
|
|
||||||
|
|
||||||
private val logging = HttpLoggingInterceptor().apply {
|
|
||||||
level = HttpLoggingInterceptor.Level.BODY
|
|
||||||
}
|
|
||||||
|
|
||||||
private val httpClient = OkHttpClient.Builder().apply {
|
|
||||||
addInterceptor(logging)
|
|
||||||
}.build()
|
|
||||||
|
|
||||||
|
|
||||||
val retrofit: Retrofit by lazy {
|
|
||||||
Retrofit.Builder()
|
|
||||||
.baseUrl(BASE_URL)
|
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
// interface UserApiService {
|
|
||||||
// @GET("users")
|
|
||||||
// suspend fun getUsers() : List<User>
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
class UsersViewModel : ViewModel() {
|
|
||||||
private val _users = MutableLiveData<List<User>>()
|
|
||||||
val users: LiveData<List<User>> = _users
|
|
||||||
|
|
||||||
private val service = ArticleApiClient.retrofit.create(IUserService::class.java)
|
|
||||||
|
|
||||||
init {
|
|
||||||
loadUsers()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadUsers() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
try {
|
|
||||||
val usersDto = service.getUsers() // Pas besoin d'appeler .execute()
|
|
||||||
// Convertissez les DTO en modèles de données si nécessaire
|
|
||||||
_users.value = usersDto.map { it.toModel() }
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("UsersViewModel", "Erreur lors du chargement des users", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
|
|
||||||
import com.example.veraxapplication.modele.IArticlesDataManager
|
|
||||||
import com.example.veraxapplication.modele.articles.Article
|
|
||||||
import com.example.veraxapplication.modele.articles.contenus.Contenu
|
|
||||||
import com.example.veraxapplication.modele.articles.contenus.ContenuMedia
|
|
||||||
import com.example.veraxapplication.modele.articles.contenus.ContenuParagraphe
|
|
||||||
import com.example.veraxapplication.modele.user.User
|
|
||||||
|
|
||||||
|
|
||||||
class StubUsers() : IUsersDataManager {
|
|
||||||
private var lUsers: MutableList<User>? = null
|
|
||||||
|
|
||||||
init {
|
|
||||||
chargerUsers()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun chargerUsers() {
|
|
||||||
lUsers = java.util.ArrayList<User>()
|
|
||||||
val user1 = User (
|
|
||||||
"NoaSil",
|
|
||||||
"1234",
|
|
||||||
"",
|
|
||||||
"Sillard",
|
|
||||||
"Noa",
|
|
||||||
"Admin"
|
|
||||||
)
|
|
||||||
lUsers!!.add(user1)
|
|
||||||
val user2 = User (
|
|
||||||
"Sha",
|
|
||||||
"1234",
|
|
||||||
"",
|
|
||||||
"Cascarra",
|
|
||||||
"Shana",
|
|
||||||
"Admin"
|
|
||||||
)
|
|
||||||
lUsers!!.add(user2)
|
|
||||||
val user3 = User (
|
|
||||||
"TonyF",
|
|
||||||
"1234",
|
|
||||||
"tony@gmail.com",
|
|
||||||
"Fages",
|
|
||||||
"Tony",
|
|
||||||
"Admin"
|
|
||||||
)
|
|
||||||
lUsers!!.add(user3)
|
|
||||||
val user4 = User (
|
|
||||||
"JeanSwaggLaPuissance63",
|
|
||||||
"1234",
|
|
||||||
"jean.lapuissance@gmail.com",
|
|
||||||
"Marcillac",
|
|
||||||
"Jean",
|
|
||||||
"Admin"
|
|
||||||
)
|
|
||||||
lUsers!!.add(user4)
|
|
||||||
}
|
|
||||||
|
|
||||||
override val allUsers: List<User>?
|
|
||||||
get() = lUsers
|
|
||||||
|
|
||||||
override fun getUser(pseudo : String): User? {
|
|
||||||
println("Passage dans getUser avec comme pseudo : $pseudo")
|
|
||||||
lUsers?.let {
|
|
||||||
println("Nombre d'utilisateurs disponibles : ${it.size}")
|
|
||||||
|
|
||||||
val userARenvoyer: User? = it.find { user -> user.pseudo == pseudo }
|
|
||||||
|
|
||||||
return userARenvoyer
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getUsers(): List<User>
|
|
||||||
{
|
|
||||||
return lUsers?.takeIf { it.isNotEmpty() }?.take(lUsers!!.size) ?: emptyList()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.example.veraxapplication.modele.user
|
|
||||||
|
|
||||||
data class User(val pseudo : String, val mdp : String, val mail : String, val nom : String, val prenom : String, val role : String)
|
|
@ -1,46 +0,0 @@
|
|||||||
package com.example.veraxapplication.navigation
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.navigation.NavHostController
|
|
||||||
import androidx.navigation.NavType
|
|
||||||
import androidx.navigation.compose.NavHost
|
|
||||||
import androidx.navigation.compose.composable
|
|
||||||
import androidx.navigation.compose.rememberNavController
|
|
||||||
import androidx.navigation.navArgument
|
|
||||||
import com.example.veraxapplication.modele.articles.Article
|
|
||||||
import com.example.veraxapplication.ui.article.AffichageLesArticles
|
|
||||||
import com.example.veraxapplication.ui.article.AfficherArticle
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun VeraxNavHost(articles : List<Article>, navController: NavHostController, articlesStub: List<Article>) {
|
|
||||||
|
|
||||||
|
|
||||||
NavHost(
|
|
||||||
navController = navController,
|
|
||||||
startDestination = "accueil"
|
|
||||||
){
|
|
||||||
composable(route="accueil"){
|
|
||||||
AffichageLesArticles(
|
|
||||||
articles = articles,
|
|
||||||
goToArticle = {
|
|
||||||
navController.navigate("article/${it.id}")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
composable(
|
|
||||||
route="article/{articleid}",
|
|
||||||
arguments= listOf(navArgument("articleid"){ type= NavType.IntType})
|
|
||||||
){
|
|
||||||
it.arguments?.getInt("articleid")?.let { articleid ->
|
|
||||||
articlesStub.find { it.id == articleid }?.let {
|
|
||||||
AfficherArticle(
|
|
||||||
e = it
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,189 +0,0 @@
|
|||||||
package com.example.veraxapplication.ui.article
|
|
||||||
|
|
||||||
import VideoPlayer
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.compose.foundation.BorderStroke
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.border
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.foundation.layout.wrapContentWidth
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.Button
|
|
||||||
import androidx.compose.material3.ButtonDefaults
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.layout.ContentScale
|
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import coil.compose.rememberImagePainter
|
|
||||||
import com.example.veraxapplication.modele.articles.Article
|
|
||||||
import com.example.veraxapplication.modele.articles.contenus.Contenu
|
|
||||||
import com.example.veraxapplication.modele.articles.contenus.ContenuMedia
|
|
||||||
import com.example.veraxapplication.modele.articles.contenus.ContenuParagraphe
|
|
||||||
import com.example.veraxapplication.ui.theme.Salmon
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun AffichageLesArticles(articles : List<Article>, goToArticle: (Article) -> Unit){
|
|
||||||
Column(modifier = Modifier.verticalScroll(rememberScrollState())){
|
|
||||||
for(article in articles){
|
|
||||||
Box {
|
|
||||||
AffichageUnArticleInfo(e = article, goToArticle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun AffichageUnArticleInfo(e : Article, goToArticle: (Article) -> Unit){
|
|
||||||
Column(modifier = Modifier
|
|
||||||
.padding(7.dp)
|
|
||||||
.border(width = 1.dp, color = Color.Black, shape = RoundedCornerShape(10.dp))
|
|
||||||
.padding(5.dp)) {
|
|
||||||
|
|
||||||
Text(text = e.titre, fontFamily = FontFamily.Serif, fontSize = 30.sp)
|
|
||||||
|
|
||||||
Box(modifier = Modifier
|
|
||||||
.padding(15.dp)
|
|
||||||
.border(width = 1.dp, color = Color.Black, shape = RoundedCornerShape(10.dp))
|
|
||||||
.clip(RoundedCornerShape(10.dp))
|
|
||||||
.background(Salmon)
|
|
||||||
) {
|
|
||||||
Column (modifier = Modifier.padding(15.dp)) {
|
|
||||||
Text(text = "Auteur : "+e.auteur, fontSize = 17.sp)
|
|
||||||
Text(text = "Description : "+e.description, fontSize = 17.sp)
|
|
||||||
Text(text = "Temps de lecture : "+e.temps+" minutes", fontSize = 17.sp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Image(
|
|
||||||
painter = rememberImagePainter(
|
|
||||||
data = e.imagePrincipale
|
|
||||||
),
|
|
||||||
contentScale = ContentScale.Crop,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier
|
|
||||||
.size(350.dp)
|
|
||||||
.align(Alignment.CenterHorizontally)
|
|
||||||
.padding(5.dp, 35.dp)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
Button(onClick = { goToArticle(e)},
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = Salmon,
|
|
||||||
contentColor = Color.Black
|
|
||||||
),
|
|
||||||
border = BorderStroke(1.dp, Color.Black),
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.CenterHorizontally)
|
|
||||||
) {
|
|
||||||
Text(text = "Voir plus")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun AfficherArticle(e : Article){
|
|
||||||
Column(modifier = Modifier
|
|
||||||
.verticalScroll(rememberScrollState())
|
|
||||||
.padding(7.dp)
|
|
||||||
.padding(5.dp)) {
|
|
||||||
|
|
||||||
Text(text = e.titre, fontFamily = FontFamily.Serif, fontSize = 30.sp)
|
|
||||||
|
|
||||||
// Affichage des informations de l'article
|
|
||||||
DisplayHeader(author = e.auteur, description = e.description, lectureTime = e.temps)
|
|
||||||
|
|
||||||
|
|
||||||
Image(
|
|
||||||
painter = rememberImagePainter(
|
|
||||||
data = e.imagePrincipale
|
|
||||||
),
|
|
||||||
contentScale = ContentScale.Crop,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier
|
|
||||||
.size(350.dp)
|
|
||||||
.align(Alignment.CenterHorizontally)
|
|
||||||
.padding(5.dp, 35.dp)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
// Affichage contenus
|
|
||||||
DisplayContenu(e.lContenus)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun DisplayHeader(author: String, description: String, lectureTime: String) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(15.dp)
|
|
||||||
.border(width = 1.dp, color = Color.Black, shape = RoundedCornerShape(10.dp))
|
|
||||||
.clip(RoundedCornerShape(10.dp))
|
|
||||||
.background(Salmon)
|
|
||||||
) {
|
|
||||||
Column(modifier = Modifier.padding(15.dp)) {
|
|
||||||
Text(text = "Auteur : "+ author, fontSize = 17.sp)
|
|
||||||
Text(text = "Description : "+ description, fontSize = 17.sp)
|
|
||||||
Text(text = "Temps de lecture : " + lectureTime + " minutes", fontSize = 17.sp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Composable
|
|
||||||
fun DisplayContenu(contenus: List<Contenu>) {
|
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
|
||||||
for (contenu in contenus) {
|
|
||||||
when (contenu) {
|
|
||||||
|
|
||||||
is ContenuMedia -> {
|
|
||||||
Log.d("Img", contenu.titre + " " + contenu.lien)
|
|
||||||
Text(text = contenu.titre, fontSize = 20.sp, fontWeight = FontWeight.Bold)
|
|
||||||
when (contenu.typeContenu) {
|
|
||||||
"image" -> {
|
|
||||||
Image(
|
|
||||||
painter = rememberImagePainter(data = contenu.lien),
|
|
||||||
contentScale = ContentScale.FillHeight,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier
|
|
||||||
.size(350.dp)
|
|
||||||
.padding(5.dp, 35.dp)
|
|
||||||
.fillMaxWidth()
|
|
||||||
.wrapContentWidth(Alignment.CenterHorizontally) // Centrer l'image
|
|
||||||
)
|
|
||||||
}
|
|
||||||
"video" -> {
|
|
||||||
Text(
|
|
||||||
text = "Ici une video ..." + contenu.toString(),
|
|
||||||
fontSize = 15.sp,
|
|
||||||
textAlign = TextAlign.Start
|
|
||||||
)
|
|
||||||
|
|
||||||
VideoPlayer(videoUrl = contenu.lien)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
is ContenuParagraphe -> {
|
|
||||||
Text(text = contenu.titre, fontSize = 20.sp, fontWeight = FontWeight.Bold)
|
|
||||||
Text(text = contenu.texte, fontSize = 16.sp, textAlign = TextAlign.Start)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
import android.view.ViewGroup
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
import androidx.compose.ui.viewinterop.AndroidView
|
|
||||||
import com.google.android.exoplayer2.ExoPlayer
|
|
||||||
import com.google.android.exoplayer2.MediaItem
|
|
||||||
import com.google.android.exoplayer2.ui.PlayerView
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun VideoPlayer(videoUrl : String){
|
|
||||||
val context = LocalContext.current
|
|
||||||
|
|
||||||
val player = ExoPlayer.Builder(context).build()
|
|
||||||
|
|
||||||
val playerView = PlayerView(context).apply {
|
|
||||||
layoutParams = ViewGroup.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
val mediaItem = MediaItem.Builder()
|
|
||||||
.setUri(videoUrl)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
player.setMediaItem(mediaItem)
|
|
||||||
player.prepare()
|
|
||||||
player.play()
|
|
||||||
|
|
||||||
AndroidView(
|
|
||||||
factory = { context -> playerView },
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
|
||||||
update = { view ->
|
|
||||||
view.player = player
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.example.veraxapplication.ui.connexion
|
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.material3.TextField
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import com.example.veraxapplication.modele.user.User
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun AfficherForm(users : List<User>) {
|
|
||||||
var pseudo = "DEFAULT"
|
|
||||||
var mdp = "DEFAULT"
|
|
||||||
Column {
|
|
||||||
TextField(value = "Pseudo", onValueChange = { value -> pseudo = value }, modifier = Modifier.padding(5.dp))
|
|
||||||
TextField(value = "Mot de passe", onValueChange = { value -> mdp = value }, modifier = Modifier.padding(5.dp))
|
|
||||||
for (u in users) {
|
|
||||||
Text(text = u.pseudo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
package com.example.veraxapplication.ui.topBar
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.border
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
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.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
|
||||||
import androidx.compose.material.icons.filled.Menu
|
|
||||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
|
||||||
import androidx.compose.material3.DropdownMenu
|
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.IconButton
|
|
||||||
import androidx.compose.material3.Scaffold
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.res.colorResource
|
|
||||||
import androidx.compose.ui.text.TextStyle
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
|
||||||
import androidx.navigation.compose.rememberNavController
|
|
||||||
import com.example.veraxapplication.R
|
|
||||||
import com.example.veraxapplication.modele.articles.Article
|
|
||||||
import com.example.veraxapplication.navigation.VeraxNavHost
|
|
||||||
import com.example.veraxapplication.ui.theme.Orange
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
|
||||||
fun TopBarVerax(theme: List<String>, articles: List<Article>, articlesStub : List<Article>) {
|
|
||||||
/*var leMenu by remember { mutableStateOf(false) }*/
|
|
||||||
|
|
||||||
val navController = rememberNavController()
|
|
||||||
|
|
||||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
|
||||||
|
|
||||||
Row( modifier = Modifier.background(Color.Blue).fillMaxSize()) {
|
|
||||||
Scaffold(
|
|
||||||
topBar = {
|
|
||||||
CenterAlignedTopAppBar(
|
|
||||||
title = {
|
|
||||||
Text(
|
|
||||||
//text = R.string.app_name,
|
|
||||||
text= "Verax",
|
|
||||||
style = TextStyle(fontSize = 35.sp),
|
|
||||||
color = colorResource(R.color.red),
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
)
|
|
||||||
},
|
|
||||||
navigationIcon = { if (navBackStackEntry?.destination?.route != "accueil"){
|
|
||||||
IconButton(onClick = { navController.popBackStack() }) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
|
||||||
contentDescription = "Retour",
|
|
||||||
Modifier.size(30.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}/*,
|
|
||||||
actions = {
|
|
||||||
IconButton(onClick = { leMenu = !leMenu }) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Filled.Menu,
|
|
||||||
contentDescription = "Menu",
|
|
||||||
Modifier.size(35.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
DropdownMenu(
|
|
||||||
expanded = leMenu, onDismissRequest = { leMenu = false },
|
|
||||||
modifier = Modifier
|
|
||||||
.border(
|
|
||||||
width = 1.dp,
|
|
||||||
color = Color.Black,
|
|
||||||
shape = RoundedCornerShape(10.dp)
|
|
||||||
)
|
|
||||||
.background(Orange)
|
|
||||||
) {
|
|
||||||
theme.sorted().forEach {
|
|
||||||
DropdownMenuItem(
|
|
||||||
text = {
|
|
||||||
Text(
|
|
||||||
it,
|
|
||||||
style = TextStyle(fontSize = 25.sp),
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(10.dp)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onClick = { }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) { innerPadding ->
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(innerPadding),
|
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
|
||||||
) {
|
|
||||||
|
|
||||||
VeraxNavHost(articles = articles, navController, articlesStub= articlesStub)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Verax</string>
|
<string name="app_name">VeraxApplication</string>
|
||||||
</resources>
|
</resources>
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<network-security-config>
|
|
||||||
<domain-config cleartextTrafficPermitted="true">
|
|
||||||
<domain includeSubdomains="true">181.214.189.133</domain>
|
|
||||||
<domain includeSubdomains="true">codefirst.iut.uca.fr/containers/Verax-verax-api</domain>
|
|
||||||
</domain-config>
|
|
||||||
</network-security-config>
|
|
Loading…
Reference in new issue