@ -9,6 +9,7 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@ -20,7 +21,9 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.Send
@ -43,7 +46,9 @@ 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.graphics.ColorFilter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
@ -52,6 +57,7 @@ import com.example.what_the_fantasy.R
import coil.compose.AsyncImage
import com.example.what_the_fantasy.data.model.Comment
import com.example.what_the_fantasy.data.services.IServices
import com.example.what_the_fantasy.logs.LogsUsers
import com.example.what_the_fantasy.ui.components.NavBar
import com.example.what_the_fantasy.ui.states.CurrentUserState
import com.example.what_the_fantasy.ui.theme.colorBackground
@ -93,7 +99,8 @@ fun QuotePage(
Box (
modifier = Modifier
. fillMaxSize ( )
. background ( MaterialTheme . colorScheme . background ) ,
. background ( MaterialTheme . colorScheme . background )
. verticalScroll ( rememberScrollState ( ) ) ,
contentAlignment = Alignment . Center
) {
Column ( modifier = Modifier
@ -112,7 +119,7 @@ fun QuotePage(
FunctionalIcon (
isFavorite = favorite ,
userId = currentUserState . id ,
i d = quoteId ,
quoteI d = quoteId ,
context = context ,
service = service
)
@ -133,6 +140,17 @@ fun QuotePage(
nameId = R . string . charac ,
text = quote . character
)
InfoQuoteText (
nameId = R . string . date ,
text = quote . date . toString ( )
)
InfoQuoteText (
nameId = R . string . type ,
text = quote . type . toString ( )
)
Row (
modifier = Modifier
. padding ( top = 10. dp )
@ -191,7 +209,9 @@ fun ImageQuote(imageUrl : String){
}
@Composable
fun FunctionalIcon ( isFavorite : Boolean , userId : Int , id : Int , context : Context , service : IServices ) {
fun FunctionalIcon ( isFavorite : Boolean , userId : Int , quoteId : Int , context : Context , service : IServices ) {
val logsUsers = LogsUsers ( )
Row ( modifier = Modifier
. fillMaxWidth ( )
) {
@ -201,9 +221,10 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
val sendIntent = Intent ( ) . apply {
action = Intent . ACTION _SEND
// lien a changer quand le site sra deployer
putExtra ( Intent . EXTRA _TEXT , " http://wfWebsite/quote/ $ i d" )
putExtra ( Intent . EXTRA _TEXT , " http://wfWebsite/quote/ $ quoteI d" )
type = " text/plain "
addFlags ( Intent . FLAG _ACTIVITY _NEW _TASK )
logsUsers . shareInformationUser ( " ShareQuote " , quoteId , userId )
}
val shareIntent = Intent . createChooser ( sendIntent , null )
@ -213,6 +234,7 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
} ,
modifier = Modifier . padding ( start = 15. dp )
) {
Icon (
Icons . Default . Share ,
contentDescription = stringResource ( R . string . share ) ,
@ -225,16 +247,21 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
} ,
modifier = Modifier . padding ( start = 20. dp )
) {
Icon (
Icons . Default . MailOutline ,
contentDescription = stringResource ( R . string . comment ) ,
tint = MaterialTheme . colorScheme . onPrimary ,
Image (
painter = painterResource ( id = R . drawable . message ) ,
contentDescription = " message " ,
modifier = Modifier . size ( 30. dp ) ,
colorFilter = ColorFilter . tint ( MaterialTheme . colorScheme . onPrimary )
)
}
if ( isFavorite ) {
IconButton (
onClick = { service . SupFav ( userId = userId , QuoteId = id ) } , //sup fav
onClick = {
service . SupFav ( userId = userId , QuoteId = quoteId )
logsUsers . favoriteInformationUserFalse ( " Favorite " , quoteId , userId )
} , //sup fav
modifier = Modifier . padding ( start = 20. dp )
) {
Icon (
@ -247,7 +274,10 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
}
else {
IconButton (
onClick = { service . AddFav ( userId = userId , QuoteId = id ) } , //add fav
onClick = {
service . AddFav ( userId = userId , QuoteId = quoteId )
logsUsers . favoriteInformationUserTrue ( " Favorite " , quoteId , userId )
} , //add fav
modifier = Modifier . padding ( start = 50. dp )
) {
Icon (