diff --git a/What_The_Fantasy/app/build.gradle.kts b/What_The_Fantasy/app/build.gradle.kts index cda6e9d..090bb7f 100644 --- a/What_The_Fantasy/app/build.gradle.kts +++ b/What_The_Fantasy/app/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlinx.serialization) } android { diff --git a/What_The_Fantasy/app/src/debug/ic_launcher-playstore.png b/What_The_Fantasy/app/src/debug/ic_launcher-playstore.png new file mode 100644 index 0000000..ae01d42 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/ic_launcher-playstore.png differ diff --git a/What_The_Fantasy/app/src/debug/res/drawable-v24/ic_launcher_background.xml b/What_The_Fantasy/app/src/debug/res/drawable-v24/ic_launcher_background.xml new file mode 100644 index 0000000..bf08333 --- /dev/null +++ b/What_The_Fantasy/app/src/debug/res/drawable-v24/ic_launcher_background.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/What_The_Fantasy/app/src/debug/res/drawable/ic_launcher_foreground.xml b/What_The_Fantasy/app/src/debug/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..d27e149 --- /dev/null +++ b/What_The_Fantasy/app/src/debug/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml b/What_The_Fantasy/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..bbd3e02 --- /dev/null +++ b/What_The_Fantasy/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml b/What_The_Fantasy/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..bbd3e02 --- /dev/null +++ b/What_The_Fantasy/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher.webp b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..26bf34e Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_background.webp new file mode 100644 index 0000000..00f2778 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..6680fef Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9715e48 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher.webp b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..8e22841 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_background.webp new file mode 100644 index 0000000..8aecbea Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..db9bdff Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..8960c25 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..53287ea Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_background.webp new file mode 100644 index 0000000..99df554 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..6a34471 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..08452cd Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..8f91f68 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_background.webp new file mode 100644 index 0000000..c549423 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..6a0ae81 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..82f6f70 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..177d88b Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_background.webp new file mode 100644 index 0000000..cb0218c Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..84b8046 Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..ed93cfa Binary files /dev/null and b/What_The_Fantasy/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/main/ic_launcher-playstore.png b/What_The_Fantasy/app/src/main/ic_launcher-playstore.png index 5b3e46b..ae01d42 100644 Binary files a/What_The_Fantasy/app/src/main/ic_launcher-playstore.png and b/What_The_Fantasy/app/src/main/ic_launcher-playstore.png differ 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 new file mode 100644 index 0000000..1ae774c --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt @@ -0,0 +1,16 @@ +package com.example.what_the_fantasy.Logs + +import android.util.Log +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} => ${user.language}") + } + } + + fun logDebugDisplayUser(user : User, titleLog : String){ + Log.e(titleLog, "User created: ${user.username} => ${user.email}") + } +} diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt index cbed7f2..55db434 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt @@ -5,6 +5,7 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import com.example.what_the_fantasy.ui.navigations.AppNavigator +import com.example.what_the_fantasy.ui.screens.QuotePage import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme class MainActivity : ComponentActivity() { diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/DailyQuoteStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/DailyQuoteStub.kt index 3ac2826..15bc387 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/DailyQuoteStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/DailyQuoteStub.kt @@ -1,15 +1,19 @@ 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 DailyQuoteStub { - val Dailyquote = Quote( + val dailyQuote = Quote( 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 ) } \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuizStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuizStub.kt new file mode 100644 index 0000000..7e47169 --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuizStub.kt @@ -0,0 +1,126 @@ +package com.example.what_the_fantasy.data.local + +import com.example.what_the_fantasy.data.model.Quiz + +object QuizStub { + val quiz1 = Quiz( + id = 1, + name = "Quiz Seigneur des Anneaux", + questions = listOf( + QuestionStub.question1, + QuestionStub.question4, + QuestionStub.question8, + QuestionStub.question9 + ), + img = "lotr" + ) + + val quiz2 = Quiz( + id = 2, + name = "Quiz Harry Potter", + questions = listOf( + QuestionStub.question2, + QuestionStub.question7, + QuestionStub.question10 + ), + img = "hp" + ) + + val quiz3 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + val quiz4 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + + val quiz5 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + val quiz6 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + val quiz7 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + val quiz8 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + val quiz9 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + val quiz10 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + val quiz11 = Quiz( + id = 3, + name = "Quiz Divers Fantasy", + questions = listOf( + QuestionStub.question3, + QuestionStub.question5, + QuestionStub.question6 + ), + img = "quiz" + ) + + val allQuizzes: List = listOf(quiz1, quiz2, quiz3, quiz4, quiz5, quiz6, quiz7, quiz8, quiz9, quiz10, quiz11) + + fun getQuizById(id: Int): Quiz? { + return allQuizzes.find { it.id == id } + } +} 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/Quiz.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/Quiz.kt new file mode 100644 index 0000000..bfea084 --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/model/Quiz.kt @@ -0,0 +1,8 @@ +package com.example.what_the_fantasy.data.model + +class Quiz ( + val id : Int, + val name : String, + val questions : List, + val img : String +) \ 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/IServices.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/IServices.kt index 5f8ab42..620ba60 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/IServices.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/IServices.kt @@ -1,6 +1,6 @@ package com.example.what_the_fantasy.data.services -import com.example.what_the_fantasy.data.local.UserStub.users +import com.example.what_the_fantasy.data.model.Quote import com.example.what_the_fantasy.data.model.User interface IServices { @@ -9,7 +9,7 @@ interface IServices { fun EditPasswd(passwd : String, index : Int) fun EditImage(imageURL : String, index : Int) - fun CreateUser(username : String, email : String, passwd : String, imageURL: String, services : IServices) : Boolean + fun CreateUser(username : String, email : String, passwd : String, services : IServices) : Boolean fun getFavorite(username: String) fun getAllUsers(): List @@ -17,6 +17,8 @@ interface IServices { fun SearchQuote(quote : String) + fun getQuote( id : Int): Quote? + fun isFavorite(id : Int): Boolean } \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt index bf6d27e..a04178b 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt @@ -1,5 +1,6 @@ package com.example.what_the_fantasy.data.services +import com.example.what_the_fantasy.data.model.Quote import com.example.what_the_fantasy.data.model.User class ServicesAPI : IServices { @@ -19,7 +20,7 @@ class ServicesAPI : IServices { TODO("Not yet implemented") } - override fun CreateUser(username: String, email: String, passwd: String, imageURL: String, services: IServices) : Boolean { + override fun CreateUser(username: String, email: String, passwd: String, services: IServices) : Boolean { TODO("Not yet implemented") } @@ -27,6 +28,14 @@ class ServicesAPI : IServices { TODO("Not yet implemented") } + override fun getQuote(id: Int): Quote? { + TODO("Not yet implemented") + } + + override fun isFavorite(id: Int): Boolean { + TODO("Not yet implemented") + } + override fun getFavorite(username: String) { TODO("Not yet implemented") } 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 f87ede9..995918e 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 @@ -2,20 +2,24 @@ package com.example.what_the_fantasy.data.services import android.annotation.SuppressLint import android.util.Log -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.local.QuoteStub +import com.example.what_the_fantasy.data.model.Quote +import com.example.what_the_fantasy.data.model.SrcLanguage import com.example.what_the_fantasy.ui.components.hashPassword import java.time.LocalDate class ServicesStub : IServices { + val logsUser = LogsUsers() //gestion des logs pour les utilisateurs + override fun EditUsername(username: String, index : Int) { val user = getUserById(index) user?.username = username //Afficher tous les users - debugDisplayUser(getAllUsers(), "UsernameUpdate") - + logsUser.logDebugDisplayUsers(getAllUsers(), "UsernameUpdate") } override fun EditEmail(email: String,index : Int) { @@ -23,7 +27,7 @@ class ServicesStub : IServices { user?.email = email //Afficher tous les users - debugDisplayUser(getAllUsers(), "EmailUpdate") + logsUser.logDebugDisplayUsers(getAllUsers(), "EmailUpdate") } override fun EditPasswd(passwd: String,index : Int) { @@ -32,14 +36,14 @@ class ServicesStub : IServices { user?.password = passwordhash //Afficher tous les users en log - debugDisplayUser(getAllUsers(), "PasswordUpdate") + logsUser.logDebugDisplayUsers(getAllUsers(), "PasswordUpdate") } override fun EditImage(imageURL: String,index : Int) { TODO("Not yet implemented") } - override fun CreateUser(username: String, email: String, passwd: String, imageURL: String, services : IServices) : Boolean { + override fun CreateUser(username: String, email: String, passwd: String, services : IServices) : Boolean { val date =dateDuJour() val passwordhash = hashPassword(passwd) @@ -50,11 +54,11 @@ class ServicesStub : IServices { return false } } - val user = User(nbUser+1,username, email, imageURL, date, passwordhash) + val user = User(nbUser+1,username, email, date,randomImage(userStub), passwordhash, SrcLanguage.vo) users.add(user)//ajout au stub //Afficher tous les users - debugDisplayUser(users, "CreateUser") + logsUser.logDebugDisplayUsers(users, "CreateUser") return true } @@ -68,6 +72,14 @@ class ServicesStub : IServices { TODO("Not yet implemented") } + override fun getQuote(id: Int): Quote? { + return (QuoteStub.allQuotes.find { it.id == id }) + } + + override fun isFavorite(id: Int): Boolean { + TODO("Not yet implemented") + } + override fun getFavorite(username: String) { TODO("Not yet implemented") } @@ -80,10 +92,7 @@ class ServicesStub : IServices { return date.toString() } - - private fun debugDisplayUser(users : List, titleLog : String){ - for(user in users){ - Log.e(titleLog, "User created: ${user.username} => ${user.email} => ${user.password}") - } + fun randomImage(usersImage : List) : String{ + return "https://img.freepik.com/vecteurs-libre/personnage-guerrier-homme-fantaisie_1045-194.jpg?size=338&ext=jpg" } } \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/BackBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/BackBar.kt new file mode 100644 index 0000000..c2deeda --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/BackBar.kt @@ -0,0 +1,64 @@ +package com.example.what_the_fantasy.ui.components + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.rounded.AccountCircle +import androidx.compose.material.icons.rounded.ArrowBack +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.IconButtonColors +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.painterResource +import androidx.compose.ui.unit.dp +import com.example.what_the_fantasy.R +import com.example.what_the_fantasy.ui.theme.colorButtonNav +import com.example.what_the_fantasy.ui.theme.colorNavBar + +@Composable +fun BackBar(navBack : () ->Unit , + content : @Composable ()-> Unit ){ + Column( + modifier = Modifier + .fillMaxSize() + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .height(70.dp) + .background(colorNavBar), + Arrangement.SpaceBetween, + verticalAlignment = Alignment.Bottom + ) { + IconButton(onClick = {navBack()}, + modifier = Modifier + .size(60.dp) + ) { + Icon(Icons.Rounded.ArrowBack, + contentDescription = "Back", + modifier = Modifier + .size(60.dp) + ) + } + + } + + Box(modifier = Modifier.background(Color.Black).fillMaxHeight()) { + content() + } + } +} \ No newline at end of file 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/NavBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt index fba4a70..898376b 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt @@ -1,36 +1,37 @@ package com.example.what_the_fantasy.ui.components -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column - +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.* -import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.BottomAppBar import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.IconButtonColors -import androidx.compose.material3.Text +import androidx.compose.material3.IconToggleButton +import androidx.compose.material3.NavigationBar import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.setValue 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.painter.Painter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.painterResource 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.ui.theme.* @Composable @@ -44,117 +45,108 @@ fun NavBar(onProfile : Boolean = false , navControllerAccueil: (Int) -> Unit, navControllerQuiz: (Int) -> Unit, - content : @Composable ()-> Unit ) { + var theme by remember { mutableStateOf(true) } Column( modifier = Modifier .fillMaxSize() ) { - Row( + NavigationBar( modifier = Modifier - .fillMaxWidth() - .height(70.dp) - .background(colorNavBar), - Arrangement.SpaceBetween, - verticalAlignment = Alignment.Bottom + .fillMaxWidth(), + containerColor = colorNavBar ) { - ButtonIconVectorInt(Icons.Rounded.AccountCircle,"Profile",navControllerProfil,index,onProfile) - - - Button(onClick = {}, - colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent) + Row( + modifier = Modifier + .fillMaxWidth(), + Arrangement.SpaceBetween, + verticalAlignment = Alignment.Bottom ) { - Image( - painter = painterResource(id = R.drawable.toggle), - contentDescription = "Theme" - ) - } + ButtonIconVectorInt(Icons.Rounded.AccountCircle,"Profile",navControllerProfil,index,onProfile) + + + IconButton(onClick = { theme=!theme}, + modifier = Modifier.size(60.dp) + .clip(RoundedCornerShape(0)) + ) { + Icon(painterResource( + if(theme)R.drawable.dark_mode_toggle_icon + else R.drawable.light_mode_toggle_icon), + contentDescription = "Dark mode", + modifier = Modifier.fillMaxSize(), + tint = Color.White + ) + } + } } - Box(modifier = Modifier.background(Color.Black).fillMaxHeight(0.92f)){ + Box(modifier = Modifier.background(Color.Black).fillMaxHeight(0.90f)){ content() } - Row(modifier = Modifier - .background(colorNavBar) + BottomAppBar (modifier = Modifier .fillMaxSize(), - horizontalArrangement = Arrangement.SpaceAround, - verticalAlignment = Alignment.CenterVertically + containerColor = colorNavBar ) { + Row(modifier = Modifier + .fillMaxSize(), + horizontalArrangement = Arrangement.SpaceAround, + verticalAlignment = Alignment.CenterVertically + ) { + + ButtonIconPainterInt(painterResource( + if(onFavorite)R.drawable.favorite_button_full + else R.drawable.favorite_button_empty + ),"Favorite",navControllerFavorite,index,onFavorite) - ButtonIconVectorInt(Icons.Rounded.Favorite,"Favorite",navControllerFavorite,index,onFavorite) + ButtonIconPainterInt(painterResource( + if(onAccueil)R.drawable.home_button_full + else R.drawable.home_button_empty + ),"Accueil",navControllerAccueil,index,onAccueil) - ButtonIconPainterInt(painterResource(R.mipmap.ic_launcher_foreground),"Accueil",navControllerAccueil,index,onAccueil) + ButtonIconPainterInt(painterResource( + if(onQuiz)R.drawable.quiz_button_full + else R.drawable.quiz_button_empty + ),"Quiz",navControllerQuiz,index,onQuiz) - ButtonIconVectorInt(Icons.Rounded.Create,"Quiz",navControllerQuiz,index,onQuiz) + } } } } -@Composable -fun ButtonIconVector(img : ImageVector, name : String, nav : ()->Unit ,onPage : Boolean){ - IconButton(onClick = {nav()}, - enabled = !onPage, - colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné - Color.Transparent, colorButtonNav),//couleur quand il est selectionné - modifier = Modifier - .size(60.dp) - ) { - Icon(img, - contentDescription = name, - modifier = Modifier - .size(60.dp) - ) - } -} + @Composable fun ButtonIconVectorInt(img : ImageVector, name : String, nav : (Int)->Unit ,index: Int,onPage : Boolean){ IconButton(onClick = {nav(index)}, enabled = !onPage, - colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné - Color.Transparent, colorButtonNav),//couleur quand il est selectionné + colors = IconButtonColors(Color.Transparent, colorButtonNav,//couleur quand il n'est pas selectionné + Color.Transparent, colorButtonNavSelected),//couleur quand il est selectionné modifier = Modifier .size(60.dp) ) { Icon(img, contentDescription = name, modifier = Modifier - .size(60.dp) + .fillMaxSize() ) } } -@Composable -fun ButtonIconPainter(img : Painter, name : String, nav : ()->Unit,onPage : Boolean){ - IconButton(onClick = {nav()}, - enabled = !onPage, - colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné - Color.Transparent, colorButtonNav),//couleur quand il est selectionné - modifier = Modifier - .size(60.dp) - ) { - Icon(img, - contentDescription = name, - modifier = Modifier - .size(60.dp) - ) - } -} @Composable fun ButtonIconPainterInt(img : Painter, name : String, nav : (Int)->Unit,index: Int,onPage : Boolean){ IconButton(onClick = {nav(index)}, enabled = !onPage, - colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné - Color.Transparent, colorButtonNav),//couleur quand il est selectionné + colors = IconButtonColors(Color.Transparent,colorButtonNav,//couleur quand il n'est pas selectionné + Color.Transparent, colorButtonNavSelected),//couleur quand il est selectionné modifier = Modifier .size(60.dp) ) { Icon(img, contentDescription = name, modifier = Modifier - .size(60.dp) + .fillMaxSize() ) } } \ 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/navigations/AppNavigator.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt index 9fab1fc..d4c6fb4 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt @@ -6,50 +6,47 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController +import androidx.navigation.toRoute import com.example.what_the_fantasy.data.services.ServicesStub -import com.example.what_the_fantasy.ui.screens.AccueilPage -import com.example.what_the_fantasy.ui.screens.FavoritePage -import com.example.what_the_fantasy.ui.screens.LoginPage -import com.example.what_the_fantasy.ui.screens.ProfilPage -import com.example.what_the_fantasy.ui.screens.QuizEndPage -import com.example.what_the_fantasy.ui.screens.QuizMenu -import com.example.what_the_fantasy.ui.screens.QuizPage -import com.example.what_the_fantasy.ui.screens.QuotePage -import com.example.what_the_fantasy.ui.screens.SearchPage -import com.example.what_the_fantasy.ui.screens.SignUpPage -import com.example.what_the_fantasy.ui.screens.SubmitQuotePage +import com.example.what_the_fantasy.ui.screens.* import com.example.what_the_fantasy.ui.theme.colorNavBar +import kotlinx.serialization.Serializable +@Serializable +data class Accueil(val userIndex: Int) -sealed class Destination(val route: String) { - data object Login : Destination("Login") - data object Accueil : Destination("Accueil/{userIndex}") { // Ajout du paramètre userIndex - fun createRoute(userIndex: Int) = "Accueil/$userIndex" // Fonction pour créer la route avec l'index - } - data object Favorite : Destination("Favorite/{userIndex}") { // Ajout du paramètre userIndex - fun createRoute(userIndex: Int) = "Favorite/$userIndex" // Fonction pour créer la route avec l'index - } - data object Profil : Destination("Profil/{userIndex}") { // Ajout du paramètre userIndex - fun createRoute(userIndex: Int) = "Profil/$userIndex" // Fonction pour créer la route avec l'index - } +@Serializable +data object Login - data object Quote : Destination("Quote") - data object Search : Destination("Search") - data object SignUp : Destination("SignUp") - data object SubmitQuote : Destination("SubmitQuote") +@Serializable +data class Favorite(val userIndex: Int) - data object QuizMenu : Destination("QuizMenu/{userIndex}") { // Ajout du paramètre userIndex - fun createRoute(userIndex: Int) = "QuizMenu/$userIndex" // Fonction pour créer la route avec l'index - } - data object Quiz : Destination("Quiz") - data object QuizEnd : Destination("QuizEnd/{idQuiz}/{pts}") { - fun createIdAndPts(idQuiz : Int, pts : Int) = "QuizEnd/$idQuiz/$pts" - } -} +@Serializable +data class Profil(val userIndex: Int) + +@Serializable +data class QuizMenu(val userIndex: Int) + +@Serializable +data class Quiz(val userIndex: Int, val idQuiz: Int) + +@Serializable +data class QuizEnd(val userIndex: Int, val idQuiz: Int, val pts: Int) + +@Serializable +data class Quote(val quoteId: Int, val userIndex: Int) + +@Serializable +data object Search + +@Serializable +data object SignUp + +@Serializable +data object SubmitQuote @Composable fun AppNavigator() { @@ -61,122 +58,112 @@ fun AppNavigator() { containerColor = colorNavBar ) { paddingValues -> Box(modifier = Modifier.padding(paddingValues)) { - NavHost(navController, startDestination = Destination.Login.route) { - composable(Destination.Login.route) { + NavHost(navController, startDestination = Login) { + composable { LoginPage( - navControllerSignUp = { - navController.navigate(Destination.SignUp.route) - }, + navControllerSignUp = { navController.navigate(SignUp) }, navControllerProfil = { userIndex -> - navController.navigate(Destination.Profil.createRoute(userIndex)) { - popUpTo(Destination.Login.route) { inclusive = true } + navController.navigate(Profil(userIndex)) { + popUpTo(Login) { inclusive = true } } }, - services + services = services ) } - composable(Destination.Accueil.route) { backStackEntry -> - val userIndex = backStackEntry.arguments?.getString("userIndex")?.toInt() ?: -1 + composable { + val accueil: Accueil = it.toRoute() AccueilPage( - index = userIndex, - navFavorite = { userIndex -> - navController.navigate(Destination.Favorite.createRoute(userIndex)) { - popUpTo(Destination.Accueil.createRoute(userIndex)) { inclusive = false } - } - }, - navQuiz = { userIndex -> - navController.navigate(Destination.QuizMenu.createRoute(userIndex)) { - popUpTo(Destination.Accueil.createRoute(userIndex)) { inclusive = false } - } - }, - navProfil = { userIndex -> - navController.navigate(Destination.Profil.createRoute(userIndex)) { - popUpTo(Destination.Accueil.createRoute(userIndex)) { inclusive = false } - } - } + index = accueil.userIndex, + navFavorite = { navController.navigate(Favorite(accueil.userIndex)) }, + navQuiz = { navController.navigate(QuizMenu(accueil.userIndex)) }, + navProfil = { navController.navigate(Profil(accueil.userIndex)) } ) } - composable(Destination.Favorite.route) { - val userIndex = it.arguments?.getString("userIndex")?.toInt() ?: -1 + composable { + val favorite: Favorite = it.toRoute() FavoritePage( - index = userIndex, - navAccueil = { userIndex -> - navController.navigate(Destination.Accueil.createRoute(userIndex)) - }, - navQuiz = { userIndex -> - navController.navigate(Destination.QuizMenu.createRoute(userIndex)) - }, - navProfil = { userIndex -> - navController.navigate(Destination.Profil.createRoute(userIndex)) - }, - services + index = favorite.userIndex, + navAccueil = { navController.navigate(Accueil(favorite.userIndex)) }, + navQuiz = { navController.navigate(QuizMenu(favorite.userIndex)) }, + navProfil = { navController.navigate(Profil(favorite.userIndex)) }, + services = services ) } - composable(Destination.Profil.route) { - val userIndex = it.arguments?.getString("userIndex")?.toInt() ?: -1 + composable { + val profil: Profil = it.toRoute() ProfilPage( - index = userIndex, - navFavorite = { userIndex -> - navController.navigate(Destination.Favorite.createRoute(userIndex)) - }, - navAccueil = { userIndex -> - navController.navigate(Destination.Accueil.createRoute(userIndex)) - }, - navQuiz = { userIndex -> - navController.navigate(Destination.QuizMenu.createRoute(userIndex)) - }, + index = profil.userIndex, + navFavorite = { navController.navigate(Favorite(profil.userIndex)) }, + navAccueil = { navController.navigate(Accueil(profil.userIndex)) }, + navQuiz = { navController.navigate(QuizMenu(profil.userIndex)) }, navUnLog = { - navController.navigate(Destination.Login.route) { - popUpTo(Destination.Profil.route) { inclusive = true } + navController.navigate(Login) { + popUpTo(profil) { inclusive = true } } }, services = services ) } - composable(Destination.Quote.route) { QuotePage() } - composable(Destination.Search.route) { SearchPage() } - composable(Destination.SignUp.route) { + composable { + val quote: Quote = it.toRoute() + QuotePage( + quoteId = quote.quoteId, + index = quote.userIndex, + navAccueil = { navController.navigate(Accueil(quote.userIndex)) }, + navQuiz = { navController.navigate(QuizMenu(quote.userIndex)) }, + navProfil = { navController.navigate(Profil(quote.userIndex)) }, + navFavorite = { navController.navigate(Favorite(quote.userIndex)) }, + service = services + ) + } + composable { SearchPage() } + composable { SignUpPage( navControllerLogin = { - navController.navigate(Destination.Login.route) { - popUpTo(Destination.Login.route) { inclusive = true } + navController.navigate(Login) { + popUpTo(Login) { inclusive = true } } }, - services + services = services ) } - composable(Destination.SubmitQuote.route) { SubmitQuotePage() } - composable(Destination.QuizMenu.route) { - val userIndex = it.arguments?.getString("userIndex")?.toInt() ?: -1 + composable { SubmitQuotePage() } + composable { + val quizMenu: QuizMenu = it.toRoute() QuizMenu( - index = userIndex, - navAccueil = { userIndex -> - navController.navigate(Destination.Accueil.createRoute(userIndex)) - }, - navFavorite = { userIndex -> - navController.navigate(Destination.Favorite.createRoute(userIndex)) - }, - navControllerQuiz = { navController.navigate(Destination.Quiz.route) }, - navProfil = { userIndex -> - navController.navigate(Destination.Profil.createRoute(userIndex)) + index = quizMenu.userIndex, + navAccueil = { navController.navigate(Accueil(quizMenu.userIndex)) }, + navFavorite = { navController.navigate(Favorite(quizMenu.userIndex)) }, + navProfil = { navController.navigate(Profil(quizMenu.userIndex)) }, + navControllerQuiz = { idQuiz -> + navController.navigate(Quiz(quizMenu.userIndex, idQuiz)) } ) } - composable(Destination.Quiz.route) { + composable { + val quiz: Quiz = it.toRoute() QuizPage( + index = quiz.userIndex, + navAccueil = { navController.navigate(Accueil(quiz.userIndex)) }, + navFavorite = { navController.navigate(Favorite(quiz.userIndex)) }, + navProfil = { navController.navigate(Profil(quiz.userIndex)) }, + navQuiz = { navController.navigate(QuizMenu(quiz.userIndex)) }, navControllerQuizEnd = { idQuiz, pts -> - navController.navigate(Destination.QuizEnd.createIdAndPts(idQuiz, pts)) + navController.navigate(QuizEnd(quiz.userIndex, idQuiz, pts)) }, - navControllerQuizMenu = { navController.navigate(Destination.QuizMenu.route) } + idQuiz = quiz.idQuiz ) } - composable(Destination.QuizEnd.route) { backStackEntry -> - val idQuiz = backStackEntry.arguments?.getString("idQuiz")?.toInt() ?: 0 - val pts = backStackEntry.arguments?.getString("pts")?.toInt() ?: 0 + composable { + val quizEnd: QuizEnd = it.toRoute() QuizEndPage( - idQuiz, - pts, - navControllerQuizMenu = { navController.navigate(Destination.QuizMenu.route) } + idQuiz = quizEnd.idQuiz, + points = quizEnd.pts, + index = quizEnd.userIndex, + navAccueil = { navController.navigate(Accueil(quizEnd.userIndex)) }, + navFavorite = { navController.navigate(Favorite(quizEnd.userIndex)) }, + navProfil = { navController.navigate(Profil(quizEnd.userIndex)) }, + navQuiz = { navController.navigate(QuizMenu(quizEnd.userIndex)) } ) } } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt index 8ce38b6..666e669 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt @@ -28,7 +28,7 @@ fun AccueilPage( navProfil: (Int) -> Unit ) { var itemCount by remember { mutableStateOf(15) } - val dailyQuote = DailyQuoteStub.Dailyquote + val dailyQuote = DailyQuoteStub.dailyQuote val quotes = QuoteStub.allQuotes.take(itemCount) NavBar( 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 0bd3724..3ba32aa 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 @@ -4,8 +4,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material3.Button -import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.Text import androidx.compose.runtime.* import androidx.compose.ui.Alignment @@ -14,9 +12,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.example.what_the_fantasy.data.local.DailyQuoteStub import com.example.what_the_fantasy.data.local.FavoriteStub -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.components.QuoteLittle @@ -27,7 +23,7 @@ fun FavoritePage( index: Int, navAccueil: (Int) -> Unit, navQuiz: (Int) -> Unit, - navProfil:(Int) -> Unit, + navProfil: (Int) -> Unit, services: IServices ) { val user = services.getUserById(index) ?: return 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 767b2ad..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 @@ -5,14 +5,18 @@ import androidx.compose.foundation.background import androidx.compose.foundation.clickable 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.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -69,11 +73,9 @@ fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: (Int) -> Uni horizontalAlignment = Alignment.CenterHorizontally ) { - TitlePageComponent(R.string.titleLogin, 20,Color.White) - val identifiant =IdentifiantTextField(R.string.IdentifiantLogin) - val passwd = PassWdTextField(R.string.PasswdLogin) - SpaceHeightComponent(16) - ConnexionButtonLogin(users,identifiant, passwd, R.string.ButtonLogin,18, Color.White, Color.Black,navControllerProfil) + 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) } @@ -81,6 +83,8 @@ fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: (Int) -> Uni } + + @Composable fun IdentifiantTextField(textIdentifiantResId : Int) : String{ val textIdentifiant = stringResource(id = textIdentifiantResId) @@ -94,7 +98,7 @@ fun IdentifiantTextField(textIdentifiantResId : Int) : String{ .fillMaxWidth() .padding(top = 8.dp), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text), - shape = RoundedCornerShape(16.dp) // 🔹 Bords arrondis + shape = RoundedCornerShape(16.dp) // Bords arrondis ) } return identifiant; @@ -105,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 }, @@ -129,31 +133,38 @@ fun PassWdTextField(textpasswdResId : Int) : String{ @Composable fun ConnexionButtonLogin(userStub : List, id : String, passwd : String, titleResId : Int, size : Int, colorButton : Color, colorText : Color, navController: (Int) -> Unit){ val title = stringResource(id = titleResId) - + var showError by remember { mutableStateOf(false) } Button( - onClick = { validLogin(id, passwd, userStub, navController) }, + onClick = { showError = !validLogin(id, passwd, userStub, navController) + }, colors = ButtonDefaults.buttonColors(containerColor = colorButton), modifier = Modifier .fillMaxWidth(), ) { Text(title, fontSize = size.sp, color = colorText) } + + if(showError){ + ErrorMessageProfileComponent(R.string.ErrorLogin) + } } -fun validLogin(identifiant : String, passwd : String, users : List, navController: (Int) -> Unit){ +fun validLogin(identifiant : String, passwd : String, users : List, navController: (Int) -> Unit): Boolean { + 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 -fun CreateAccountButton(titleResId : Int, size : Int, color : Color, navController: () -> Unit){ +fun CreateAccountButton(titleResId : Int, size : Int, color : Color, navController: () -> Unit) { val title = stringResource(id = titleResId) Text( text = title, 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 02d00bc..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 @@ -26,7 +26,9 @@ import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Check +import androidx.compose.material.icons.filled.CheckCircle import androidx.compose.material.icons.filled.Edit +import androidx.compose.material.icons.rounded.Face import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon @@ -105,13 +107,13 @@ fun ProfilPage(index: Int, horizontalAlignment = Alignment.CenterHorizontally ) { - // Titre - TitlePageComponent(R.string.titleProfile, 20, Color.White) - SpaceHeightComponent(16) + // Titre + TitlePageComponent(R.string.titleProfile, Color.White) + SpaceHeightComponent(16) - // Image de profil - ImageProfil(user.imgUrl, 120) - SpaceHeightComponent(16) + // Image de profil + ImageProfil(user.imgUrl, 120) + SpaceHeightComponent(16) EditUsername(user.username, index, services)// Édition du Username SpaceHeightComponent(16) @@ -122,12 +124,12 @@ fun ProfilPage(index: Int, EditPasswd(index, services) SpaceHeightComponent(16) - // Bouton - ButtonProfile(R.string.ButtonAddQuoteprofile, 18, Color.Black, Color.White,navUnLog) // Pas encore de navigation definie - SpaceHeightComponent(16) - ButtonProfile(R.string.ButtonLanguageprofile, 18, Color.Black, Color.White,navUnLog) // Pas encore de navigation definie - SpaceHeightComponent(16) - ButtonProfile(R.string.ButtonUnlogprofile, 18, Color.Black, Color.White, navUnLog) + // Bouton + //ButtonProfile(R.string.ButtonAddQuoteprofile, 18, Color.Black, Color.White,navUnLog) // Pas encore de navigation definie + //SpaceHeightComponent(16) + ButtonProfile(R.string.ButtonLanguageprofile, 18, Color.Black, Color.White,navUnLog) // Pas encore de navigation definie + SpaceHeightComponent(16) + ButtonProfile(R.string.ButtonUnlogprofile, 18, Color.Black, Color.White, navUnLog) } } @@ -199,7 +201,7 @@ fun EmailEditingField( ), trailingIcon = { IconButton(onClick = { if (!emailError) onDone() }) { - Icon(imageVector = Icons.Default.Check, contentDescription = "Valider") + Icon(imageVector = Icons.Default.CheckCircle, contentDescription = "Valider") } }, isError = emailError @@ -275,7 +277,7 @@ fun UsernameEditingField( ), trailingIcon = { IconButton(onClick = { onDone() }) { - Icon(imageVector = Icons.Default.Check, contentDescription = "Valider") + Icon(imageVector = Icons.Default.CheckCircle, contentDescription = "Valider") } } ) @@ -315,7 +317,7 @@ fun EditPasswd(index: Int, service: IServices) { // Fonction pour finaliser l'édition du mot de passe et appeler la méthode EditPasswd2 fun onDoneEditing() { - // Appeler EditPasswd2 pour mettre à jour le mot de passe de l'utilisateur + // Appeler EditPasswd pour mettre à jour le mot de passe de l'utilisateur service.EditPasswd(newPassword, index) isEditingPassword = false } @@ -456,11 +458,6 @@ fun DisplayPassword(onEdit: () -> Unit) { } } - - - - - @Composable fun ButtonProfile(textResId : Int, size :Int, colorTexte : Color, colorButton : Color,navController: () -> Unit){ val text = stringResource(id = textResId) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt index 6b1d652..6578b17 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt @@ -25,6 +25,8 @@ 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.local.QuestionStub +import com.example.what_the_fantasy.data.local.QuizStub +import com.example.what_the_fantasy.ui.components.NavBar val gradient = Brush.linearGradient( colors = listOf(Color(0xFF7B1FA2), Color(0xFF311B92)), @@ -33,100 +35,110 @@ val gradient = Brush.linearGradient( ) @Composable -fun QuizEndPage(idQuiz: Int, points: Int, navControllerQuizMenu: () -> Unit) { - Column( - modifier = Modifier.fillMaxSize().background(Color(0xFF100C1B)) - ) { -// // Bandeau supérieur -// Row( -// modifier = Modifier -// .fillMaxWidth() -// .weight(0.1f) -// .padding(20.dp), -// horizontalArrangement = Arrangement.SpaceBetween, -// verticalAlignment = Alignment.CenterVertically -// ) { -// Image( -// painter = painterResource(id = R.drawable.profile_icon), -// contentDescription = "Profil", -// modifier = Modifier.size(50.dp) -// ) -// Image( -// painter = painterResource(id = R.drawable.toggle), -// contentDescription = "Profil" -// ) -// } - - // Contenu principal +fun QuizEndPage( + idQuiz: Int, + points: Int, + index: Int, + navFavorite: (Int) -> Unit, + navAccueil: (Int) -> Unit, + navProfil:(Int) -> Unit, + navQuiz: (Int) -> Unit, +) { + NavBar(onQuiz = true, + index = index, + navControllerFavorite = navFavorite, + navControllerAccueil = navAccueil, + navControllerProfil = navProfil, + navControllerQuiz = navQuiz) { Column( - modifier = Modifier - .weight(0.8f) - .padding(horizontal = 50.dp, vertical = 20.dp) - .fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally + modifier = Modifier.fillMaxSize().background(Color(0xFF100C1B)) ) { - Text( - text = "▶ Résultats ◀", - color = Color.White, - style = TextStyle(fontSize = 25.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) - ) - Spacer(modifier = Modifier.height(16.dp)) - Column ( + + // Contenu principal + Column( modifier = Modifier - .background(brush = gradient, shape = RoundedCornerShape(20.dp)) - .padding(30.dp) - .fillMaxSize(), + .weight(0.8f) + .padding(horizontal = 50.dp, vertical = 20.dp) + .fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally ) { - Text ( - text = "Quiz N°$idQuiz", + Text( + text = "▶ Résultats ◀", color = Color.White, - style = TextStyle(fontSize = 25.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) + style = TextStyle( + fontSize = 25.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) ) + Spacer(modifier = Modifier.height(16.dp)) + Column( + modifier = Modifier + .background(brush = gradient, shape = RoundedCornerShape(20.dp)) + .padding(30.dp) + .fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.SpaceEvenly + ) { + val quiz = QuizStub.getQuizById(idQuiz) + val nbQuestions = quiz?.questions?.size + Text( + text = "${quiz?.name}", + color = Color.White, + style = TextStyle( + fontSize = 25.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) + ) + Text( + text = "Nombres de Questions : $nbQuestions", + color = Color.White, + style = TextStyle( + fontSize = 15.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) + ) + Text( + text = "Nombres de bonnes réponses : $points", + color = Color.White, + style = TextStyle( + fontSize = 15.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) + ) - val nbQuestions = QuestionStub.allQuestions.size + val pourcentage = (points.toDouble() / nbQuestions!!) * 100 - Text ( - text = "Nombres de Questions : $nbQuestions", - color = Color.White, - style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) - ) - Text ( - text = "Nombres de bonnes réponses : $points", - color = Color.White, - style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) - ) + val note = when { + pourcentage == 100.0 -> "S" + pourcentage >= 70.0 -> "A" + pourcentage >= 40.0 -> "B" + else -> "C" + } + + println("Note obtenue : $note") + + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .size(100.dp) + .background(Color.White, shape = RoundedCornerShape(50.dp)) + ) { + Text( + text = note, + color = Color.Red, + style = TextStyle( + fontSize = 40.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) + ) + } + } } } - -// // Bandeau inférieur -// Row( -// modifier = Modifier -// .fillMaxWidth() -// .weight(0.1f) -// .background(Color(0xFF300052)) -// .padding(20.dp), -// horizontalArrangement = Arrangement.SpaceAround, -// verticalAlignment = Alignment.CenterVertically -// ) { -// // Bouton Likes -// Image( -// painter = painterResource(id = R.drawable.like_icon), -// contentDescription = "Bouton", -// modifier = Modifier.size(50.dp) -// ) -// // Bouton WhatTheFantasy -// Image( -// painter = painterResource(R.drawable.wf_logo), -// contentDescription = "Menu Button", -// Modifier.clickable { navControllerQuizMenu() } -// ) -// // Bouton Quiz -// Image( -// painter = painterResource(id = R.drawable.quiz_icon), -// contentDescription = "Bouton", -// modifier = Modifier.size(50.dp) -// ) -// } } -} \ No newline at end of file +} diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt index 7002a82..99c50af 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt @@ -2,35 +2,50 @@ package com.example.what_the_fantasy.ui.screens import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.clickable +import androidx.compose.foundation.gestures.scrollable +import androidx.compose.foundation.horizontalScroll +import androidx.compose.foundation.layout.Arrangement 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.fillMaxHeight 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.layout.size -import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Text 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.layout.ContentScale +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.TextStyle +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 import com.example.what_the_fantasy.R +import com.example.what_the_fantasy.data.local.QuizStub import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.NavBar @Composable -fun QuizMenu( - index: Int, - navFavorite: (Int) -> Unit, - navAccueil: (Int) -> Unit, - navProfil:(Int) -> Unit, - navControllerQuiz: () -> Unit +fun QuizMenu( index: Int, + navFavorite: (Int) -> Unit, + navAccueil: (Int) -> Unit, + navProfil:(Int) -> Unit, + navControllerQuiz: (Int) -> Unit ) { NavBar(onQuiz = true, index = index, @@ -39,95 +54,79 @@ fun QuizMenu( navControllerProfil = navProfil, navControllerQuiz = { } ) { - Row( - modifier = Modifier - .fillMaxSize() - .background(Color(0xFF100C1B)) - .padding(top = 100.dp) - ) { - Spacer(modifier = Modifier.weight(0.1f)) Column( - modifier = Modifier - .weight(0.9f) - .fillMaxHeight(), - horizontalAlignment = Alignment.CenterHorizontally + modifier = Modifier.fillMaxSize().background(Color(0xFF100C1B)) ) { - Box( - modifier = Modifier - .size(width = 150.dp, height = 100.dp) - .padding(8.dp) - .clickable { - navControllerQuiz() - } - ) { - Image( - painter = painterResource(id = R.drawable.quiz), - contentDescription = "Quiz 1", - modifier = Modifier.fillMaxSize(), - contentScale = ContentScale.Crop - ) - } - - Box( - modifier = Modifier - .size(width = 150.dp, height = 100.dp) - .padding(8.dp) - .clickable { - navControllerQuiz() - } - ) { - Image( - painter = painterResource(id = R.drawable.quiz), - contentDescription = "Quiz 2", - modifier = Modifier.fillMaxSize(), - contentScale = ContentScale.Crop - ) - } - } - - Spacer(modifier = Modifier.width(10.dp)) - + // Contenu princiapl Column( modifier = Modifier .weight(0.9f) - .fillMaxHeight(), + .fillMaxSize() + .padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally ) { - Box( - modifier = Modifier - .size(width = 150.dp, height = 100.dp) - .padding(8.dp) - .clickable { - navControllerQuiz() - } - ) { - Image( - painter = painterResource(id = R.drawable.quiz), - contentDescription = "Quiz 3", - modifier = Modifier.fillMaxSize(), - contentScale = ContentScale.Crop + Text( + text = "▶ Menu des Quiz ◀", + color = Color.White, + style = TextStyle( + fontSize = 25.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center ) - } - - Box( + ) + Spacer(Modifier.height(20.dp)) + Column( modifier = Modifier - .size(width = 150.dp, height = 100.dp) - .padding(8.dp) - .clickable { - navControllerQuiz() - } + .background(brush = gradient, shape = RoundedCornerShape(20.dp)) + .fillMaxSize() + .padding(vertical = 30.dp) + .verticalScroll(rememberScrollState()), + horizontalAlignment = Alignment.CenterHorizontally ) { - Image( - painter = painterResource(id = R.drawable.quiz), - contentDescription = "Quiz 4", - modifier = Modifier.fillMaxSize(), - contentScale = ContentScale.Crop - ) + val quizzes = QuizStub.allQuizzes.chunked(2) + val context = LocalContext.current + for (rowQuizzes in quizzes) { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceEvenly + ) { + for (quiz in rowQuizzes) { + val imageResId = context.resources.getIdentifier( + quiz.img, + "drawable", + context.packageName + ) + Column( + modifier = Modifier + .size(width = 150.dp, height = 145.dp) + .clickable { navControllerQuiz(quiz.id) }, + ) { + Image( + painter = painterResource(id = imageResId), + contentDescription = quiz.name, + modifier = Modifier + .size(width = 150.dp, height = 100.dp) + .clip(shape = RoundedCornerShape(20.dp)), + contentScale = ContentScale.Crop + ) + Spacer(Modifier.height(10.dp)) + Text( + text = quiz.name, + style = TextStyle( + fontSize = 17.sp, + fontWeight = FontWeight.Medium, + textAlign = TextAlign.Center, + color = Color.White + ) + ) + } + } + } + Spacer(Modifier.height(30.dp)) + } } } - - Spacer(modifier = Modifier.weight(0.1f)) } } -} +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt index 4d4ed93..e20a5f2 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt @@ -21,13 +21,24 @@ 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.local.QuestionStub +import com.example.what_the_fantasy.data.local.QuizStub +import com.example.what_the_fantasy.ui.components.BackBar +import com.example.what_the_fantasy.ui.components.NavBar @Composable fun QuizPage( + index: Int, + navFavorite: (Int) -> Unit, + navAccueil: (Int) -> Unit, + navProfil:(Int) -> Unit, + navQuiz: (Int) -> Unit, + navControllerQuizEnd: (Int, Int) -> Unit, - navControllerQuizMenu: () -> Unit -) { - val questions = QuestionStub.allQuestions + + idQuiz: Int + ) { + val quiz = QuizStub.getQuizById(idQuiz) + val questions = quiz?.questions ?: emptyList() var idCurrentQuestion by remember { mutableIntStateOf(0) } var pts by remember { mutableIntStateOf(0) } @@ -48,127 +59,92 @@ fun QuizPage( if (answer == correctAnswer) pts++ if (idCurrentQuestion < questions.size - 1) idCurrentQuestion++ - else navControllerQuizEnd(0, pts) // Retour menu + else navControllerQuizEnd(idQuiz, pts) // Retour menu } - - Column ( + NavBar(onQuiz = true, + index = index, + navControllerFavorite = navFavorite, + navControllerAccueil = navAccueil, + navControllerProfil = navProfil, + navControllerQuiz = navQuiz + ){ + Column ( modifier = Modifier.fillMaxSize().background(Color(0xFF100C1B)) ) { -// // Bandeau supérieur -// Row( -// modifier = Modifier -// .fillMaxWidth() -// .weight(0.1f) -// //.background(Color(0xFF300052)) -// .padding(20.dp), -// horizontalArrangement = Arrangement.SpaceBetween, -// verticalAlignment = Alignment.CenterVertically -// ) { -// Image( -// painter = painterResource(id = R.drawable.profile_icon), -// contentDescription = "Profil" -// ) -// Image( -// painter = painterResource(id = R.drawable.toggle), -// contentDescription = "Profil" -// ) -// } - - // Contenu princiapl - Column( - modifier = Modifier - .weight(0.8f) - .fillMaxWidth() - .padding(horizontal = 50.dp, vertical = 20.dp), - horizontalAlignment = Alignment.CenterHorizontally - ) { - val question = questions[idCurrentQuestion] - + // Contenu princiapl Column( - horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier + .weight(0.8f) + .fillMaxWidth() + .padding(horizontal = 50.dp, vertical = 20.dp), + horizontalAlignment = Alignment.CenterHorizontally ) { - Text( - text = "▶ Quiz ◀", - color = Color.White, - style = TextStyle(fontSize = 25.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) - ) - Column ( - modifier = Modifier - .background(brush = gradient, shape = RoundedCornerShape(20.dp)), - horizontalAlignment = Alignment.CenterHorizontally + val question = questions[idCurrentQuestion] + + Column( + horizontalAlignment = Alignment.CenterHorizontally, ) { - Text( - "Question ${question.id}", - color = Color.White, - fontSize = 18.sp, - modifier = Modifier.padding(top = 20.dp), - style = TextStyle( - fontSize = 25.sp, - fontWeight = FontWeight.Bold, - textAlign = TextAlign.Center + if (quiz != null) { + Text( + text = "▶ ${quiz.name} ◀", + color = Color.White, + style = TextStyle( + fontSize = 20.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) ) - ) - Text( - question.question, - color = Color.White, - fontSize = 22.sp, - modifier = Modifier.padding(40.dp) - ) + } + Spacer(Modifier.height(20.dp)) Column( modifier = Modifier - .padding(top = 30.dp) + .background(brush = gradient, shape = RoundedCornerShape(20.dp)), + horizontalAlignment = Alignment.CenterHorizontally ) { - listOf( - question.ansA, - question.ansB, - question.ansC, - question.ansD - ).forEach { answer -> - Box( - modifier = Modifier - .width(220.dp) - .height(50.dp) - .background(Color.White, shape = RoundedCornerShape(16.dp)) - .clickable { onAnswerSelected(answer) } - .padding(horizontal = 8.dp), - contentAlignment = Alignment.Center - ) { - Text(answer, color = Color.Black, fontSize = 18.sp) + Text( + "Question ${idCurrentQuestion + 1}", + color = Color.White, + fontSize = 18.sp, + modifier = Modifier.padding(top = 20.dp), + style = TextStyle( + fontSize = 25.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) + ) + Text( + question.question, + color = Color.White, + fontSize = 22.sp, + modifier = Modifier.padding(40.dp) + ) + Column( + modifier = Modifier + .padding(top = 30.dp) + ) { + listOf( + question.ansA, + question.ansB, + question.ansC, + question.ansD + ).forEach { answer -> + Box( + modifier = Modifier + .width(220.dp) + .height(50.dp) + .background(Color.White, shape = RoundedCornerShape(16.dp)) + .clickable { onAnswerSelected(answer) } + .padding(horizontal = 8.dp), + contentAlignment = Alignment.Center + ) { + Text(answer, color = Color.Black, fontSize = 18.sp) + } + Spacer(modifier = Modifier.height(60.dp)) } - Spacer(modifier = Modifier.height(60.dp)) } } } } } - -// // Bandeau inférieur -// Row( -// modifier = Modifier -// .fillMaxWidth() -// .weight(0.1f) -// .background(Color(0xFF300052)) -// .padding(20.dp), -// horizontalArrangement = Arrangement.SpaceAround, -// verticalAlignment = Alignment.CenterVertically -// ) { -// // Bouton Likes -// Image( -// painter = painterResource(id = R.drawable.like_icon), -// contentDescription = "Bouton" -// ) -// // Bouton WhatTheFantasy -// Image( -// painter = painterResource(R.drawable.wf_logo), -// contentDescription = "Menu Button", -// Modifier.clickable { navControllerQuizMenu() } -// ) -// // Bouton Quiz -// Image( -// painter = painterResource(id = R.drawable.quiz_icon), -// contentDescription = "Bouton" -// ) -// } - } } \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt index 078c936..16dcfac 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt @@ -1,8 +1,254 @@ package com.example.what_the_fantasy.ui.screens +import android.content.Context +import android.content.Intent +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 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 com.example.what_the_fantasy.R +import coil.compose.AsyncImage +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 +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, + 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 + NavBar(onProfile = true, + index = index, + navControllerFavorite = navFavorite, + navControllerAccueil = navAccueil, + navControllerProfil = navProfil, + navControllerQuiz = navQuiz + ) { + 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 --/!\-- + // isFavorite = service.isFavorite(id) + // -------------------------- + true, + id = quoteId, + context = context + ) + QuoteText( + text = '"' + quote.content + '"' + ) + } + } + Column(modifier = Modifier + .padding(15.dp) + .fillMaxWidth() + ) { + 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( + 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, + ) } \ No newline at end of file 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 bb51217..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 }) @@ -215,11 +215,10 @@ fun ConnexionButtonSign( passwordErrorEmpty = password.isBlank() || confirmPassword.isBlank() if (!emailError && !passwordError && !usernameErrorEmpty && !passwordErrorEmpty) { - usernameErrorExist = !service.CreateUser(username, email, password, "https://img.freepik.com/vecteurs-libre/personnage-magicien-malefique-fantaisie_1045-193.jpg?size=338&ext=jpg", service) + usernameErrorExist = !service.CreateUser(username, email, password, service) if(!usernameErrorExist){ navController() // retour à la page login } - } }, colors = ButtonDefaults.buttonColors(containerColor = colorButton), @@ -253,9 +252,6 @@ fun ConnexionButtonSign( } - - - @Composable fun ReturnLogin(titleResId: Int, size: Int, color: Color, navController: () -> Unit) { val title = stringResource(id = titleResId) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt index 880122c..a06268e 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt @@ -3,6 +3,7 @@ package com.example.what_the_fantasy.ui.theme import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color +import com.example.what_the_fantasy.R val Purple80 = Color(0xFFD0BCFF) val PurpleGrey80 = Color(0xFFCCC2DC) @@ -11,6 +12,9 @@ val Pink80 = Color(0xFFEFB8C8) val Purple40 = Color(0xFF6650a4) val PurpleGrey40 = Color(0xFF625b71) val Pink40 = Color(0xFF7D5260) +val likeIcon = Color.Red +val whiteBackcgroundText = Color.Black +val iconText = Color.White val gradienBox = Brush.linearGradient( colors = listOf(Color(0xFF7B1FA2), Color(0xFF311B92)), // Violet clair → Violet foncé start = Offset(0f, 1000f), // Départ en bas à gauche @@ -18,6 +22,7 @@ val gradienBox = Brush.linearGradient( ) val colorBackground = Color(0xFF100C1B) -val colorNavBar = Color(0xFF2F0E62) +val colorNavBar = Color.Black -val colorButtonNav = Color.Cyan \ No newline at end of file +val colorButtonNavSelected= Color(0xFFC8C8C8) +val colorButtonNav = Color.White \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/res/drawable-v24/ic_launcher_background.xml b/What_The_Fantasy/app/src/main/res/drawable-v24/ic_launcher_background.xml index c495e44..bf08333 100644 --- a/What_The_Fantasy/app/src/main/res/drawable-v24/ic_launcher_background.xml +++ b/What_The_Fantasy/app/src/main/res/drawable-v24/ic_launcher_background.xml @@ -4,10 +4,10 @@ android:height="108dp" android:viewportWidth="202" android:viewportHeight="202"> - + diff --git a/What_The_Fantasy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/What_The_Fantasy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/What_The_Fantasy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/res/drawable/background.xml b/What_The_Fantasy/app/src/main/res/drawable/background.xml new file mode 100644 index 0000000..61d4fc9 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/background.xml @@ -0,0 +1,21 @@ + + + + + + + + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml new file mode 100644 index 0000000..752f388 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml @@ -0,0 +1,9 @@ + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/favorite_button_empty.xml b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_empty.xml new file mode 100644 index 0000000..33a5dda --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_empty.xml @@ -0,0 +1,12 @@ + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/favorite_button_full.xml b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_full.xml new file mode 100644 index 0000000..3443b39 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_full.xml @@ -0,0 +1,10 @@ + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/home_button_empty.xml b/What_The_Fantasy/app/src/main/res/drawable/home_button_empty.xml new file mode 100644 index 0000000..1eba6f8 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/home_button_empty.xml @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/home_button_full.xml b/What_The_Fantasy/app/src/main/res/drawable/home_button_full.xml new file mode 100644 index 0000000..c2959b3 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/home_button_full.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/hp.jpg b/What_The_Fantasy/app/src/main/res/drawable/hp.jpg new file mode 100644 index 0000000..38165f4 Binary files /dev/null and b/What_The_Fantasy/app/src/main/res/drawable/hp.jpg differ diff --git a/What_The_Fantasy/app/src/main/res/drawable/ic_launcher_foreground.xml b/What_The_Fantasy/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..d27e149 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/icondark.xml b/What_The_Fantasy/app/src/main/res/drawable/icondark.xml deleted file mode 100644 index a8b409b..0000000 --- a/What_The_Fantasy/app/src/main/res/drawable/icondark.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml new file mode 100644 index 0000000..8e171be --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml @@ -0,0 +1,10 @@ + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/like_icon.png b/What_The_Fantasy/app/src/main/res/drawable/like_icon.png deleted file mode 100644 index 6d62a6c..0000000 Binary files a/What_The_Fantasy/app/src/main/res/drawable/like_icon.png and /dev/null differ diff --git a/What_The_Fantasy/app/src/main/res/drawable/lotr.jpg b/What_The_Fantasy/app/src/main/res/drawable/lotr.jpg new file mode 100644 index 0000000..642d326 Binary files /dev/null and b/What_The_Fantasy/app/src/main/res/drawable/lotr.jpg differ diff --git a/What_The_Fantasy/app/src/main/res/drawable/profile_icon.png b/What_The_Fantasy/app/src/main/res/drawable/profile_icon.png deleted file mode 100644 index 4fe3158..0000000 Binary files a/What_The_Fantasy/app/src/main/res/drawable/profile_icon.png and /dev/null differ diff --git a/What_The_Fantasy/app/src/main/res/drawable/quiz.jpg b/What_The_Fantasy/app/src/main/res/drawable/quiz.jpg index d0bcef9..3c41482 100644 Binary files a/What_The_Fantasy/app/src/main/res/drawable/quiz.jpg and b/What_The_Fantasy/app/src/main/res/drawable/quiz.jpg differ diff --git a/What_The_Fantasy/app/src/main/res/drawable/quiz_button_empty.xml b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_empty.xml new file mode 100644 index 0000000..a1e039a --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_empty.xml @@ -0,0 +1,11 @@ + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/quiz_button_full.xml b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_full.xml new file mode 100644 index 0000000..dd8a0a4 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_full.xml @@ -0,0 +1,9 @@ + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/quiz_icon.png b/What_The_Fantasy/app/src/main/res/drawable/quiz_icon.png deleted file mode 100644 index a4aca0e..0000000 Binary files a/What_The_Fantasy/app/src/main/res/drawable/quiz_icon.png and /dev/null differ diff --git a/What_The_Fantasy/app/src/main/res/drawable/toggle.png b/What_The_Fantasy/app/src/main/res/drawable/toggle.png deleted file mode 100644 index a21a368..0000000 Binary files a/What_The_Fantasy/app/src/main/res/drawable/toggle.png and /dev/null differ diff --git a/What_The_Fantasy/app/src/main/res/drawable/wf.xml b/What_The_Fantasy/app/src/main/res/drawable/wf.xml new file mode 100644 index 0000000..2fbf017 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/wf.xml @@ -0,0 +1,11 @@ + + + diff --git a/What_The_Fantasy/app/src/main/res/drawable/wf_logo.png b/What_The_Fantasy/app/src/main/res/drawable/wf_logo.png deleted file mode 100644 index 7388be9..0000000 Binary files a/What_The_Fantasy/app/src/main/res/drawable/wf_logo.png and /dev/null differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index c4a603d..bbd3e02 100644 --- a/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index c4a603d..bbd3e02 100644 --- a/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/What_The_Fantasy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher.webp index 8e05350..26bf34e 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher.webp and b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_background.webp new file mode 100644 index 0000000..00f2778 Binary files /dev/null and b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp index c2e99f5..6680fef 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp and b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp index 83f45f5..9715e48 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and b/What_The_Fantasy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher.webp index 6bed1f7..8e22841 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher.webp and b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_background.webp new file mode 100644 index 0000000..8aecbea Binary files /dev/null and b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp index 7074526..db9bdff 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp and b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp index 0962793..8960c25 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and b/What_The_Fantasy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp index 347bbca..53287ea 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_background.webp new file mode 100644 index 0000000..99df554 Binary files /dev/null and b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp index 95d5086..6a34471 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp index e64cea3..08452cd 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp index d8fb7eb..8f91f68 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.webp new file mode 100644 index 0000000..c549423 Binary files /dev/null and b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp index 5f042e9..6a0ae81 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp index 1f9eaae..82f6f70 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp index 3f7d7bc..177d88b 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.webp new file mode 100644 index 0000000..cb0218c Binary files /dev/null and b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp index 17baa06..84b8046 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differ diff --git a/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp index 439f5e7..ed93cfa 100644 Binary files a/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and b/What_The_Fantasy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ 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..47d0063 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 @@ -5,6 +5,15 @@ Jeu Vidéo Série + //Page Quote + Personnage + Source + Partager + Commentaire + Favoris + Likes + Image de profil + //Page Login Connexion au compte Votre identifiant* @@ -34,4 +43,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/colors.xml b/What_The_Fantasy/app/src/main/res/values/colors.xml index f8c6127..86395c4 100644 --- a/What_The_Fantasy/app/src/main/res/values/colors.xml +++ b/What_The_Fantasy/app/src/main/res/values/colors.xml @@ -5,6 +5,10 @@ #FF3700B3 #FF03DAC5 #FF018786 - #FF000000 #FFFFFFFF + + + #FF100C1B + #FF7B1FA2 + #FF311B92 \ 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..0771fb9 100644 --- a/What_The_Fantasy/app/src/main/res/values/strings.xml +++ b/What_The_Fantasy/app/src/main/res/values/strings.xml @@ -4,6 +4,15 @@ Video Game Series + //Page Quote + Character + Source + Share + comment + favorite + likes + Profile picture + //Page Login Account login Your username* @@ -34,4 +43,11 @@ Invalid email address Passwords do not match + //Component quote + Date + Character + + //Page Favori + Favorites + \ No newline at end of file diff --git a/What_The_Fantasy/gradle/libs.versions.toml b/What_The_Fantasy/gradle/libs.versions.toml index 4227d60..26f2026 100644 --- a/What_The_Fantasy/gradle/libs.versions.toml +++ b/What_The_Fantasy/gradle/libs.versions.toml @@ -40,4 +40,4 @@ engage-core = { group = "com.google.android.engage", name = "engage-core", versi [plugins] android-application = { id = "com.android.application", version.ref = "agp" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } - +kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin"}