After Width: | Height: | Size: 44 KiB |
@ -0,0 +1,26 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="202"
|
||||
android:viewportHeight="202">
|
||||
<group android:scaleX="1.2"
|
||||
android:scaleY="1.2"
|
||||
android:translateX="-20.2"
|
||||
android:translateY="-20.2">
|
||||
<path
|
||||
android:pathData="M30,0L172,0A26,26 0,0 1,198 26L198,168A26,26 0,0 1,172 194L30,194A26,26 0,0 1,4 168L4,26A26,26 0,0 1,30 0z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startX="198"
|
||||
android:startY="194"
|
||||
android:endX="-6.98"
|
||||
android:endY="181.61"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#FF4A148C"/>
|
||||
<item android:offset="1" android:color="#FF7B1FA2"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</group>
|
||||
</vector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 44 KiB |
@ -1,8 +1,234 @@
|
||||
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
|
||||
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.filled.Favorite
|
||||
import androidx.compose.material.icons.filled.FavoriteBorder
|
||||
import androidx.compose.material.icons.filled.MailOutline
|
||||
import androidx.compose.material.icons.filled.Share
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.example.what_the_fantasy.ui.components.NavBar
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
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.ui.theme.colorBackground
|
||||
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.likeIcon
|
||||
import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText
|
||||
|
||||
@Composable
|
||||
fun QuotePage() {
|
||||
fun QuotePage(quoteId : Int) {
|
||||
var quote : Quote= QuoteStub.quote1 // service -> GetQuote(id)
|
||||
val context = LocalContext.current
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(colorBackground),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Column(modifier = Modifier
|
||||
.padding(15.dp)
|
||||
.drawBehind {
|
||||
drawRoundRect(
|
||||
gradienBox,
|
||||
cornerRadius = CornerRadius(15.dp.toPx()),
|
||||
)
|
||||
}
|
||||
) {
|
||||
Row(modifier = Modifier.padding(15.dp)) {
|
||||
ImageQuote(
|
||||
imageUrl = quote.imgUrl
|
||||
)
|
||||
Column {
|
||||
|
||||
FunctionalIcon(
|
||||
// --/!\-- a modifier --/!\--
|
||||
// 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)
|
||||
) {
|
||||
LikeInfo(
|
||||
likes = quote.likes
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun QuoteText(text: String ){
|
||||
Text(
|
||||
text = text,
|
||||
modifier = Modifier.padding(start = 10.dp, top = 15.dp),
|
||||
fontWeight = FontWeight(1000),
|
||||
fontSize = 20.sp,
|
||||
color = iconText
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ImageQuote(imageUrl : String){
|
||||
AsyncImage(
|
||||
model = imageUrl,
|
||||
contentDescription = stringResource(R.string.profilePict),
|
||||
modifier = Modifier
|
||||
.size(150.dp)
|
||||
.clip(RoundedCornerShape(15.dp))
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){
|
||||
Row(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
|
||||
val sendIntent = Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
// lien a changer quand le site sra deployer
|
||||
putExtra(Intent.EXTRA_TEXT, "http://wfWebsite/quote/" + id.toString() )
|
||||
type = "text/plain"
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) // Ajout pour compatibilité
|
||||
}
|
||||
|
||||
val shareIntent = Intent.createChooser(sendIntent, null)
|
||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) // Ajout aussi ici
|
||||
|
||||
context.startActivity(shareIntent)
|
||||
},
|
||||
modifier = Modifier.padding(start = 15.dp)
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Share,
|
||||
contentDescription = stringResource(R.string.share),
|
||||
tint = iconText,
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
onClick = { }, //Go to comment
|
||||
modifier = Modifier.padding(start = 20.dp)
|
||||
){
|
||||
Icon(
|
||||
Icons.Default.MailOutline,
|
||||
contentDescription = stringResource(R.string.comment),
|
||||
tint = iconText,
|
||||
)
|
||||
}
|
||||
|
||||
if(isFavorite){
|
||||
IconButton(
|
||||
onClick = { }, //Go to comment
|
||||
modifier = Modifier.padding(start = 20.dp)
|
||||
){
|
||||
Icon(
|
||||
Icons.Default.Favorite,
|
||||
contentDescription = stringResource(R.string.favorite),
|
||||
tint = likeIcon,
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
IconButton(
|
||||
onClick = { }, //Go to comment
|
||||
modifier = Modifier.padding(start = 50.dp)
|
||||
){
|
||||
Icon(
|
||||
Icons.Default.FavoriteBorder,
|
||||
contentDescription = stringResource(R.string.favorite),
|
||||
tint = iconText
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun InfoQuoteText(nameId : Int, text : String){
|
||||
Column(modifier = Modifier.padding(bottom = 20.dp)){
|
||||
Text(
|
||||
text = stringResource(id = nameId),
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight(500),
|
||||
color = iconText
|
||||
)
|
||||
|
||||
Text(
|
||||
text = text,
|
||||
color = whiteBackcgroundText,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight(400),
|
||||
modifier = Modifier
|
||||
.drawBehind {
|
||||
drawRoundRect(
|
||||
Color(255,255,255),
|
||||
cornerRadius = CornerRadius(15.dp.toPx())
|
||||
)
|
||||
}
|
||||
.padding(5.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LikeInfo(likes : Int){
|
||||
Text(
|
||||
text = likes.toString(),
|
||||
color = iconText
|
||||
)
|
||||
Icon(
|
||||
Icons.Default.Favorite,
|
||||
contentDescription = stringResource(R.string.favorite),
|
||||
tint = iconText,
|
||||
)
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
@ -0,0 +1,21 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="202dp"
|
||||
android:height="202dp"
|
||||
android:viewportWidth="202"
|
||||
android:viewportHeight="202">
|
||||
<path
|
||||
android:pathData="M30,0L172,0A26,26 0,0 1,198 26L198,168A26,26 0,0 1,172 194L30,194A26,26 0,0 1,4 168L4,26A26,26 0,0 1,30 0z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startX="198"
|
||||
android:startY="194"
|
||||
android:endX="-6.98"
|
||||
android:endY="181.61"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#FF4A148C"/>
|
||||
<item android:offset="1" android:color="#FF7B1FA2"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</selector>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 13 KiB |