diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt index 2e16aa8..1ae774c 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt @@ -6,7 +6,7 @@ import com.example.what_the_fantasy.data.model.User class LogsUsers{ fun logDebugDisplayUsers(users : List, titleLog : String){ for(user in users){ - Log.e(titleLog, "User created: ${user.username} => ${user.email} => ${user.imgUrl}") + Log.e(titleLog, "User created: ${user.username} => ${user.email} => ${user.imgUrl} => ${user.language}") } } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuoteStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuoteStub.kt index cc321e5..2922816 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuoteStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuoteStub.kt @@ -1,6 +1,8 @@ package com.example.what_the_fantasy.data.local import com.example.what_the_fantasy.data.model.Quote +import com.example.what_the_fantasy.data.model.SrcLanguage +import com.example.what_the_fantasy.data.model.SrcType object QuoteStub { @@ -8,181 +10,221 @@ object QuoteStub { id = 1, content = "All we have to decide is what to do with the time that is given us.", likes = 466, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.gandalf.name, source = "The Lord of the Rings: The Fellowship of the Ring", + date = 2000, + type = SrcType.Movie, imgUrl = CharacterStub.gandalf.imgUrl ) val quote2 = Quote( id = 2, content = "A wizard is never late, nor is he early, he arrives precisely when he means to.", likes = 467, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.gandalf.name, source = "The Lord of the Rings: The Fellowship of the Ring", - imgUrl = CharacterStub.gandalf.imgUrl + imgUrl = CharacterStub.gandalf.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote3 = Quote( id = 3, content = "Even the smallest person can change the course of the future.", likes = 466, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.galadriel.name, source = "The Lord of the Rings: The Fellowship of the Ring", - imgUrl = CharacterStub.galadriel.imgUrl + imgUrl = CharacterStub.galadriel.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote4 = Quote( id = 4, content = "I would rather share one lifetime with you than face all the ages of this world alone.", likes = 120, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.arwen.name, source = "The Lord of the Rings: The Fellowship of the Ring", - imgUrl = CharacterStub.arwen.imgUrl + imgUrl = CharacterStub.arwen.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote5 = Quote( id = 5, content = "Faithless is he that says farewell when the road darkens.", likes = 150, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.gimli.name, source = "The Lord of the Rings: The Fellowship of the Ring", - imgUrl = CharacterStub.gimli.imgUrl + imgUrl = CharacterStub.gimli.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote6 = Quote( id = 6, content = "It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to.", likes = 200, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.frodoBaggins.name, source = "The Lord of the Rings: The Fellowship of the Ring", - imgUrl = CharacterStub.frodoBaggins.imgUrl + imgUrl = CharacterStub.frodoBaggins.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote7 = Quote( id = 7, content = "I am no man.", likes = 300, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.eowyn.name, source = "The Lord of the Rings: The Return of the King", - imgUrl = CharacterStub.eowyn.imgUrl + imgUrl = CharacterStub.eowyn.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote8 = Quote( id = 8, content = "The world is changed. I feel it in the water. I feel it in the earth. I smell it in the air.", likes = 400, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.treebeard.name, source = "The Lord of the Rings: The Two Towers", - imgUrl = CharacterStub.treebeard.imgUrl + imgUrl = CharacterStub.treebeard.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote9 = Quote( id = 9, content = "We wants it, we needs it. Must have the precious.", likes = 500, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.gollum.name, source = "The Lord of the Rings: The Two Towers", - imgUrl = CharacterStub.gollum.imgUrl + imgUrl = CharacterStub.gollum.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote10 = Quote( id = 10, content = "The board is set, the pieces are moving. We come to it at last, the great battle of our time.", likes = 600, - language = "en", + language = SrcLanguage.vo, character = CharacterStub.gandalf.name, source = "The Lord of the Rings: The Return of the King", - imgUrl = CharacterStub.gandalf.imgUrl + imgUrl = CharacterStub.gandalf.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote11 = Quote( id = 11, content = "Un grand pouvoir implique de grandes responsabilités.", likes = 466, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.aragorn.name, source = "Spider-Man", - imgUrl = CharacterStub.aragorn.imgUrl + imgUrl = CharacterStub.aragorn.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote12 = Quote( id = 12, content = "Que la Force soit avec toi.", likes = 467, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.legolas.name, source = "Star Wars", - imgUrl = CharacterStub.legolas.imgUrl + imgUrl = CharacterStub.legolas.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote13 = Quote( id = 13, content = "La magie est partout. Il suffit de savoir où la trouver.", likes = 466, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.gandalf.name, source = "Harry Potter", - imgUrl = CharacterStub.gandalf.imgUrl + imgUrl = CharacterStub.gandalf.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote14 = Quote( id = 14, content = "Le monde est plein de choses magiques, patientant que nos sens s'aiguisent.", likes = 120, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.frodoBaggins.name, source = "Le Seigneur des Anneaux", - imgUrl = CharacterStub.frodoBaggins.imgUrl + imgUrl = CharacterStub.frodoBaggins.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote15 = Quote( id = 15, content = "La peur mène à la colère, la colère mène à la haine, la haine mène à la souffrance.", likes = 150, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.gimli.name, source = "Star Wars", - imgUrl = CharacterStub.gimli.imgUrl + imgUrl = CharacterStub.gimli.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote16 = Quote( id = 16, content = "La vie est une aventure audacieuse ou rien du tout.", likes = 200, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.galadriel.name, source = "Helen Keller", - imgUrl = CharacterStub.galadriel.imgUrl + imgUrl = CharacterStub.galadriel.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote17 = Quote( id = 17, content = "Le courage n'est pas l'absence de peur, mais la capacité de vaincre ce qui fait peur.", likes = 300, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.boromir.name, source = "Nelson Mandela", - imgUrl = CharacterStub.boromir.imgUrl + imgUrl = CharacterStub.boromir.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote18 = Quote( id = 18, content = "La folie, c'est de faire toujours la même chose et de s'attendre à un résultat différent.", likes = 400, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.eowyn.name, source = "Albert Einstein", - imgUrl = CharacterStub.eowyn.imgUrl + imgUrl = CharacterStub.eowyn.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote19 = Quote( id = 19, content = "Le bonheur n'est pas quelque chose de tout fait. Il vient de vos propres actions.", likes = 500, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.saruman.name, source = "Dalaï Lama", - imgUrl = CharacterStub.saruman.imgUrl + imgUrl = CharacterStub.saruman.imgUrl, + date = 2000, + type = SrcType.Movie, ) val quote20 = Quote( id = 20, content = "La vie est un mystère qu'il faut vivre, et non un problème à résoudre.", likes = 600, - language = "fr", + language = SrcLanguage.fr, character = CharacterStub.samwiseGamgee.name, source = "Gandhi", - imgUrl = CharacterStub.samwiseGamgee.imgUrl + imgUrl = CharacterStub.samwiseGamgee.imgUrl, + date = 2000, + type = SrcType.Movie, ) val allQuotes: List = listOf( diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/UserStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/UserStub.kt index d5250eb..da7fe1c 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/UserStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/UserStub.kt @@ -1,40 +1,23 @@ package com.example.what_the_fantasy.data.local +import com.example.what_the_fantasy.data.model.SrcLanguage import com.example.what_the_fantasy.data.model.User object UserStub { //LE MOT DE PASSE POUR TOUS LES UTILISATEURS EST : 1234 val users: MutableList = mutableListOf( - User(1, "Aragorn123", "aragorn@example.com", "2022-01-15", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-fantaisie_1045-185.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"), //1234 - User(2, "Legolas456", "legolas@example.com", "2021-05-23", "https://img.freepik.com/vecteurs-libre/personnage-elfe-fantaisie_1045-186.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(3, "Gandalf789", "gandalf@example.com", "2020-09-10", "https://img.freepik.com/vecteurs-libre/personnage-magicien-fantaisie_1045-187.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(4, "FrodoBaggins", "frodo@example.com", "2023-03-18", "https://img.freepik.com/vecteurs-libre/personnage-hobbit-fantaisie_1045-188.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(5, "Gimli999", "gimli@example.com", "2022-07-04", "https://img.freepik.com/vecteurs-libre/personnage-nain-fantaisie_1045-189.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(6, "Galadriel321", "galadriel@example.com", "2021-11-30", "https://img.freepik.com/vecteurs-libre/personnage-elfe-femme-fantaisie_1045-190.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(7, "Boromir654", "boromir@example.com", "2023-06-22", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-homme-fantaisie_1045-191.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(8, "Eowyn777", "eowyn@example.com", "2022-04-11", "https://img.freepik.com/vecteurs-libre/personnage-guerriere-femme-fantaisie_1045-192.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(9, "Saruman888", "saruman@example.com", "2021-08-15", "https://img.freepik.com/vecteurs-libre/personnage-magicien-malefique-fantaisie_1045-193.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(10, "Faramir222", "faramir@example.com", "2023-02-08", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-homme-fantaisie_1045-194.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"),//1234 - User(11, "dev", "testeur@example.com", "2023-02-08", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-homme-fantaisie_1045-194.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4")//1234 + User(1, "Aragorn123", "aragorn@example.com", "2022-01-15", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-fantaisie_1045-185.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.fr), //1234 + User(2, "Legolas456", "legolas@example.com", "2021-05-23", "https://img.freepik.com/vecteurs-libre/personnage-elfe-fantaisie_1045-186.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.fr),//1234 + User(3, "Gandalf789", "gandalf@example.com", "2020-09-10", "https://img.freepik.com/vecteurs-libre/personnage-magicien-fantaisie_1045-187.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.fr),//1234 + User(4, "FrodoBaggins", "frodo@example.com", "2023-03-18", "https://img.freepik.com/vecteurs-libre/personnage-hobbit-fantaisie_1045-188.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.fr),//1234 + User(5, "Gimli999", "gimli@example.com", "2022-07-04", "https://img.freepik.com/vecteurs-libre/personnage-nain-fantaisie_1045-189.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.vo),//1234 + User(6, "Galadriel321", "galadriel@example.com", "2021-11-30", "https://img.freepik.com/vecteurs-libre/personnage-elfe-femme-fantaisie_1045-190.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.vo),//1234 + User(7, "Boromir654", "boromir@example.com", "2023-06-22", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-homme-fantaisie_1045-191.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.vo),//1234 + User(8, "Eowyn777", "eowyn@example.com", "2022-04-11", "https://img.freepik.com/vecteurs-libre/personnage-guerriere-femme-fantaisie_1045-192.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.vo),//1234 + User(9, "Saruman888", "saruman@example.com", "2021-08-15", "https://img.freepik.com/vecteurs-libre/personnage-magicien-malefique-fantaisie_1045-193.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.vo),//1234 + User(10, "Faramir222", "faramir@example.com", "2023-02-08", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-homme-fantaisie_1045-194.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.vo),//1234 + User(11, "dev", "testeur@example.com", "2023-02-08", "https://img.freepik.com/vecteurs-libre/personnage-guerrier-homme-fantaisie_1045-194.jpg?size=338&ext=jpg", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4", SrcLanguage.fr)//1234 ) - fun addUser(user: User) { - users.add(user) - } - -// -// // Modifier un utilisateur -// fun updateUser(id: Int, updatedUser: User) { -// val index = users.indexOfFirst { it.id == id } -// if (index != -1) { -// users[index] = updatedUser -// } -// } -// -// // Supprimer un utilisateur -// fun removeUser(id: Int) { -// users.removeAll { it.id == id } -// } -// } \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/Quote.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/Quote.kt index 8db4084..75da8b1 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/Quote.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/Quote.kt @@ -1,11 +1,16 @@ package com.example.what_the_fantasy.data.model +import java.util.Date + data class Quote ( val id: Int, val content: String, val likes: Int, - val language: String, + val language: SrcLanguage, val character: String, val source: String, - val imgUrl: String + val imgUrl: String, + val type: SrcType, + val date: Int + ) \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/SrcLanguage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/SrcLanguage.kt new file mode 100644 index 0000000..7c27fbb --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/SrcLanguage.kt @@ -0,0 +1,6 @@ +package com.example.what_the_fantasy.data.model + +enum class SrcLanguage { + fr, + vo +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/User.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/User.kt index 811561b..2749a1c 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/User.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/User.kt @@ -6,5 +6,6 @@ class User( var email:String, var date:String, val imgUrl: String, - var password: String + var password: String, + val language : SrcLanguage ) \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt index a0848f3..70745e7 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt @@ -6,6 +6,7 @@ import com.example.what_the_fantasy.data.local.UserStub import com.example.what_the_fantasy.data.local.UserStub.users import com.example.what_the_fantasy.data.model.User import com.example.what_the_fantasy.Logs.LogsUsers +import com.example.what_the_fantasy.data.model.SrcLanguage import com.example.what_the_fantasy.ui.components.hashPassword import java.time.LocalDate @@ -52,7 +53,7 @@ class ServicesStub : IServices { return false } } - val user = User(nbUser+1,username, email, date,randomImage(userStub), passwordhash) + val user = User(nbUser+1,username, email, date,randomImage(userStub), passwordhash, SrcLanguage.vo) users.add(user)//ajout au stub //Afficher tous les users diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/LittleQuoteComponent.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/LittleQuoteComponent.kt new file mode 100644 index 0000000..3f9481c --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/LittleQuoteComponent.kt @@ -0,0 +1,68 @@ +package com.example.what_the_fantasy.ui.components + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +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.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import coil.compose.AsyncImage +import com.example.what_the_fantasy.R +import com.example.what_the_fantasy.data.model.Quote +import com.example.what_the_fantasy.ui.theme.gradienBox + +@Composable +fun LittleQuoteComponent(quote : Quote){ + Row( + modifier = Modifier + .fillMaxWidth(0.9f) + .clip(RoundedCornerShape(16.dp)) + .background(gradienBox) + ) { + val sizeTextInfoQuote = 13 + val lineHeightText = 12 + val sizeTextQuote = 16 + + AsyncImage( + model = quote.imgUrl, + contentDescription = "Quote picture", + modifier = Modifier + .size(130.dp) + .clip(RoundedCornerShape(16.dp)) + ) + Column(modifier = Modifier.padding(10.dp)) { + + TextInfoQuote( + quote.content, + sizeTextQuote, + lineHeightText + ) + + SpaceHeightComponent(40) + + TextInfoQuote("${stringResource(R.string.dateQuote)} : ${quote.date}", sizeTextInfoQuote, lineHeightText) + TextInfoQuote("${quote.type} : ${quote.source}", sizeTextInfoQuote, lineHeightText) + TextInfoQuote("${stringResource(R.string.CharacterQuote)}: ${quote.character}", sizeTextInfoQuote, lineHeightText) + } + } +} + +@Composable +fun TextInfoQuote(text : String, fontSizeText : Int, lineHeightText : Int){ + Text(text, + color = Color.White, + fontSize = fontSizeText.sp, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + lineHeight = lineHeightText.sp) +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt index 86aad8f..50c1ac7 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt @@ -1,21 +1,28 @@ package com.example.what_the_fantasy.ui.components +import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @Composable -fun TitlePageComponent(titleResId : Int, size : Int, color : Color) { +fun TitlePageComponent(titleResId: Int, color: Color) { val title = stringResource(id = titleResId) Text( text = title, - fontSize = size.sp, + fontSize = 20.sp, fontWeight = FontWeight.Bold, - color = color + color = color, + textAlign = TextAlign.Center, + ) } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt index 9a3438c..c6ce095 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt @@ -3,39 +3,35 @@ package com.example.what_the_fantasy.ui.screens 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.Spacer import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable 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.unit.dp -import androidx.compose.ui.unit.sp import com.example.what_the_fantasy.R -import com.example.what_the_fantasy.data.services.IServices +import com.example.what_the_fantasy.data.local.QuoteStub +import com.example.what_the_fantasy.ui.components.LittleQuoteComponent import com.example.what_the_fantasy.ui.components.NavBar -import com.example.what_the_fantasy.ui.components.SpaceHeightComponent import com.example.what_the_fantasy.ui.components.TitlePageComponent import com.example.what_the_fantasy.ui.theme.colorBackground -import com.example.what_the_fantasy.ui.theme.gradienBox @Composable fun FavoritePage( index: Int, navAccueil: (Int) -> Unit, navQuiz: (Int) -> Unit, - navProfil:(Int) -> Unit + navProfil: (Int) -> Unit ) { - NavBar(onFavorite = true, + NavBar( + onFavorite = true, index = index, - navControllerFavorite = { }, + navControllerFavorite = { }, navControllerAccueil = navAccueil, navControllerProfil = navProfil, navControllerQuiz = navQuiz @@ -45,28 +41,29 @@ fun FavoritePage( .fillMaxSize() .background(colorBackground), contentAlignment = Alignment.Center - ){ - Column { - Box( + ) { + Column(modifier = Modifier + .padding(top = 20.dp), + horizontalAlignment = Alignment.CenterHorizontally) { + TitlePageComponent(R.string.TitleFavorite, Color.White) + + LazyColumn( modifier = Modifier .fillMaxSize() - .background(Color(0xFF100C1B)), - contentAlignment = Alignment.Center + .background(Color(0xFF100C1B)) + .padding(top = 16.dp), + horizontalAlignment = Alignment.CenterHorizontally ) { - Row( - modifier = Modifier - .fillMaxWidth(0.9f) - .padding(20.dp) - .clip(RoundedCornerShape(16.dp)) - .background(gradienBox) - .padding(20.dp), - ) { - Text("Une image") - Text("Une citation d'un personnage") + items(QuoteStub.allQuotes) { quote -> + LittleQuoteComponent(quote) + Spacer(modifier = Modifier.height(16.dp)) } } } } } -} \ No newline at end of file +} + + + diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt index 153a535..fca9d38 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt @@ -73,8 +73,8 @@ fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: (Int) -> Uni horizontalAlignment = Alignment.CenterHorizontally ) { - TitlePageComponent(R.string.titleLogin, 20,Color.White) - SpaceHeightComponent(16) + TitlePageComponent(R.string.titleLogin, Color.White) + SpaceHeightComponent(20) ConnexionButtonLogin(users,IdentifiantTextField(R.string.IdentifiantLogin), PassWdTextField(R.string.PasswdLogin), R.string.ButtonLogin,18, Color.White, Color.Black,navControllerProfil) SpaceHeightComponent(16) CreateAccountButton(R.string.ButtonCreateLogin,12, Color.White, navControllerSignUp) @@ -109,7 +109,7 @@ fun PassWdTextField(textpasswdResId : Int) : String{ val textpasswd = stringResource(id = textpasswdResId) var passwd by remember { mutableStateOf("") } // Stocke la valeur du champ var passwordVisible by remember { mutableStateOf(false) } // État pour afficher/masquer - Column(modifier = Modifier.padding(top = 10.dp)) { + Column(modifier = Modifier.padding(top = 10.dp, bottom = 30.dp)) { OutlinedTextField( value = passwd, onValueChange = { passwd = it }, @@ -156,13 +156,11 @@ fun validLogin(identifiant : String, passwd : String, users : List, navCon users.forEachIndexed { index, user -> val hashPassWd = hashPassword(passwd) if (user.username == identifiant && user.password == hashPassWd) { - // Utilise l'index pour naviguer à la position correspondante navController(index) // Passer l'index à la fonction navController return true } } return false - } @Composable diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt index 7e88bc6..b122258 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt @@ -108,7 +108,7 @@ fun ProfilPage(index: Int, ) { // Titre - TitlePageComponent(R.string.titleProfile, 20, Color.White) + TitlePageComponent(R.string.titleProfile, Color.White) SpaceHeightComponent(16) // Image de profil diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt index 84e592b..13d5ca8 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt @@ -77,7 +77,7 @@ fun SignUpPage(navControllerLogin: () -> Unit, services : IServices) { horizontalAlignment = Alignment.CenterHorizontally ) { - TitlePageComponent(R.string.titleSignUp, 20,Color.White) + TitlePageComponent(R.string.titleSignUp,Color.White) IdentifiantTextFieldSign(R.string.IdentifiantLogin,identifiant = username,onValueChange = { username = it }) EmailTextFieldSign(R.string.EmailSignUp, email, onValueChange = { email = it }) PassWdTextFieldSign(R.string.PasswdLogin,password, onValueChange = { password = it },passwordVisible,onPasswordVisibilityChange = { passwordVisible = !passwordVisible }) diff --git a/What_The_Fantasy/app/src/main/res/values-fr/strings.xml b/What_The_Fantasy/app/src/main/res/values-fr/strings.xml index 6485726..84332fa 100644 --- a/What_The_Fantasy/app/src/main/res/values-fr/strings.xml +++ b/What_The_Fantasy/app/src/main/res/values-fr/strings.xml @@ -34,4 +34,13 @@ Sauvegarder L\'adress email est invalide Les mots de passe ne correspondent pas + + + //Component quote + Date + Personnage + + + //Page Favori + Favoris \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/res/values/strings.xml b/What_The_Fantasy/app/src/main/res/values/strings.xml index 254d478..2fcce63 100644 --- a/What_The_Fantasy/app/src/main/res/values/strings.xml +++ b/What_The_Fantasy/app/src/main/res/values/strings.xml @@ -34,4 +34,11 @@ Invalid email address Passwords do not match + //Component quote + Date + Character + + //Page Favori + Favorites + \ No newline at end of file