|
|
|
@ -2,7 +2,6 @@ package com.example.what_the_fantasy.ui.screens
|
|
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
import android.net.Uri
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
@ -32,11 +31,10 @@ import androidx.compose.ui.res.stringResource
|
|
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
|
import androidx.navigation.NavController
|
|
|
|
|
import com.example.what_the_fantasy.R
|
|
|
|
|
import com.example.what_the_fantasy.data.model.Quote
|
|
|
|
|
import coil.compose.AsyncImage
|
|
|
|
|
import com.example.what_the_fantasy.data.local.QuoteStub
|
|
|
|
|
import com.example.what_the_fantasy.data.services.IServices
|
|
|
|
|
import com.example.what_the_fantasy.ui.components.NavBar
|
|
|
|
|
import com.example.what_the_fantasy.ui.theme.colorBackground
|
|
|
|
|
import com.example.what_the_fantasy.ui.theme.gradienBox
|
|
|
|
|
import com.example.what_the_fantasy.ui.theme.iconText
|
|
|
|
@ -44,65 +42,87 @@ import com.example.what_the_fantasy.ui.theme.likeIcon
|
|
|
|
|
import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun QuotePage(quoteId : Int) {
|
|
|
|
|
var quote : Quote= QuoteStub.quote1 // service -> GetQuote(id)
|
|
|
|
|
fun QuotePage(
|
|
|
|
|
quoteId : Int,
|
|
|
|
|
service : IServices,
|
|
|
|
|
index : Int,
|
|
|
|
|
navAccueil: (Int) -> Unit,
|
|
|
|
|
navFavorite:(Int) -> Unit,
|
|
|
|
|
navQuiz: (Int) -> Unit,
|
|
|
|
|
navProfil:(Int) -> Unit)
|
|
|
|
|
{
|
|
|
|
|
var quote = service.getQuote(quoteId) ?: return
|
|
|
|
|
val context = LocalContext.current
|
|
|
|
|
Box(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.fillMaxSize()
|
|
|
|
|
.background(colorBackground),
|
|
|
|
|
contentAlignment = Alignment.Center
|
|
|
|
|
NavBar(onProfile = true,
|
|
|
|
|
index = index,
|
|
|
|
|
navControllerFavorite = navFavorite,
|
|
|
|
|
navControllerAccueil = navAccueil,
|
|
|
|
|
navControllerProfil = navProfil,
|
|
|
|
|
navControllerQuiz = navQuiz
|
|
|
|
|
) {
|
|
|
|
|
Column(modifier = Modifier
|
|
|
|
|
.padding(15.dp)
|
|
|
|
|
.drawBehind {
|
|
|
|
|
drawRoundRect(
|
|
|
|
|
gradienBox,
|
|
|
|
|
cornerRadius = CornerRadius(15.dp.toPx()),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
Box(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.fillMaxSize()
|
|
|
|
|
.background(colorBackground),
|
|
|
|
|
contentAlignment = Alignment.Center
|
|
|
|
|
) {
|
|
|
|
|
Row(modifier = Modifier.padding(15.dp)) {
|
|
|
|
|
ImageQuote(
|
|
|
|
|
imageUrl = quote.imgUrl
|
|
|
|
|
)
|
|
|
|
|
Column {
|
|
|
|
|
|
|
|
|
|
FunctionalIcon(
|
|
|
|
|
// --/!\-- a modifier --/!\--
|
|
|
|
|
// service -> isFavorite(id)
|
|
|
|
|
true,
|
|
|
|
|
id = quoteId,
|
|
|
|
|
context = context
|
|
|
|
|
Column(modifier = Modifier
|
|
|
|
|
.padding(15.dp)
|
|
|
|
|
.drawBehind {
|
|
|
|
|
drawRoundRect(
|
|
|
|
|
gradienBox,
|
|
|
|
|
cornerRadius = CornerRadius(15.dp.toPx()),
|
|
|
|
|
)
|
|
|
|
|
QuoteText(
|
|
|
|
|
text = '"' + quote.content + '"'
|
|
|
|
|
}
|
|
|
|
|
) {
|
|
|
|
|
Row(modifier = Modifier.padding(15.dp)) {
|
|
|
|
|
ImageQuote(
|
|
|
|
|
imageUrl = quote.imgUrl
|
|
|
|
|
)
|
|
|
|
|
Column {
|
|
|
|
|
|
|
|
|
|
FunctionalIcon(
|
|
|
|
|
// --/!\-- a modifier --/!\--
|
|
|
|
|
// isFavorite = service.isFavorite(id)
|
|
|
|
|
// --------------------------
|
|
|
|
|
true,
|
|
|
|
|
id = quoteId,
|
|
|
|
|
context = context
|
|
|
|
|
)
|
|
|
|
|
QuoteText(
|
|
|
|
|
text = '"' + quote.content + '"'
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Column(modifier = Modifier.padding(15.dp)) {
|
|
|
|
|
InfoQuoteText(
|
|
|
|
|
nameId = R.string.source,
|
|
|
|
|
text = quote.source
|
|
|
|
|
)
|
|
|
|
|
InfoQuoteText(
|
|
|
|
|
nameId = R.string.charac,
|
|
|
|
|
text = quote.character
|
|
|
|
|
)
|
|
|
|
|
Row(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.padding(top = 10.dp)
|
|
|
|
|
.align(alignment = Alignment.End)
|
|
|
|
|
Column(modifier = Modifier
|
|
|
|
|
.padding(15.dp)
|
|
|
|
|
.fillMaxWidth()
|
|
|
|
|
) {
|
|
|
|
|
LikeInfo(
|
|
|
|
|
likes = quote.likes
|
|
|
|
|
InfoQuoteText(
|
|
|
|
|
nameId = R.string.source,
|
|
|
|
|
text = quote.source
|
|
|
|
|
)
|
|
|
|
|
InfoQuoteText(
|
|
|
|
|
nameId = R.string.charac,
|
|
|
|
|
text = quote.character
|
|
|
|
|
)
|
|
|
|
|
Row(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.padding(top = 10.dp)
|
|
|
|
|
.align(alignment = Alignment.End)
|
|
|
|
|
) {
|
|
|
|
|
LikeInfo(
|
|
|
|
|
likes = quote.likes
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------ Composants non partager de la page --------------------------------------
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun QuoteText(text: String ){
|
|
|
|
|
Text(
|
|
|
|
|