|
|
@ -1,6 +1,7 @@
|
|
|
|
package com.example.veraxapplication.ui.article
|
|
|
|
package com.example.veraxapplication.ui.article
|
|
|
|
|
|
|
|
|
|
|
|
import VideoPlayer
|
|
|
|
import VideoPlayer
|
|
|
|
|
|
|
|
import android.util.Log
|
|
|
|
import androidx.compose.foundation.BorderStroke
|
|
|
|
import androidx.compose.foundation.BorderStroke
|
|
|
|
import androidx.compose.foundation.Image
|
|
|
|
import androidx.compose.foundation.Image
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
import androidx.compose.foundation.background
|
|
|
@ -32,7 +33,6 @@ import com.example.veraxapplication.modele.articles.contenus.ContenuMedia
|
|
|
|
import com.example.veraxapplication.modele.articles.contenus.ContenuParagraphe
|
|
|
|
import com.example.veraxapplication.modele.articles.contenus.ContenuParagraphe
|
|
|
|
import com.example.veraxapplication.ui.theme.Salmon
|
|
|
|
import com.example.veraxapplication.ui.theme.Salmon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
fun AffichageLesArticles(articles : List<Article>, goToArticle: (Article) -> Unit){
|
|
|
|
fun AffichageLesArticles(articles : List<Article>, goToArticle: (Article) -> Unit){
|
|
|
|
Column(modifier = Modifier.verticalScroll(rememberScrollState())){
|
|
|
|
Column(modifier = Modifier.verticalScroll(rememberScrollState())){
|
|
|
@ -50,12 +50,6 @@ fun AffichageUnArticleInfo(e : Article, goToArticle: (Article) -> Unit){
|
|
|
|
.padding(7.dp)
|
|
|
|
.padding(7.dp)
|
|
|
|
.border(width = 1.dp, color = Color.Black, shape = RoundedCornerShape(10.dp))
|
|
|
|
.border(width = 1.dp, color = Color.Black, shape = RoundedCornerShape(10.dp))
|
|
|
|
.padding(5.dp)) {
|
|
|
|
.padding(5.dp)) {
|
|
|
|
/*DisplayTitle(title = e.Title)
|
|
|
|
|
|
|
|
DisplayHeader(author = e.Author, description = e.Description, lectureTime = e.LectureTime)
|
|
|
|
|
|
|
|
DisplayImage(image = e.Image)
|
|
|
|
|
|
|
|
DisplayContentArticle(content = e.Content)*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Text(text = e.titre, fontFamily = FontFamily.Serif, fontSize = 30.sp)
|
|
|
|
Text(text = e.titre, fontFamily = FontFamily.Serif, fontSize = 30.sp)
|
|
|
|
|
|
|
|
|
|
|
@ -71,6 +65,7 @@ fun AffichageUnArticleInfo(e : Article, goToArticle: (Article) -> Unit){
|
|
|
|
Text(text = "Temps de lecture : "+e.temps+" minutes", fontSize = 17.sp)
|
|
|
|
Text(text = "Temps de lecture : "+e.temps+" minutes", fontSize = 17.sp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Log.d("ImageLoad", e.toString())
|
|
|
|
Image(
|
|
|
|
Image(
|
|
|
|
painter = rememberImagePainter(
|
|
|
|
painter = rememberImagePainter(
|
|
|
|
data = e.imagePrincipale
|
|
|
|
data = e.imagePrincipale
|
|
|
@ -83,7 +78,8 @@ fun AffichageUnArticleInfo(e : Article, goToArticle: (Article) -> Unit){
|
|
|
|
.padding(5.dp, 35.dp)
|
|
|
|
.padding(5.dp, 35.dp)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
Button(onClick = { goToArticle(e) },
|
|
|
|
|
|
|
|
|
|
|
|
Button(onClick = { goToArticle(e)},
|
|
|
|
colors = ButtonDefaults.buttonColors(
|
|
|
|
colors = ButtonDefaults.buttonColors(
|
|
|
|
containerColor = Salmon,
|
|
|
|
containerColor = Salmon,
|
|
|
|
contentColor = Color.Black
|
|
|
|
contentColor = Color.Black
|
|
|
@ -98,12 +94,16 @@ fun AffichageUnArticleInfo(e : Article, goToArticle: (Article) -> Unit){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
fun AfficherArticle(e : Article){
|
|
|
|
fun AfficherArticle(e : Article) {
|
|
|
|
Column(modifier = Modifier
|
|
|
|
Column(
|
|
|
|
.verticalScroll(rememberScrollState())
|
|
|
|
modifier = Modifier
|
|
|
|
.padding(7.dp)
|
|
|
|
.verticalScroll(rememberScrollState())
|
|
|
|
.padding(5.dp)) {
|
|
|
|
.padding(7.dp)
|
|
|
|
|
|
|
|
.padding(5.dp)
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
Text(text = e.titre, fontFamily = FontFamily.Serif, fontSize = 30.sp)
|
|
|
|
Text(text = e.titre, fontFamily = FontFamily.Serif, fontSize = 30.sp)
|
|
|
|
|
|
|
|
|
|
|
@ -115,8 +115,8 @@ fun AfficherArticle(e : Article){
|
|
|
|
.background(Salmon)
|
|
|
|
.background(Salmon)
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
Column(modifier = Modifier.padding(15.dp)) {
|
|
|
|
Column(modifier = Modifier.padding(15.dp)) {
|
|
|
|
Text(text = "Auteur : "+e.auteur, fontSize = 17.sp)
|
|
|
|
Text(text = "Auteur : " + e.auteur, fontSize = 17.sp)
|
|
|
|
Text(text = "Description : "+e.description, fontSize = 17.sp)
|
|
|
|
Text(text = "Description : " + e.description, fontSize = 17.sp)
|
|
|
|
Text(text = "Temps de lecture : " + e.temps + " minutes", fontSize = 17.sp)
|
|
|
|
Text(text = "Temps de lecture : " + e.temps + " minutes", fontSize = 17.sp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -133,18 +133,19 @@ fun AfficherArticle(e : Article){
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Column (modifier = Modifier.align(Alignment.Start)){
|
|
|
|
|
|
|
|
for (text in e.contenus){
|
|
|
|
Column(modifier = Modifier) {
|
|
|
|
when(text){
|
|
|
|
for (text in e.contenus) {
|
|
|
|
|
|
|
|
when (text) {
|
|
|
|
is ContenuMedia -> {
|
|
|
|
is ContenuMedia -> {
|
|
|
|
Text(text = text.titre, fontSize = 20.sp, fontWeight = FontWeight.Bold)
|
|
|
|
Text(text = text.titre, fontSize = 20.sp, fontWeight = FontWeight.Bold)
|
|
|
|
when(text.typeContenu){
|
|
|
|
when (text.typeContenu) {
|
|
|
|
"image" -> {
|
|
|
|
"image" -> {
|
|
|
|
Image(
|
|
|
|
Image(
|
|
|
|
painter = rememberImagePainter(
|
|
|
|
painter = rememberImagePainter(
|
|
|
|
data = text.lien
|
|
|
|
data = text.lien
|
|
|
|
),
|
|
|
|
),
|
|
|
|
contentScale = ContentScale.FillHeight ,
|
|
|
|
contentScale = ContentScale.FillHeight,
|
|
|
|
contentDescription = null,
|
|
|
|
contentDescription = null,
|
|
|
|
modifier = Modifier
|
|
|
|
modifier = Modifier
|
|
|
|
.size(350.dp)
|
|
|
|
.size(350.dp)
|
|
|
@ -152,8 +153,13 @@ fun AfficherArticle(e : Article){
|
|
|
|
.padding(5.dp, 35.dp)
|
|
|
|
.padding(5.dp, 35.dp)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
"video" -> {
|
|
|
|
"video" -> {
|
|
|
|
Text(text = "Ici une video ..."+ text.toString(), fontSize = 15.sp, textAlign = TextAlign.Start)
|
|
|
|
Text(
|
|
|
|
|
|
|
|
text = "Ici une video ..." + text.toString(),
|
|
|
|
|
|
|
|
fontSize = 15.sp,
|
|
|
|
|
|
|
|
textAlign = TextAlign.Start
|
|
|
|
|
|
|
|
)
|
|
|
|
// le player video marche a moitié mais honnetenement je comprends pas le soucis
|
|
|
|
// le player video marche a moitié mais honnetenement je comprends pas le soucis
|
|
|
|
VideoPlayer(videoUrl = text.lien)
|
|
|
|
VideoPlayer(videoUrl = text.lien)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -161,7 +167,8 @@ fun AfficherArticle(e : Article){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
is ContenuParagraphe ->{
|
|
|
|
|
|
|
|
|
|
|
|
is ContenuParagraphe -> {
|
|
|
|
Text(text = text.titre, fontSize = 20.sp, fontWeight = FontWeight.Bold)
|
|
|
|
Text(text = text.titre, fontSize = 20.sp, fontWeight = FontWeight.Bold)
|
|
|
|
Text(text = text.toString(), fontSize = 16.sp, textAlign = TextAlign.Start)
|
|
|
|
Text(text = text.toString(), fontSize = 16.sp, textAlign = TextAlign.Start)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -170,3 +177,36 @@ fun AfficherArticle(e : Article){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@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 DisplayImage(imageURl : String){
|
|
|
|
|
|
|
|
Log.d("ImageLoad", "URL de l'image reçue de l'API : $imageURl")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Image(
|
|
|
|
|
|
|
|
painter = rememberImagePainter(
|
|
|
|
|
|
|
|
data = imageURl
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
contentScale = ContentScale.Crop,
|
|
|
|
|
|
|
|
contentDescription = null,
|
|
|
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
|
|
|
.size(350.dp)
|
|
|
|
|
|
|
|
.padding(5.dp, 35.dp)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|