|
|
@ -2,7 +2,6 @@ package com.example.what_the_fantasy.ui.screens
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
import android.net.Uri
|
|
|
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
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.text.font.FontWeight
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
import androidx.navigation.NavController
|
|
|
|
|
|
|
|
import com.example.what_the_fantasy.R
|
|
|
|
import com.example.what_the_fantasy.R
|
|
|
|
import com.example.what_the_fantasy.data.model.Quote
|
|
|
|
|
|
|
|
import coil.compose.AsyncImage
|
|
|
|
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.colorBackground
|
|
|
|
import com.example.what_the_fantasy.ui.theme.gradienBox
|
|
|
|
import com.example.what_the_fantasy.ui.theme.gradienBox
|
|
|
|
import com.example.what_the_fantasy.ui.theme.iconText
|
|
|
|
import com.example.what_the_fantasy.ui.theme.iconText
|
|
|
@ -44,9 +42,24 @@ import com.example.what_the_fantasy.ui.theme.likeIcon
|
|
|
|
import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText
|
|
|
|
import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
fun QuotePage(quoteId : Int) {
|
|
|
|
fun QuotePage(
|
|
|
|
var quote : Quote= QuoteStub.quote1 // service -> GetQuote(id)
|
|
|
|
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
|
|
|
|
val context = LocalContext.current
|
|
|
|
|
|
|
|
NavBar(onProfile = true,
|
|
|
|
|
|
|
|
index = index,
|
|
|
|
|
|
|
|
navControllerFavorite = navFavorite,
|
|
|
|
|
|
|
|
navControllerAccueil = navAccueil,
|
|
|
|
|
|
|
|
navControllerProfil = navProfil,
|
|
|
|
|
|
|
|
navControllerQuiz = navQuiz
|
|
|
|
|
|
|
|
) {
|
|
|
|
Box(
|
|
|
|
Box(
|
|
|
|
modifier = Modifier
|
|
|
|
modifier = Modifier
|
|
|
|
.fillMaxSize()
|
|
|
|
.fillMaxSize()
|
|
|
@ -70,7 +83,8 @@ fun QuotePage(quoteId : Int) {
|
|
|
|
|
|
|
|
|
|
|
|
FunctionalIcon(
|
|
|
|
FunctionalIcon(
|
|
|
|
// --/!\-- a modifier --/!\--
|
|
|
|
// --/!\-- a modifier --/!\--
|
|
|
|
// service -> isFavorite(id)
|
|
|
|
// isFavorite = service.isFavorite(id)
|
|
|
|
|
|
|
|
// --------------------------
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
id = quoteId,
|
|
|
|
id = quoteId,
|
|
|
|
context = context
|
|
|
|
context = context
|
|
|
@ -80,7 +94,10 @@ fun QuotePage(quoteId : Int) {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Column(modifier = Modifier.padding(15.dp)) {
|
|
|
|
Column(modifier = Modifier
|
|
|
|
|
|
|
|
.padding(15.dp)
|
|
|
|
|
|
|
|
.fillMaxWidth()
|
|
|
|
|
|
|
|
) {
|
|
|
|
InfoQuoteText(
|
|
|
|
InfoQuoteText(
|
|
|
|
nameId = R.string.source,
|
|
|
|
nameId = R.string.source,
|
|
|
|
text = quote.source
|
|
|
|
text = quote.source
|
|
|
@ -101,8 +118,11 @@ fun QuotePage(quoteId : Int) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------ Composants non partager de la page --------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
fun QuoteText(text: String ){
|
|
|
|
fun QuoteText(text: String ){
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|