From 0a2691eccb70d25bcb197180d1989ff328ab028c Mon Sep 17 00:00:00 2001 From: "kevin.modejar" Date: Thu, 6 Feb 2025 12:02:39 +0100 Subject: [PATCH] Class creation : Quote, User,Character, Source, TypeEnum, Question --- .../example/what_the_fantasy/MainActivity.kt | 30 +++++++++++++++---- .../what_the_fantasy/model/Character.kt | 10 +++++++ .../what_the_fantasy/model/Question.kt | 14 +++++++++ .../example/what_the_fantasy/model/Quote.kt | 14 +++++++++ .../example/what_the_fantasy/model/Source.kt | 11 +++++++ .../example/what_the_fantasy/model/SrcType.kt | 7 +++++ .../example/what_the_fantasy/model/User.kt | 12 ++++++++ .../app/src/main/res/values-fr/strings.xml | 7 +++++ .../app/src/main/res/values/strings.xml | 5 +++- 9 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Character.kt create mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Question.kt create mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Quote.kt create mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Source.kt create mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/SrcType.kt create mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/User.kt create mode 100644 What_The_Fantasy/app/src/main/res/values-fr/strings.xml 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 8414a52..bcb135d 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 @@ -4,6 +4,7 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.Scaffold @@ -11,6 +12,8 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import com.example.what_the_fantasy.model.Quote +import com.example.what_the_fantasy.model.SrcType import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme class MainActivity : ComponentActivity() { @@ -19,11 +22,16 @@ class MainActivity : ComponentActivity() { enableEdgeToEdge() setContent { What_The_FantasyTheme { - Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> - Title( - title = "What The Fantasy", - modifier = Modifier.padding(innerPadding) - ) + Column { + Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> + Title( + title = "What The Fantasy", + modifier = Modifier.padding(innerPadding) + ) + Quote( + q = Quote(1,"Test n°1","test","null","test",100,"fr",SrcType.Movie) + ) + } } } } @@ -38,6 +46,18 @@ fun Title(title: String, modifier: Modifier = Modifier) { ) } +@Composable +fun Quote(q: Quote){ + Column { + Text( + text = q.id.toString() + ) + Text( + text = q.content + ) + } +} + @Preview(showBackground = true) @Composable fun GreetingPreview() { diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Character.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Character.kt new file mode 100644 index 0000000..54a066c --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Character.kt @@ -0,0 +1,10 @@ +package com.example.what_the_fantasy.model + +class Character( + val id:Int, + val character:String, + val imgPath: String +) +{ + +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Question.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Question.kt new file mode 100644 index 0000000..e31407a --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Question.kt @@ -0,0 +1,14 @@ +package com.example.what_the_fantasy.model + +class Question( + val id:Int, + val question:String, + val ansA:String, + val ansB:String, + val ansC:String, + val ansD:String, + val correctAns: String, +) +{ + +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Quote.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Quote.kt new file mode 100644 index 0000000..a08ca3a --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Quote.kt @@ -0,0 +1,14 @@ +package com.example.what_the_fantasy.model + +class Quote( + val id:Int, + val content:String, + val character:String, + val imagePath:String, + val titleSrc:String, + var likes:Int, + val lang:String, + val type:SrcType) +{ + +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Source.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Source.kt new file mode 100644 index 0000000..39c4173 --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/Source.kt @@ -0,0 +1,11 @@ +package com.example.what_the_fantasy.model + +class Source( + val id:Int, + val title:String, + val date:String, + val type:SrcType +) +{ + +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/SrcType.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/SrcType.kt new file mode 100644 index 0000000..8f6af55 --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/SrcType.kt @@ -0,0 +1,7 @@ +package com.example.what_the_fantasy.model + +enum class SrcType (val value: String) { + Movie("@string/movie"), + VideoGame("@string/videoGame"), + Series("@string/series"), +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/User.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/User.kt new file mode 100644 index 0000000..1366c29 --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/model/User.kt @@ -0,0 +1,12 @@ +package com.example.what_the_fantasy.model + +class User( + val id:Int, + var username:String, + var email:String, + var date:String, + val imagePath:String, +) +{ + +} \ No newline at end of file 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 new file mode 100644 index 0000000..cfb65f0 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/values-fr/strings.xml @@ -0,0 +1,7 @@ + + + What The Fantasy + Film + Jeu Vidéo + Série + \ 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 180dd4e..75ba845 100644 --- a/What_The_Fantasy/app/src/main/res/values/strings.xml +++ b/What_The_Fantasy/app/src/main/res/values/strings.xml @@ -1,3 +1,6 @@ - What_The_Fantasy + What The Fantasy + Movie + Video Game + Series \ No newline at end of file