Class creation : Quote, User,Character, Source, TypeEnum, Question

pull/5/head
kevin.modejar 2 months ago
parent 45dbea5ad4
commit 0a2691eccb

@ -4,6 +4,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
@ -11,6 +12,8 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview 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 import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
@ -19,11 +22,16 @@ class MainActivity : ComponentActivity() {
enableEdgeToEdge() enableEdgeToEdge()
setContent { setContent {
What_The_FantasyTheme { What_The_FantasyTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> Column {
Title( Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
title = "What The Fantasy", Title(
modifier = Modifier.padding(innerPadding) 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) @Preview(showBackground = true)
@Composable @Composable
fun GreetingPreview() { fun GreetingPreview() {

@ -0,0 +1,10 @@
package com.example.what_the_fantasy.model
class Character(
val id:Int,
val character:String,
val imgPath: String
)
{
}

@ -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,
)
{
}

@ -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)
{
}

@ -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
)
{
}

@ -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"),
}

@ -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,
)
{
}

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">What The Fantasy</string>
<string name="movie">Film</string>
<string name="videoGame">Jeu Vidéo</string>
<string name="series">Série</string>
</resources>

@ -1,3 +1,6 @@
<resources> <resources>
<string name="app_name">What_The_Fantasy</string> <string name="app_name">What The Fantasy</string>
<string name="movie">Movie</string>
<string name="videoGame">Video Game</string>
<string name="series">Series</string>
</resources> </resources>
Loading…
Cancel
Save